Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/strapi-generate-new/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
/**
* Module dependencies
*/
// Node.js core.
const chalk = require('chalk');
const inquirer = require('inquirer');
const fse = require('fs-extra');
const { trackUsage } = require('./utils/usage');
const stopProcess = require('./utils/stop-process');
const createCLIDatabaseProject = require('./create-cli-db-project');
const createCustomizeProject = require('./create-customized-project');
const createQuickStartProject = require('./create-quickstart-project');
module.exports = async scope => {
const hasDatabaseConfig = Boolean(scope.database);
// check rootPath is empty
if (await fse.exists(scope.rootPath)) {
const stat = await fse.stat(scope.rootPath);
if (!stat.isDirectory()) {
stopProcess(
`⛔️ ${chalk.green(
scope.rootPath
)} is not a directory. Make sure to create a Strapi application in an empty directory.`
);
}
const files = await fse.readdir(scope.rootPath);
if (files.length > 1) {
stopProcess(
`⛔️ You can only create a Strapi app in an empty directory.\nMake sure ${chalk.green(
scope.rootPath
)} is empty.`
);
}
}
await trackUsage({ event: 'willCreateProject', scope });
// if database config is provided don't test the connection and create the project directly
if (hasDatabaseConfig) {
return createCLIDatabaseProject(scope);
}
// if cli quickstart create project with default sqlite options
if (scope.quick === true) {
return createQuickStartProject(scope);
}
const useQuickStart = await askShouldUseQuickstart();
// else if question response is quickstart create project
if (useQuickStart) {
return createQuickStartProject(scope);
}
// create a project with full list of questions
return createCustomizeProject(scope);
};
async function askShouldUseQuickstart() {
const answer = await inquirer.prompt([
{
type: 'list',
name: 'type',
message: 'Choose your installation type',
choices: [
{
name: 'Quickstart (recommended)',
value: 'quick',
},
{
name: 'Custom (manual settings)',
value: 'custom',
},
],
},
]);
return answer.type === 'quick';
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0319 ]-- |