create-strapi-app 4.6.0-alpha.0 → 4.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create-strapi-app.js +16 -16
- package/package.json +4 -4
package/create-strapi-app.js
CHANGED
|
@@ -7,7 +7,7 @@ const promptUser = require('./utils/prompt-user');
|
|
|
7
7
|
// eslint-disable-next-line import/extensions
|
|
8
8
|
const packageJson = require('./package.json');
|
|
9
9
|
|
|
10
|
-
const program = new commander.Command(
|
|
10
|
+
const program = new commander.Command();
|
|
11
11
|
|
|
12
12
|
const databaseOptions = [
|
|
13
13
|
'dbclient',
|
|
@@ -21,6 +21,7 @@ const databaseOptions = [
|
|
|
21
21
|
];
|
|
22
22
|
|
|
23
23
|
program
|
|
24
|
+
.command(packageJson.name)
|
|
24
25
|
.version(packageJson.version)
|
|
25
26
|
.arguments('[directory]')
|
|
26
27
|
.option('--no-run', 'Do not start the application after it is created')
|
|
@@ -39,8 +40,8 @@ program
|
|
|
39
40
|
.option('--template <templateurl>', 'Specify a Strapi template')
|
|
40
41
|
.option('--ts, --typescript', 'Use TypeScript to generate the project')
|
|
41
42
|
.description('create a new application')
|
|
42
|
-
.action((directory) => {
|
|
43
|
-
initProject(directory, program);
|
|
43
|
+
.action((directory, options) => {
|
|
44
|
+
initProject(directory, program, options);
|
|
44
45
|
})
|
|
45
46
|
.parse(process.argv);
|
|
46
47
|
|
|
@@ -57,7 +58,7 @@ function generateApp(projectName, options) {
|
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
async function initProject(projectName, program) {
|
|
61
|
+
async function initProject(projectName, program, inputOptions) {
|
|
61
62
|
if (projectName) {
|
|
62
63
|
await checkInstallPath(resolve(projectName));
|
|
63
64
|
}
|
|
@@ -65,15 +66,14 @@ async function initProject(projectName, program) {
|
|
|
65
66
|
const programFlags = program.options
|
|
66
67
|
.reduce((acc, { short, long }) => [...acc, short, long], [])
|
|
67
68
|
.filter(Boolean);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.error(`${program.template} is not a valid template`);
|
|
69
|
+
if (inputOptions.template && programFlags.includes(inputOptions.template)) {
|
|
70
|
+
console.error(`${inputOptions.template} is not a valid template`);
|
|
71
71
|
process.exit(1);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const hasDatabaseOptions = databaseOptions.some((opt) =>
|
|
74
|
+
const hasDatabaseOptions = databaseOptions.some((opt) => inputOptions[opt]);
|
|
75
75
|
|
|
76
|
-
if (
|
|
76
|
+
if (inputOptions.quickstart && hasDatabaseOptions) {
|
|
77
77
|
console.error(
|
|
78
78
|
`The quickstart option is incompatible with the following options: ${databaseOptions.join(
|
|
79
79
|
', '
|
|
@@ -83,24 +83,24 @@ async function initProject(projectName, program) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (hasDatabaseOptions) {
|
|
86
|
-
|
|
86
|
+
inputOptions.quickstart = false; // Will disable the quickstart question because != 'undefined'
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
if (
|
|
90
|
-
return generateApp(projectName,
|
|
89
|
+
if (inputOptions.quickstart) {
|
|
90
|
+
return generateApp(projectName, inputOptions);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const prompt = await promptUser(projectName,
|
|
93
|
+
const prompt = await promptUser(projectName, inputOptions, hasDatabaseOptions);
|
|
94
94
|
const directory = prompt.directory || projectName;
|
|
95
95
|
await checkInstallPath(resolve(directory));
|
|
96
96
|
|
|
97
97
|
const options = {
|
|
98
|
-
template:
|
|
99
|
-
quickstart: prompt.quick ||
|
|
98
|
+
template: inputOptions.template,
|
|
99
|
+
quickstart: prompt.quick || inputOptions.quickstart,
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
const generateStrapiAppOptions = {
|
|
103
|
-
...
|
|
103
|
+
...inputOptions,
|
|
104
104
|
...options,
|
|
105
105
|
};
|
|
106
106
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-strapi-app",
|
|
3
|
-
"version": "4.6.0-
|
|
3
|
+
"version": "4.6.0-beta.0",
|
|
4
4
|
"description": "Generate a new Strapi application.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@strapi/generate-new": "4.6.0-
|
|
7
|
-
"commander": "
|
|
6
|
+
"@strapi/generate-new": "4.6.0-beta.0",
|
|
7
|
+
"commander": "8.2.0",
|
|
8
8
|
"inquirer": "8.2.4"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"node": ">=14.19.1 <=18.x.x",
|
|
47
47
|
"npm": ">=6.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "c0c3365ad801d088a6ab6c4eb95a014078429747"
|
|
50
50
|
}
|