@webiny/cli 5.41.4-beta.6 → 5.42.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/bin.js +91 -29
- package/commands/about/getNpmVersion.js +2 -7
- package/commands/about/getNpxVersion.js +2 -7
- package/commands/about/getYarnVersion.js +2 -7
- package/files/README.md +1 -0
- package/files/duplicates.json +1 -0
- package/files/references.json +1 -0
- package/package.json +10 -9
- package/types.d.ts +24 -3
- package/utils/suppressPunycodeWarnings.js +7 -0
- package/cli.js +0 -93
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.42.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"webiny": "./bin.js"
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
"author": "Pavel Denisjuk <pavel@webiny.com>",
|
|
14
14
|
"description": "A tool to bootstrap a Webiny project.",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@webiny/
|
|
17
|
-
"@webiny/
|
|
16
|
+
"@webiny/system-requirements": "5.42.0-beta.0",
|
|
17
|
+
"@webiny/telemetry": "5.42.0-beta.0",
|
|
18
|
+
"@webiny/wcp": "5.42.0-beta.0",
|
|
18
19
|
"boolean": "3.2.0",
|
|
19
|
-
"camelcase": "
|
|
20
|
+
"camelcase": "6.3.0",
|
|
20
21
|
"chalk": "4.1.2",
|
|
21
22
|
"dotenv": "8.6.0",
|
|
22
23
|
"execa": "5.1.1",
|
|
@@ -27,13 +28,13 @@
|
|
|
27
28
|
"inquirer": "8.2.6",
|
|
28
29
|
"is-ci": "3.0.1",
|
|
29
30
|
"ncp": "2.0.0",
|
|
30
|
-
"open": "8.4.
|
|
31
|
-
"pirates": "4.0.
|
|
32
|
-
"semver": "7.
|
|
31
|
+
"open": "8.4.2",
|
|
32
|
+
"pirates": "4.0.6",
|
|
33
|
+
"semver": "7.6.3",
|
|
33
34
|
"ts-morph": "11.0.3",
|
|
34
35
|
"typescript": "4.9.5",
|
|
35
36
|
"uniqid": "5.4.0",
|
|
36
|
-
"yargs": "17.
|
|
37
|
+
"yargs": "17.7.2"
|
|
37
38
|
},
|
|
38
39
|
"license": "MIT",
|
|
39
40
|
"publishConfig": {
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
]
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ebf90f62ed3f28114ffdb012b7e5f80988af53d3"
|
|
69
70
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rename file to types.ts when switching the package to Typescript.
|
|
3
3
|
*/
|
|
4
|
+
export type GenericRecord<K extends PropertyKey = PropertyKey, V = any> = Record<K, V>;
|
|
4
5
|
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
export type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;
|
|
6
|
+
export type NonEmptyArray<T> = [T, ...T[]];
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* A simplified plugins container interface, used specifically within the Webiny CLI.
|
|
@@ -171,3 +170,25 @@ export interface CliContext {
|
|
|
171
170
|
get: (key: string) => any;
|
|
172
171
|
};
|
|
173
172
|
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Arguments for CliPlugin.create
|
|
176
|
+
*
|
|
177
|
+
* @category Cli
|
|
178
|
+
*/
|
|
179
|
+
export interface CliCommandPluginArgs {
|
|
180
|
+
yargs: any;
|
|
181
|
+
context: CliContext;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A plugin defining cli-command type.
|
|
186
|
+
*
|
|
187
|
+
* @category Plugin
|
|
188
|
+
* @category Cli
|
|
189
|
+
*/
|
|
190
|
+
export interface CliCommandPlugin extends Plugin {
|
|
191
|
+
type: "cli-command";
|
|
192
|
+
name: string;
|
|
193
|
+
create: (args: CliCommandPluginArgs) => void;
|
|
194
|
+
}
|
package/cli.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const yargs = require("yargs");
|
|
3
|
-
|
|
4
|
-
// Disable help processing until after plugins are imported.
|
|
5
|
-
yargs.help(false);
|
|
6
|
-
|
|
7
|
-
// Loads environment variables from multiple sources.
|
|
8
|
-
require("./utils/loadEnvVariables");
|
|
9
|
-
|
|
10
|
-
const { blue, red, bold, bgYellow } = require("chalk");
|
|
11
|
-
const context = require("./context");
|
|
12
|
-
const { createCommands } = require("./commands");
|
|
13
|
-
|
|
14
|
-
yargs
|
|
15
|
-
.usage("Usage: $0 <command> [options]")
|
|
16
|
-
.demandCommand(1)
|
|
17
|
-
.recommendCommands()
|
|
18
|
-
.scriptName("webiny")
|
|
19
|
-
.epilogue(
|
|
20
|
-
`To find more information, docs and tutorials, see ${blue("https://www.webiny.com/docs")}.`
|
|
21
|
-
)
|
|
22
|
-
.epilogue(`Want to contribute? ${blue("https://github.com/webiny/webiny-js")}.`)
|
|
23
|
-
.fail(function (msg, error, yargs) {
|
|
24
|
-
if (msg) {
|
|
25
|
-
if (msg.includes("Not enough non-option arguments")) {
|
|
26
|
-
console.log();
|
|
27
|
-
context.error(red("Command was not invoked as expected!"));
|
|
28
|
-
context.info(
|
|
29
|
-
`Some non-optional arguments are missing. See the usage examples printed below.`
|
|
30
|
-
);
|
|
31
|
-
console.log();
|
|
32
|
-
yargs.showHelp();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (msg.includes("Missing required argument")) {
|
|
37
|
-
const args = msg
|
|
38
|
-
.split(":")[1]
|
|
39
|
-
.split(",")
|
|
40
|
-
.map(v => v.trim());
|
|
41
|
-
|
|
42
|
-
console.log();
|
|
43
|
-
context.error(red("Command was not invoked as expected!"));
|
|
44
|
-
context.info(
|
|
45
|
-
`Missing required argument(s): ${args
|
|
46
|
-
.map(arg => red(arg))
|
|
47
|
-
.join(", ")}. See the usage examples printed below.`
|
|
48
|
-
);
|
|
49
|
-
console.log();
|
|
50
|
-
yargs.showHelp();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
console.log();
|
|
54
|
-
context.error(red("Command execution was aborted!"));
|
|
55
|
-
context.error(msg);
|
|
56
|
-
console.log();
|
|
57
|
-
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.log();
|
|
62
|
-
// Unfortunately, yargs doesn't provide passed args here, so we had to do it via process.argv.
|
|
63
|
-
const debugEnabled = process.argv.includes("--debug");
|
|
64
|
-
if (debugEnabled) {
|
|
65
|
-
context.debug(error);
|
|
66
|
-
} else {
|
|
67
|
-
context.error(error.message);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const gracefulError = error.cause?.gracefulError;
|
|
71
|
-
if (gracefulError instanceof Error) {
|
|
72
|
-
console.log();
|
|
73
|
-
console.log(bgYellow(bold("💡 How can I resolve this?")));
|
|
74
|
-
console.log(gracefulError.message);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const plugins = context.plugins.byType("cli-command-error");
|
|
78
|
-
for (let i = 0; i < plugins.length; i++) {
|
|
79
|
-
const plugin = plugins[i];
|
|
80
|
-
plugin.handle({
|
|
81
|
-
error,
|
|
82
|
-
context
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
process.exit(1);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
(async () => {
|
|
90
|
-
await createCommands(yargs, context);
|
|
91
|
-
// Enable help and run the CLI.
|
|
92
|
-
yargs.help().argv;
|
|
93
|
-
})();
|