{"version":3,"file":"start.mjs","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n const buildDirExists = fs.existsSync(outDir);\n if (isTSProject && !buildDirExists)\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","isTSProject","tsUtils","isUsingTypeScript","outDir","resolveOutDir","distDir","buildDirExists","fs","existsSync","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAS,GAAA,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAc,GAAA,MAAMC,gBAAQC,CAAAA,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAS,GAAA,MAAMF,gBAAQG,CAAAA,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAASN,GAAAA,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,EAAGC,CAAAA,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,MACR,CAAC,EAAEN,MAAO,CAAA,mFAAmF,CAAC,CAAA;IAGlGO,YAAa,CAAA;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,UAAU,OAASnB,EAAAA,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}