create-gasket-app 7.0.0-next.25 → 7.0.0-next.26
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/lib/commands/create.js
CHANGED
|
@@ -103,6 +103,7 @@ const createCommand = {
|
|
|
103
103
|
* @returns {Promise<void>} void
|
|
104
104
|
*/
|
|
105
105
|
createCommand.action = async function run(appname, options, command) {
|
|
106
|
+
process.env.GASKET_ENV = 'create';
|
|
106
107
|
const context = makeCreateContext([appname], options);
|
|
107
108
|
const { rawPresets, localPresets } = context;
|
|
108
109
|
|
package/lib/index.d.ts
CHANGED
|
@@ -198,8 +198,8 @@ export interface CreateContext {
|
|
|
198
198
|
/** Should a git repo be initialized and first commit */
|
|
199
199
|
gitInit: boolean;
|
|
200
200
|
|
|
201
|
-
/**
|
|
202
|
-
|
|
201
|
+
/** Names of the plugins that add unit and integration tests */
|
|
202
|
+
testPlugins: Array<string>;
|
|
203
203
|
|
|
204
204
|
/** Which package manager to use (Default: 'npm') */
|
|
205
205
|
packageManager: string;
|
|
@@ -61,42 +61,54 @@ async function choosePackageManager(context, prompt) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Choose your unit test suite
|
|
64
|
+
* Choose your unit test suite and integration test suite
|
|
65
65
|
*
|
|
66
66
|
* @param {CreateContext} context - Create context
|
|
67
67
|
* @param {function} prompt - function to prompt user
|
|
68
68
|
* @returns {Promise} promise
|
|
69
69
|
*/
|
|
70
|
-
async function
|
|
71
|
-
const knownTestPlugins = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
async function chooseTestPlugins(context, prompt) {
|
|
71
|
+
const knownTestPlugins = {
|
|
72
|
+
unit: { mocha: '@gasket/plugin-mocha', jest: '@gasket/plugin-jest' },
|
|
73
|
+
integration: { cypress: '@gasket/plugin-cypress' }
|
|
74
|
+
};
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const testTypes = ['unit', 'integration'];
|
|
77
|
+
const testPlugins = [];
|
|
78
|
+
|
|
79
|
+
if (!('testPlugins' in context)) {
|
|
80
|
+
for (const type of testTypes) {
|
|
81
|
+
if (type + 'TestSuite' in context) {
|
|
82
|
+
const testSuite = knownTestPlugins[type][context[type + 'TestSuite']];
|
|
83
|
+
if (testSuite) testPlugins.push(testSuite);
|
|
84
|
+
} else {
|
|
85
|
+
const plugin = await promptForTestPlugin(
|
|
86
|
+
prompt,
|
|
87
|
+
`Choose your ${type} test suite`,
|
|
88
|
+
Object.entries(knownTestPlugins[type]).map(([name, value]) => ({ name, value }))
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (plugin) testPlugins.push(plugin);
|
|
92
|
+
}
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
if (
|
|
81
|
-
({
|
|
82
|
-
{
|
|
83
|
-
name: 'testPlugin',
|
|
84
|
-
message: 'Choose your unit test suite',
|
|
85
|
-
type: 'list',
|
|
86
|
-
choices: [
|
|
87
|
-
{ name: 'none (not recommended)', value: 'none' },
|
|
88
|
-
{ name: 'mocha + nyc + sinon + chai', value: '@gasket/plugin-mocha' },
|
|
89
|
-
{ name: 'jest', value: '@gasket/plugin-jest' },
|
|
90
|
-
{ name: 'cypress', value: '@gasket/plugin-cypress' }
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
]));
|
|
95
|
+
if (testPlugins.length > 0) {
|
|
96
|
+
Object.assign(context, { testPlugins });
|
|
94
97
|
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
async function promptForTestPlugin(prompt, message, choices) {
|
|
102
|
+
const { testPlugin } = await prompt([
|
|
103
|
+
{
|
|
104
|
+
name: 'testPlugin',
|
|
105
|
+
message,
|
|
106
|
+
type: 'list',
|
|
107
|
+
choices: [{ name: 'none', value: 'none' }, ...choices]
|
|
98
108
|
}
|
|
99
|
-
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
return testPlugin !== 'none' ? testPlugin : null;
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
/**
|
|
@@ -126,7 +138,7 @@ async function allowExtantOverwriting(context, prompt) {
|
|
|
126
138
|
export const questions = [
|
|
127
139
|
chooseAppDescription,
|
|
128
140
|
choosePackageManager,
|
|
129
|
-
|
|
141
|
+
chooseTestPlugins,
|
|
130
142
|
allowExtantOverwriting
|
|
131
143
|
];
|
|
132
144
|
|
|
@@ -83,7 +83,7 @@ function flatten(acc, values) {
|
|
|
83
83
|
*
|
|
84
84
|
* @property {String} appDescription - Description of app
|
|
85
85
|
* @property {Boolean} gitInit - Should a git repo be initialized and first commit
|
|
86
|
-
* @property {String}
|
|
86
|
+
* @property {String} testPlugins - Array of testing plugins
|
|
87
87
|
* @property {String} packageManager - Which package manager to use (Default: 'npm')
|
|
88
88
|
* @property {String} installCmd - Derived install command (Default: 'npm install')
|
|
89
89
|
* @property {String} localCmd - Derived local run command (Default: 'npx gasket local')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-gasket-app",
|
|
3
|
-
"version": "7.0.0-next.
|
|
3
|
+
"version": "7.0.0-next.26",
|
|
4
4
|
"description": "starter pack for creating a gasket app",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/create-gasket-app",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@gasket/core": "^7.0.0-next.
|
|
37
|
-
"@gasket/plugin-git": "^7.0.0-next.
|
|
38
|
-
"@gasket/plugin-logger": "^7.0.0-next.
|
|
39
|
-
"@gasket/utils": "^7.0.0-next.
|
|
36
|
+
"@gasket/core": "^7.0.0-next.26",
|
|
37
|
+
"@gasket/plugin-git": "^7.0.0-next.26",
|
|
38
|
+
"@gasket/plugin-logger": "^7.0.0-next.26",
|
|
39
|
+
"@gasket/utils": "^7.0.0-next.26",
|
|
40
40
|
"commander": "^12.0.0",
|
|
41
41
|
"deepmerge": "^4.3.1",
|
|
42
42
|
"glob": "^8.1.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"jest": {
|
|
80
80
|
"transform": {}
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "b885d3f60fc68f944186105b1c4adb6440817581"
|
|
83
83
|
}
|