@strapi/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
1 lines • 2.97 kB
Source Map (JSON)
{"version":3,"file":"start.mjs","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\nimport { tryQuickOutDir } from '../utils/try-quick-outdir';\n\nconst action = async () => {\n const appDir = process.cwd();\n const tsconfigPath = path.join(appDir, 'tsconfig.json');\n\n let distDir: string;\n\n if (!fs.existsSync(tsconfigPath)) {\n distDir = appDir;\n } else {\n const quickOutDir = tryQuickOutDir(appDir, tsconfigPath);\n\n if (quickOutDir && fs.existsSync(path.join(quickOutDir, 'src', 'index.js'))) {\n // Built output at configured outDir — skip loading `@strapi/typescript-utils`\n distDir = quickOutDir;\n } else {\n // Custom/extended tsconfig or unbuilt project — fall back to the slow correct path\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsUtils = require('@strapi/typescript-utils');\n const outDir = await tsUtils.resolveOutDir(appDir);\n\n if (!fs.existsSync(outDir)) {\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n }\n\n distDir = outDir;\n }\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","tsconfigPath","path","join","distDir","fs","existsSync","quickOutDir","tryQuickOutDir","tsUtils","require","outDir","resolveOutDir","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;;AASA,MAAMA,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAC1B,IAAA,MAAMC,YAAAA,GAAeC,IAAAA,CAAKC,IAAI,CAACL,MAAAA,EAAQ,eAAA,CAAA;IAEvC,IAAIM,OAAAA;AAEJ,IAAA,IAAI,CAACC,EAAAA,CAAGC,UAAU,CAACL,YAAAA,CAAAA,EAAe;QAChCG,OAAAA,GAAUN,MAAAA;IACZ,CAAA,MAAO;QACL,MAAMS,WAAAA,GAAcC,eAAeV,MAAAA,EAAQG,YAAAA,CAAAA;QAE3C,IAAIM,WAAAA,IAAeF,GAAGC,UAAU,CAACJ,KAAKC,IAAI,CAACI,WAAAA,EAAa,KAAA,EAAO,UAAA,CAAA,CAAA,EAAc;;YAE3EH,OAAAA,GAAUG,WAAAA;QACZ,CAAA,MAAO;;;AAGL,YAAA,MAAME,UAAUC,OAAAA,CAAQ,0BAAA,CAAA;AACxB,YAAA,MAAMC,MAAAA,GAAS,MAAMF,OAAAA,CAAQG,aAAa,CAACd,MAAAA,CAAAA;AAE3C,YAAA,IAAI,CAACO,EAAAA,CAAGC,UAAU,CAACK,MAAAA,CAAAA,EAAS;AAC1B,gBAAA,MAAM,IAAIE,KAAAA,CACR,CAAA,EAAGF,MAAAA,CAAO,mFAAmF,CAAC,CAAA;AAElG,YAAA;YAEAP,OAAAA,GAAUO,MAAAA;AACZ,QAAA;AACF,IAAA;IAEAG,YAAAA,CAAa;AAAEhB,QAAAA,MAAAA;AAAQM,QAAAA;AAAQ,KAAA,CAAA,CAAGW,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZrB,MAAM,CAACsB,UAAU,OAAA,EAAStB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}