create-strapi-app 4.10.0-beta.0 → 4.10.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/bin/index.js +5 -0
- package/dist/create-strapi-app.d.ts +1 -0
- package/dist/create-strapi-app.js +94 -0
- package/dist/create-strapi-app.js.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/prompt-user.d.ts +7 -0
- package/dist/utils/prompt-user.js +35 -0
- package/dist/utils/prompt-user.js.map +1 -0
- package/package.json +18 -8
- package/create-strapi-app.js +0 -108
- package/index.js +0 -5
- package/utils/prompt-user.js +0 -46
package/bin/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const commander_1 = __importDefault(require("commander"));
|
|
9
|
+
const generate_new_1 = require("@strapi/generate-new");
|
|
10
|
+
const prompt_user_1 = __importDefault(require("./utils/prompt-user"));
|
|
11
|
+
const packageJson = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.resolve)(__dirname, '../package.json'), 'utf8'));
|
|
12
|
+
const command = new commander_1.default.Command(packageJson.name);
|
|
13
|
+
const databaseOptions = [
|
|
14
|
+
'dbclient',
|
|
15
|
+
'dbhost',
|
|
16
|
+
'dbport',
|
|
17
|
+
'dbname',
|
|
18
|
+
'dbusername',
|
|
19
|
+
'dbpassword',
|
|
20
|
+
'dbssl',
|
|
21
|
+
'dbfile',
|
|
22
|
+
];
|
|
23
|
+
command
|
|
24
|
+
.version(packageJson.version)
|
|
25
|
+
.arguments('[directory]')
|
|
26
|
+
.option('--no-run', 'Do not start the application after it is created')
|
|
27
|
+
.option('--use-npm', 'Force usage of npm instead of yarn to create the project')
|
|
28
|
+
.option('--debug', 'Display database connection error')
|
|
29
|
+
.option('--quickstart', 'Quickstart app creation')
|
|
30
|
+
.option('--dbclient <dbclient>', 'Database client')
|
|
31
|
+
.option('--dbhost <dbhost>', 'Database host')
|
|
32
|
+
.option('--dbport <dbport>', 'Database port')
|
|
33
|
+
.option('--dbname <dbname>', 'Database name')
|
|
34
|
+
.option('--dbusername <dbusername>', 'Database username')
|
|
35
|
+
.option('--dbpassword <dbpassword>', 'Database password')
|
|
36
|
+
.option('--dbssl <dbssl>', 'Database SSL')
|
|
37
|
+
.option('--dbfile <dbfile>', 'Database file path for sqlite')
|
|
38
|
+
.option('--dbforce', 'Overwrite database content if any')
|
|
39
|
+
.option('--template <templateurl>', 'Specify a Strapi template')
|
|
40
|
+
.option('--ts, --typescript', 'Use TypeScript to generate the project')
|
|
41
|
+
.description('create a new application')
|
|
42
|
+
.action((directory, programArgs) => {
|
|
43
|
+
initProject(directory, programArgs);
|
|
44
|
+
})
|
|
45
|
+
.parse(process.argv);
|
|
46
|
+
function generateApp(projectName, options) {
|
|
47
|
+
if (!projectName) {
|
|
48
|
+
console.error('Please specify the <directory> of your project when using --quickstart');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
return (0, generate_new_1.generateNewApp)(projectName, options).then(() => {
|
|
52
|
+
if (process.platform === 'win32') {
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function initProject(projectName, programArgs) {
|
|
58
|
+
if (projectName) {
|
|
59
|
+
await (0, generate_new_1.checkInstallPath)((0, node_path_1.resolve)(projectName));
|
|
60
|
+
}
|
|
61
|
+
const programFlags = command
|
|
62
|
+
.createHelp()
|
|
63
|
+
.visibleOptions(command)
|
|
64
|
+
.reduce((acc, { short, long }) => [...acc, short, long], [])
|
|
65
|
+
.filter(Boolean);
|
|
66
|
+
if (programArgs.template && programFlags.includes(programArgs.template)) {
|
|
67
|
+
console.error(`${programArgs.template} is not a valid template`);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
const hasDatabaseOptions = databaseOptions.some((opt) => programArgs[opt]);
|
|
71
|
+
if (programArgs.quickstart && hasDatabaseOptions) {
|
|
72
|
+
console.error(`The quickstart option is incompatible with the following options: ${databaseOptions.join(', ')}`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
if (hasDatabaseOptions) {
|
|
76
|
+
programArgs.quickstart = false; // Will disable the quickstart question because != 'undefined'
|
|
77
|
+
}
|
|
78
|
+
if (programArgs.quickstart) {
|
|
79
|
+
return generateApp(projectName, programArgs);
|
|
80
|
+
}
|
|
81
|
+
const prompt = await (0, prompt_user_1.default)(projectName, programArgs, hasDatabaseOptions);
|
|
82
|
+
const directory = prompt.directory || projectName;
|
|
83
|
+
await (0, generate_new_1.checkInstallPath)((0, node_path_1.resolve)(directory));
|
|
84
|
+
const options = {
|
|
85
|
+
template: programArgs.template,
|
|
86
|
+
quickstart: prompt.quick || programArgs.quickstart,
|
|
87
|
+
};
|
|
88
|
+
const generateStrapiAppOptions = {
|
|
89
|
+
...programArgs,
|
|
90
|
+
...options,
|
|
91
|
+
};
|
|
92
|
+
return generateApp(directory, generateStrapiAppOptions);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=create-strapi-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-strapi-app.js","sourceRoot":"","sources":["../src/create-strapi-app.ts"],"names":[],"mappings":";;;;;AAAA,qCAAuC;AACvC,yCAAoC;AACpC,0DAAkC;AAClC,uDAAwE;AACxE,sEAA6C;AAG7C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAA,mBAAO,EAAC,SAAS,EAAE,iBAAiB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AAK,CACX,qEAAqE,eAAe,CAAC,IAAI,CACvF,IAAI,CACL,EAAE,CACJ,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,IAAI,kBAAkB,EAAE;QACtB,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC,8DAA8D;KAC/F;IAED,IAAI,WAAW,CAAC,UAAU,EAAE;QAC1B,OAAO,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;KAC9C;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAU,EAAC,WAAW,EAAE,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAC9E,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,WAAW,CAAC;IAClD,MAAM,IAAA,+BAAgB,EAAC,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,UAAU,EAAE,MAAM,CAAC,KAAK,IAAI,WAAW,CAAC,UAAU;KACnD,CAAC;IAEF,MAAM,wBAAwB,GAAG;QAC/B,GAAG,WAAW;QACd,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,WAAW,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Program {
|
|
2
|
+
noRun?: boolean;
|
|
3
|
+
useNpm?: boolean;
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
quickstart?: boolean;
|
|
6
|
+
dbclient?: string;
|
|
7
|
+
dbhost?: string;
|
|
8
|
+
dbport?: string;
|
|
9
|
+
dbname?: string;
|
|
10
|
+
dbusername?: string;
|
|
11
|
+
dbpassword?: string;
|
|
12
|
+
dbssl?: string;
|
|
13
|
+
dbfile?: string;
|
|
14
|
+
dbforce?: boolean;
|
|
15
|
+
template?: string;
|
|
16
|
+
typescript?: boolean;
|
|
17
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
7
|
+
async function promptUser(projectName, program, hasDatabaseOptions) {
|
|
8
|
+
return inquirer_1.default.prompt([
|
|
9
|
+
{
|
|
10
|
+
type: 'input',
|
|
11
|
+
default: 'my-strapi-project',
|
|
12
|
+
name: 'directory',
|
|
13
|
+
message: 'What would you like to name your project?',
|
|
14
|
+
when: !projectName,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'list',
|
|
18
|
+
name: 'quick',
|
|
19
|
+
message: 'Choose your installation type',
|
|
20
|
+
when: !program.quickstart && !hasDatabaseOptions,
|
|
21
|
+
choices: [
|
|
22
|
+
{
|
|
23
|
+
name: 'Quickstart (recommended)',
|
|
24
|
+
value: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Custom (manual settings)',
|
|
28
|
+
value: false,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
exports.default = promptUser;
|
|
35
|
+
//# sourceMappingURL=prompt-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-user.js","sourceRoot":"","sources":["../../src/utils/prompt-user.ts"],"names":[],"mappings":";;;;;AAAA,wDAAgC;AAQjB,KAAK,UAAU,UAAU,CACtC,WAAmB,EACnB,OAAgB,EAChB,kBAA2B;IAE3B,OAAO,kBAAQ,CAAC,MAAM,CAAU;QAC9B;YACE,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,mBAAmB;YAC5B,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,2CAA2C;YACpD,IAAI,EAAE,CAAC,WAAW;SACnB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,+BAA+B;YACxC,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,kBAAkB;YAChD,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,0BAA0B;oBAChC,KAAK,EAAE,IAAI;iBACZ;gBACD;oBACE,IAAI,EAAE,0BAA0B;oBAChC,KAAK,EAAE,KAAK;iBACb;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC;AA9BD,6BA8BC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-strapi-app",
|
|
3
|
-
"version": "4.10.0
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Generate a new Strapi application.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@strapi/generate-new": "4.10.0
|
|
6
|
+
"@strapi/generate-new": "4.10.0",
|
|
7
7
|
"commander": "8.3.0",
|
|
8
8
|
"inquirer": "8.2.5"
|
|
9
9
|
},
|
|
@@ -35,16 +35,26 @@
|
|
|
35
35
|
"url": "https://strapi.io"
|
|
36
36
|
}
|
|
37
37
|
],
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
38
|
+
"bin": "./bin/index.js",
|
|
39
|
+
"files": [
|
|
40
|
+
"./dist",
|
|
41
|
+
"./bin"
|
|
42
|
+
],
|
|
42
43
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
+
"build": "run -T tsc",
|
|
45
|
+
"build:ts": "run -T tsc",
|
|
46
|
+
"watch": "run -T tsc -w --preserveWatchOutput",
|
|
47
|
+
"clean": "run -T rimraf ./dist",
|
|
48
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
49
|
+
"lint": "run -T eslint ."
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"eslint-config-custom": "4.10.0",
|
|
53
|
+
"tsconfig": "4.10.0"
|
|
44
54
|
},
|
|
45
55
|
"engines": {
|
|
46
56
|
"node": ">=14.19.1 <=18.x.x",
|
|
47
57
|
"npm": ">=6.0.0"
|
|
48
58
|
},
|
|
49
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9b5519778faaedfb837879f9c6f7e28fdfd6750d"
|
|
50
60
|
}
|
package/create-strapi-app.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { resolve } = require('path');
|
|
4
|
-
const commander = require('commander');
|
|
5
|
-
const { checkInstallPath, generateNewApp } = require('@strapi/generate-new');
|
|
6
|
-
const promptUser = require('./utils/prompt-user');
|
|
7
|
-
// eslint-disable-next-line import/extensions
|
|
8
|
-
const packageJson = require('./package.json');
|
|
9
|
-
|
|
10
|
-
const program = new commander.Command();
|
|
11
|
-
|
|
12
|
-
const databaseOptions = [
|
|
13
|
-
'dbclient',
|
|
14
|
-
'dbhost',
|
|
15
|
-
'dbport',
|
|
16
|
-
'dbname',
|
|
17
|
-
'dbusername',
|
|
18
|
-
'dbpassword',
|
|
19
|
-
'dbssl',
|
|
20
|
-
'dbfile',
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
program
|
|
24
|
-
.command(packageJson.name)
|
|
25
|
-
.version(packageJson.version)
|
|
26
|
-
.arguments('[directory]')
|
|
27
|
-
.option('--no-run', 'Do not start the application after it is created')
|
|
28
|
-
.option('--use-npm', 'Force usage of npm instead of yarn to create the project')
|
|
29
|
-
.option('--debug', 'Display database connection error')
|
|
30
|
-
.option('--quickstart', 'Quickstart app creation')
|
|
31
|
-
.option('--dbclient <dbclient>', 'Database client')
|
|
32
|
-
.option('--dbhost <dbhost>', 'Database host')
|
|
33
|
-
.option('--dbport <dbport>', 'Database port')
|
|
34
|
-
.option('--dbname <dbname>', 'Database name')
|
|
35
|
-
.option('--dbusername <dbusername>', 'Database username')
|
|
36
|
-
.option('--dbpassword <dbpassword>', 'Database password')
|
|
37
|
-
.option('--dbssl <dbssl>', 'Database SSL')
|
|
38
|
-
.option('--dbfile <dbfile>', 'Database file path for sqlite')
|
|
39
|
-
.option('--dbforce', 'Overwrite database content if any')
|
|
40
|
-
.option('--template <templateurl>', 'Specify a Strapi template')
|
|
41
|
-
.option('--ts, --typescript', 'Use TypeScript to generate the project')
|
|
42
|
-
.description('create a new application')
|
|
43
|
-
.action((directory, options) => {
|
|
44
|
-
initProject(directory, program, options);
|
|
45
|
-
})
|
|
46
|
-
.parse(process.argv);
|
|
47
|
-
|
|
48
|
-
function generateApp(projectName, options) {
|
|
49
|
-
if (!projectName) {
|
|
50
|
-
console.error('Please specify the <directory> of your project when using --quickstart');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return generateNewApp(projectName, options).then(() => {
|
|
55
|
-
if (process.platform === 'win32') {
|
|
56
|
-
process.exit(0);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function initProject(projectName, program, inputOptions) {
|
|
62
|
-
if (projectName) {
|
|
63
|
-
await checkInstallPath(resolve(projectName));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const programFlags = program.options
|
|
67
|
-
.reduce((acc, { short, long }) => [...acc, short, long], [])
|
|
68
|
-
.filter(Boolean);
|
|
69
|
-
if (inputOptions.template && programFlags.includes(inputOptions.template)) {
|
|
70
|
-
console.error(`${inputOptions.template} is not a valid template`);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const hasDatabaseOptions = databaseOptions.some((opt) => inputOptions[opt]);
|
|
75
|
-
|
|
76
|
-
if (inputOptions.quickstart && hasDatabaseOptions) {
|
|
77
|
-
console.error(
|
|
78
|
-
`The quickstart option is incompatible with the following options: ${databaseOptions.join(
|
|
79
|
-
', '
|
|
80
|
-
)}`
|
|
81
|
-
);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (hasDatabaseOptions) {
|
|
86
|
-
inputOptions.quickstart = false; // Will disable the quickstart question because != 'undefined'
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (inputOptions.quickstart) {
|
|
90
|
-
return generateApp(projectName, inputOptions);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const prompt = await promptUser(projectName, inputOptions, hasDatabaseOptions);
|
|
94
|
-
const directory = prompt.directory || projectName;
|
|
95
|
-
await checkInstallPath(resolve(directory));
|
|
96
|
-
|
|
97
|
-
const options = {
|
|
98
|
-
template: inputOptions.template,
|
|
99
|
-
quickstart: prompt.quick || inputOptions.quickstart,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const generateStrapiAppOptions = {
|
|
103
|
-
...inputOptions,
|
|
104
|
-
...options,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
return generateApp(directory, generateStrapiAppOptions);
|
|
108
|
-
}
|
package/index.js
DELETED
package/utils/prompt-user.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const inquirer = require('inquirer');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {string|null} projectName - The name/path of project
|
|
7
|
-
* @param {string|null} template - The Github repo of the template
|
|
8
|
-
* @returns Object containting prompt answers
|
|
9
|
-
*/
|
|
10
|
-
module.exports = async function promptUser(projectName, program, hasDatabaseOptions) {
|
|
11
|
-
const questions = await getPromptQuestions(projectName, program, hasDatabaseOptions);
|
|
12
|
-
return inquirer.prompt(questions);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {string|null} projectName - The name of the project
|
|
17
|
-
* @param {string|null} template - The template the project should use
|
|
18
|
-
* @returns Array of prompt question objects
|
|
19
|
-
*/
|
|
20
|
-
async function getPromptQuestions(projectName, program, hasDatabaseOptions) {
|
|
21
|
-
return [
|
|
22
|
-
{
|
|
23
|
-
type: 'input',
|
|
24
|
-
default: 'my-strapi-project',
|
|
25
|
-
name: 'directory',
|
|
26
|
-
message: 'What would you like to name your project?',
|
|
27
|
-
when: !projectName,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'list',
|
|
31
|
-
name: 'quick',
|
|
32
|
-
message: 'Choose your installation type',
|
|
33
|
-
when: !program.quickstart && !hasDatabaseOptions,
|
|
34
|
-
choices: [
|
|
35
|
-
{
|
|
36
|
-
name: 'Quickstart (recommended)',
|
|
37
|
-
value: true,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'Custom (manual settings)',
|
|
41
|
-
value: false,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
}
|