{"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,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAAA,GAAc,MAAMC,gBAAAA,CAAQC,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAAA,GAAS,MAAMF,gBAAAA,CAAQG,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAAAA,GAASN,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,EAAAA,CAAGC,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,KAAAA,CACR,CAAA,EAAGN,MAAAA,CAAO,mFAAmF,CAAC,CAAA;IAGlGO,YAAAA,CAAa;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,UAAU,OAAA,EAASnB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}