create-strapi-app
Version:
Generate a new Strapi application.
1 lines • 1.82 kB
Source Map (JSON)
{"version":3,"file":"check-install-path.mjs","sources":["../../src/utils/check-install-path.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport chalk from 'chalk';\nimport fse from 'fs-extra';\nimport { logger } from './logger';\n\n// Checks if the an empty directory exists at rootPath\nexport async function checkInstallPath(directory: string): Promise<string> {\n const rootPath = resolve(directory);\n\n if (await fse.pathExists(rootPath)) {\n const stat = await fse.stat(rootPath);\n\n if (!stat.isDirectory()) {\n logger.fatal(\n `${chalk.green(\n rootPath\n )} is not a directory. Make sure to create a Strapi application in an empty directory.`\n );\n }\n\n const files = await fse.readdir(rootPath);\n if (files.length > 1) {\n logger.fatal([\n 'You can only create a Strapi app in an empty directory',\n `Make sure ${chalk.green(rootPath)} is empty.`,\n ]);\n }\n }\n\n return rootPath;\n}\n"],"names":["checkInstallPath","directory","rootPath","resolve","fse","pathExists","stat","isDirectory","logger","fatal","chalk","green","files","readdir","length"],"mappings":";;;;;AAKA;AACO,eAAeA,iBAAiBC,SAAiB,EAAA;AACtD,IAAA,MAAMC,WAAWC,OAAQF,CAAAA,SAAAA,CAAAA;AAEzB,IAAA,IAAI,MAAMG,GAAAA,CAAIC,UAAU,CAACH,QAAW,CAAA,EAAA;AAClC,QAAA,MAAMI,IAAO,GAAA,MAAMF,GAAIE,CAAAA,IAAI,CAACJ,QAAAA,CAAAA;QAE5B,IAAI,CAACI,IAAKC,CAAAA,WAAW,EAAI,EAAA;YACvBC,MAAOC,CAAAA,KAAK,CACV,CAAC,EAAEC,MAAMC,KAAK,CACZT,QACA,CAAA,CAAA,oFAAoF,CAAC,CAAA;AAE3F;AAEA,QAAA,MAAMU,KAAQ,GAAA,MAAMR,GAAIS,CAAAA,OAAO,CAACX,QAAAA,CAAAA;QAChC,IAAIU,KAAAA,CAAME,MAAM,GAAG,CAAG,EAAA;AACpBN,YAAAA,MAAAA,CAAOC,KAAK,CAAC;AACX,gBAAA,wDAAA;AACA,gBAAA,CAAC,UAAU,EAAEC,KAAAA,CAAMC,KAAK,CAACT,QAAAA,CAAAA,CAAU,UAAU;AAC9C,aAAA,CAAA;AACH;AACF;IAEA,OAAOA,QAAAA;AACT;;;;"}