create-gasket-app 7.0.0-next.23 → 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
|
@@ -9,17 +9,18 @@ export interface Dependencies {
|
|
|
9
9
|
|
|
10
10
|
export interface PackageJson extends Dependencies {
|
|
11
11
|
name: string;
|
|
12
|
-
version
|
|
12
|
+
version?: string;
|
|
13
13
|
description?: string;
|
|
14
14
|
license?: string;
|
|
15
15
|
repository?:
|
|
16
16
|
| string
|
|
17
17
|
| {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
type: 'git';
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
21
21
|
scripts?: Record<string, string>;
|
|
22
22
|
optionalDependencies?: Record<string, string>;
|
|
23
|
+
homepage?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export interface ModuleInfo {
|
|
@@ -30,11 +31,9 @@ export interface ModuleInfo {
|
|
|
30
31
|
version?: string;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
export interface PresetInfo extends ModuleInfo {
|
|
34
|
-
}
|
|
34
|
+
export interface PresetInfo extends ModuleInfo {}
|
|
35
35
|
|
|
36
|
-
export interface PluginInfo extends ModuleInfo {
|
|
37
|
-
}
|
|
36
|
+
export interface PluginInfo extends ModuleInfo {}
|
|
38
37
|
|
|
39
38
|
export interface ConfigBuilder<Config> {
|
|
40
39
|
/**
|
|
@@ -132,16 +131,16 @@ export interface ConfigBuilder<Config> {
|
|
|
132
131
|
|
|
133
132
|
export interface PackageJsonBuilder extends ConfigBuilder<PackageJson> {
|
|
134
133
|
/**
|
|
135
|
-
* Checks if a
|
|
136
|
-
* @param key -
|
|
137
|
-
* @param value -
|
|
138
|
-
* @returns True if the
|
|
134
|
+
* Checks if a property exists on the package.json fields.
|
|
135
|
+
* @param key - Field to search
|
|
136
|
+
* @param value - Value to search for
|
|
137
|
+
* @returns True if the property exists and matches the value
|
|
139
138
|
*/
|
|
140
|
-
has(key: keyof
|
|
139
|
+
has(key: keyof PackageJson, value: string): boolean;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
export interface Files {
|
|
144
|
-
add(...args: string[]): void
|
|
143
|
+
add(...args: string[]): void;
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
export interface CreateContext {
|
|
@@ -199,8 +198,8 @@ export interface CreateContext {
|
|
|
199
198
|
/** Should a git repo be initialized and first commit */
|
|
200
199
|
gitInit: boolean;
|
|
201
200
|
|
|
202
|
-
/**
|
|
203
|
-
|
|
201
|
+
/** Names of the plugins that add unit and integration tests */
|
|
202
|
+
testPlugins: Array<string>;
|
|
204
203
|
|
|
205
204
|
/** Which package manager to use (Default: 'npm') */
|
|
206
205
|
packageManager: string;
|
|
@@ -246,7 +245,10 @@ declare module '@gasket/core' {
|
|
|
246
245
|
prompt(
|
|
247
246
|
context: CreateContext,
|
|
248
247
|
utils: {
|
|
249
|
-
prompt: (
|
|
248
|
+
prompt: (
|
|
249
|
+
prompts: Array<Record<string, any>>
|
|
250
|
+
) => Promise<Record<string, any>>;
|
|
251
|
+
addPlugins: (plugins: Array<string>) => Promise<void>;
|
|
250
252
|
}
|
|
251
253
|
): MaybeAsync<CreateContext>;
|
|
252
254
|
|
|
@@ -255,7 +257,8 @@ declare module '@gasket/core' {
|
|
|
255
257
|
postCreate(
|
|
256
258
|
context: CreateContext,
|
|
257
259
|
utils: {
|
|
258
|
-
runScript: (script: string) => Promise<void
|
|
259
|
-
}
|
|
260
|
+
runScript: (script: string) => Promise<void>;
|
|
261
|
+
}
|
|
262
|
+
): MaybeAsync<void>;
|
|
260
263
|
}
|
|
261
264
|
}
|
|
@@ -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,8 +1,9 @@
|
|
|
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
|
-
"main": "lib",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
6
7
|
"bin": {
|
|
7
8
|
"create-gasket-app": "./lib/index.js"
|
|
8
9
|
},
|
|
@@ -32,10 +33,10 @@
|
|
|
32
33
|
},
|
|
33
34
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/create-gasket-app",
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@gasket/core": "^7.0.0-next.
|
|
36
|
-
"@gasket/plugin-git": "^7.0.0-next.
|
|
37
|
-
"@gasket/plugin-logger": "^7.0.0-next.
|
|
38
|
-
"@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",
|
|
39
40
|
"commander": "^12.0.0",
|
|
40
41
|
"deepmerge": "^4.3.1",
|
|
41
42
|
"glob": "^8.1.0",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"diagnostics": "^2.0.2",
|
|
55
56
|
"dotenv": "^16.4.5",
|
|
56
57
|
"eslint": "^8.56.0",
|
|
57
|
-
"eslint-config-godaddy": "^7.0
|
|
58
|
+
"eslint-config-godaddy": "^7.1.0",
|
|
58
59
|
"eslint-plugin-jest": "^27.6.3",
|
|
59
60
|
"eslint-plugin-json": "^3.1.0",
|
|
60
61
|
"eslint-plugin-unicorn": "^44.0.0",
|
|
@@ -78,5 +79,5 @@
|
|
|
78
79
|
"jest": {
|
|
79
80
|
"transform": {}
|
|
80
81
|
},
|
|
81
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "b885d3f60fc68f944186105b1c4adb6440817581"
|
|
82
83
|
}
|