create-gasket-app 7.0.4 → 7.0.9
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 +2 -7
- package/lib/index.d.ts +209 -17
- package/lib/index.js +3 -0
- package/lib/internal.d.ts +133 -0
- package/lib/scaffold/action-wrapper.js +2 -10
- package/lib/scaffold/actions/create-hooks.js +3 -7
- package/lib/scaffold/actions/generate-files.js +5 -20
- package/lib/scaffold/actions/global-prompts.js +10 -19
- package/lib/scaffold/actions/install-modules.js +1 -3
- package/lib/scaffold/actions/link-modules.js +1 -4
- package/lib/scaffold/actions/load-preset.js +3 -3
- package/lib/scaffold/actions/mkdir.js +3 -6
- package/lib/scaffold/actions/post-create-hooks.js +2 -5
- package/lib/scaffold/actions/preset-config-hooks.js +1 -2
- package/lib/scaffold/actions/preset-prompt-hooks.js +1 -2
- package/lib/scaffold/actions/print-report.js +3 -12
- package/lib/scaffold/actions/prompt-hooks.js +3 -12
- package/lib/scaffold/actions/setup-pkg.js +3 -5
- package/lib/scaffold/actions/write-gasket-config.js +7 -16
- package/lib/scaffold/actions/write-pkg.js +1 -3
- package/lib/scaffold/config-builder.js +31 -35
- package/lib/scaffold/create-context.js +5 -66
- package/lib/scaffold/dump-error-context.js +1 -4
- package/lib/scaffold/files.js +8 -5
- package/lib/scaffold/utils.js +1 -9
- package/lib/utils/create-option.js +1 -2
- package/lib/utils/process-args.js +5 -7
- package/lib/utils/process-command.js +2 -4
- package/lib/utils/process-options.js +6 -8
- package/package.json +17 -13
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* isValidArg - Validates the argument configuration
|
|
3
|
-
* @
|
|
4
|
-
* @returns {boolean} True if valid, false otherwise
|
|
3
|
+
* @type {import('../internal').isValidArg}
|
|
5
4
|
*/
|
|
6
5
|
function isValidArg(arg) {
|
|
7
6
|
const keys = Object.keys(arg);
|
|
8
7
|
if (arg.required && arg.default) return false;
|
|
9
|
-
return keys.length &&
|
|
10
|
-
keys.length <= 4 &&
|
|
11
|
-
arg.name && arg.description;
|
|
8
|
+
return !!keys.length &&
|
|
9
|
+
!!(keys.length <= 4) &&
|
|
10
|
+
!!arg.name && !!arg.description;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* processArgs - Process the arguments configuration
|
|
16
|
-
* @
|
|
17
|
-
* @returns {ProccesedCLICommandArg[]} Array of argument definitions
|
|
15
|
+
* @type {import('../internal').processArgs}
|
|
18
16
|
*/
|
|
19
17
|
export function processArgs(args) {
|
|
20
18
|
if (!Array.isArray(args) || !args.every(isValidArg)) throw new Error('Invalid argument(s) configuration');
|
|
@@ -6,8 +6,7 @@ const program = new Command();
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* isValidCommand - Validates the command configuration
|
|
9
|
-
* @
|
|
10
|
-
* @returns {boolean} True if valid, false otherwise
|
|
9
|
+
* @type {import('../internal').isValidCommand}
|
|
11
10
|
*/
|
|
12
11
|
function isValidCommand(command) {
|
|
13
12
|
const keys = Object.keys(command);
|
|
@@ -22,8 +21,7 @@ function isValidCommand(command) {
|
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* processCommand - Process the command configuration
|
|
25
|
-
* @
|
|
26
|
-
* @returns {ProccesedCLICommand} The command instance
|
|
24
|
+
* @type {import('../internal').processCommand}
|
|
27
25
|
*/
|
|
28
26
|
export function processCommand(command) {
|
|
29
27
|
if (!isValidCommand(command)) throw new Error('Invalid command configuration');
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* isValidOption - Validate the option
|
|
3
|
-
* @
|
|
4
|
-
* @returns {boolean} True if valid, false otherwise
|
|
3
|
+
* @type {import('../internal').isValidOption}
|
|
5
4
|
*/
|
|
6
5
|
function isValidOption(option) {
|
|
7
6
|
const keys = Object.keys(option);
|
|
8
|
-
return keys.length &&
|
|
9
|
-
keys.length <= 5 &&
|
|
10
|
-
option.name &&
|
|
11
|
-
option.description;
|
|
7
|
+
return !!keys.length &&
|
|
8
|
+
!!(keys.length <= 5) &&
|
|
9
|
+
!!option.name &&
|
|
10
|
+
!!option.description;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* processOptions - Process the options configuration
|
|
16
|
-
* @
|
|
17
|
-
* @returns {ProccesedCLICommandOption[]} Processed option definitions
|
|
15
|
+
* @type {import('../internal').processOptions}
|
|
18
16
|
*/
|
|
19
17
|
export function processOptions(options) {
|
|
20
18
|
if (!Array.isArray(options) || !options.every(isValidOption)) throw new Error('Invalid option(s) configuration');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-gasket-app",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.9",
|
|
4
4
|
"description": "starter pack for creating a gasket app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"test": "cross-env NODE_OPTIONS='--unhandled-rejections=strict --experimental-vm-modules' jest",
|
|
18
18
|
"test:watch": "npm run test -- --watch",
|
|
19
19
|
"test:coverage": "jest --coverage",
|
|
20
|
-
"
|
|
20
|
+
"typecheck": "tsc",
|
|
21
|
+
"typecheck:watch": "tsc --watch",
|
|
22
|
+
"posttest": "npm run lint && npm run typecheck"
|
|
21
23
|
},
|
|
22
24
|
"repository": {
|
|
23
25
|
"type": "git",
|
|
@@ -33,14 +35,14 @@
|
|
|
33
35
|
},
|
|
34
36
|
"homepage": "https://github.com/godaddy/gasket/tree/main/packages/create-gasket-app",
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@gasket/core": "^7.0.
|
|
37
|
-
"@gasket/plugin-command": "^7.0.
|
|
38
|
-
"@gasket/plugin-docs": "^7.0.
|
|
39
|
-
"@gasket/plugin-docusaurus": "^7.0.
|
|
40
|
-
"@gasket/plugin-git": "^7.0.
|
|
41
|
-
"@gasket/plugin-logger": "^7.0.
|
|
42
|
-
"@gasket/plugin-metadata": "^7.0.
|
|
43
|
-
"@gasket/utils": "^7.0.
|
|
38
|
+
"@gasket/core": "^7.0.9",
|
|
39
|
+
"@gasket/plugin-command": "^7.0.9",
|
|
40
|
+
"@gasket/plugin-docs": "^7.0.9",
|
|
41
|
+
"@gasket/plugin-docusaurus": "^7.0.9",
|
|
42
|
+
"@gasket/plugin-git": "^7.0.9",
|
|
43
|
+
"@gasket/plugin-logger": "^7.0.9",
|
|
44
|
+
"@gasket/plugin-metadata": "^7.0.9",
|
|
45
|
+
"@gasket/utils": "^7.0.9",
|
|
44
46
|
"commander": "^12.0.0",
|
|
45
47
|
"deepmerge": "^4.3.1",
|
|
46
48
|
"glob": "^8.1.0",
|
|
@@ -69,10 +71,12 @@
|
|
|
69
71
|
"eslintConfig": {
|
|
70
72
|
"extends": [
|
|
71
73
|
"godaddy",
|
|
72
|
-
"plugin:jest/recommended"
|
|
74
|
+
"plugin:jest/recommended",
|
|
75
|
+
"plugin:jsdoc/recommended-typescript-flavor"
|
|
73
76
|
],
|
|
74
77
|
"plugins": [
|
|
75
|
-
"unicorn"
|
|
78
|
+
"unicorn",
|
|
79
|
+
"jsdoc"
|
|
76
80
|
],
|
|
77
81
|
"rules": {
|
|
78
82
|
"unicorn/filename-case": "error"
|
|
@@ -84,5 +88,5 @@
|
|
|
84
88
|
"jest": {
|
|
85
89
|
"transform": {}
|
|
86
90
|
},
|
|
87
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "ff3acd042a9a22cd43ac29c6b064bd2f49304b9e"
|
|
88
92
|
}
|