mirror of
https://github.com/strapi/strapi.git
synced 2025-07-19 07:02:26 +00:00

Create starter CLI Add spaces option Extract project basename Add starter shortcut Refactor git init commit Replace concurrently with npm-run-all Move fetch repo function to dedicated file Allow shortcut to accept external org repo Fix package config & readme Fix versions Add task prefixes Update readme [Starter CLI] error handling (#9600) * Display error message + help for missing arguments * Add cleaner error messages * Bump commander from v6.1.0 to v7.1.0 * Capture and log errors from commander * Simplify cli argument errors * Provide more human readable error messages * Replace throw with console log * Add logger Add starter tracking Add wrapper for tracking keys Update root config Keep template in scope root fix strapi config Fix open frontend Remove open-cli Update for rename frontend->starter update description Update tracking Fix tests fix e2e tests Make sure packageJsonStrapi does not override unwanted keys & make it optional to avoid errors simplify metadata strapi Allow stater or frontend folder for smooth migration of existing starters Udpate dep Handle error
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const commander = require('commander');
|
|
|
|
const packageJson = require('./package.json');
|
|
const buildStarter = require('./utils/build-starter');
|
|
|
|
const program = new commander.Command(packageJson.name);
|
|
|
|
program
|
|
.version(packageJson.version)
|
|
.arguments('<directory> <starterurl>')
|
|
.option('--use-npm', 'Force usage of npm instead of yarn to create the project')
|
|
.option('--debug', 'Display database connection error')
|
|
.option('--quickstart', 'Quickstart app creation')
|
|
.option('--dbclient <dbclient>', 'Database client')
|
|
.option('--dbhost <dbhost>', 'Database host')
|
|
.option('--dbsrv <dbsrv>', 'Database srv')
|
|
.option('--dbport <dbport>', 'Database port')
|
|
.option('--dbname <dbname>', 'Database name')
|
|
.option('--dbusername <dbusername>', 'Database username')
|
|
.option('--dbpassword <dbpassword>', 'Database password')
|
|
.option('--dbssl <dbssl>', 'Database SSL')
|
|
.option('--dbauth <dbauth>', 'Authentication Database')
|
|
.option('--dbfile <dbfile>', 'Database file path for sqlite')
|
|
.option('--dbforce', 'Overwrite database content if any')
|
|
.description(
|
|
'Create a fullstack monorepo application using the strapi backend template specified in the provided starter'
|
|
)
|
|
.action((directory, starterUrl, programArgs) => {
|
|
const projectArgs = { projectName: directory, starterUrl };
|
|
|
|
buildStarter(projectArgs, programArgs).catch(error => {
|
|
console.error(error.message);
|
|
process.exit(1);
|
|
});
|
|
});
|
|
|
|
program.exitOverride();
|
|
|
|
try {
|
|
program.parse(process.argv);
|
|
} catch (err) {
|
|
if (err.exitCode && err.exitCode != 0) {
|
|
program.outputHelp();
|
|
}
|
|
}
|