@webiny/cli 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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/README.md +1 -1
- package/bin.js +94 -27
- package/commands/about/getDatabaseSetup.js +45 -0
- package/commands/about/getNpmVersion.js +5 -0
- package/commands/about/getNpxVersion.js +5 -0
- package/commands/about/getPulumiVersions.js +43 -0
- package/commands/about/getYarnVersion.js +5 -0
- package/commands/about/index.js +97 -0
- package/commands/index.js +9 -1
- package/commands/run/index.js +12 -4
- package/commands/telemetry/index.js +9 -9
- package/commands/upgrade/index.js +6 -5
- package/commands/wcp/hooks.js +133 -0
- package/commands/wcp/index.js +8 -0
- package/commands/wcp/login.js +228 -0
- package/commands/wcp/logout.js +28 -0
- package/commands/wcp/project.js +203 -0
- package/commands/wcp/utils/getProjectEnvironment.js +120 -0
- package/commands/wcp/utils/getUser.js +100 -0
- package/commands/wcp/utils/getWcpOrgProjectId.js +9 -0
- package/commands/wcp/utils/getWcpPat.js +5 -0
- package/commands/wcp/utils/getWcpProjectId.js +3 -0
- package/commands/wcp/utils/index.js +19 -0
- package/commands/wcp/utils/setProjectId.js +44 -0
- package/commands/wcp/utils/setWcpPat.js +5 -0
- package/commands/wcp/utils/updateUserLastActiveOn.js +28 -0
- package/commands/wcp/whoami.js +43 -0
- package/context.js +3 -3
- package/files/README.md +1 -0
- package/files/duplicates.json +1 -0
- package/files/references.json +1 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/package.json +22 -15
- package/regions.d.ts +6 -0
- package/regions.js +30 -0
- package/types.d.ts +120 -35
- package/utils/createProjectApplicationWorkspace.js +16 -0
- package/utils/ensureSameWebinyPackageVersions.js +99 -0
- package/utils/getProjectApplication.js +27 -7
- package/utils/index.d.ts +28 -0
- package/utils/index.js +13 -2
- package/utils/loadEnvVariables.js +63 -0
- package/utils/log.js +15 -17
- package/utils/sendEvent.js +2 -6
- package/utils/sleep.js +3 -0
- package/utils/sleepSync.js +8 -0
- package/utils/suppressPunycodeWarnings.js +7 -0
- package/CHANGELOG.md +0 -2896
- package/cli.js +0 -107
package/cli.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const yargs = require("yargs");
|
|
4
|
-
const { log, getProject } = require("./utils");
|
|
5
|
-
const { boolean } = require("boolean");
|
|
6
|
-
|
|
7
|
-
// Disable help processing until after plugins are imported.
|
|
8
|
-
yargs.help(false);
|
|
9
|
-
|
|
10
|
-
// Immediately load .env.{PASSED_ENVIRONMENT} and .env files.
|
|
11
|
-
// This way we ensure all of the environment variables are not loaded too late.
|
|
12
|
-
const project = getProject();
|
|
13
|
-
let paths = [path.join(project.root, ".env")];
|
|
14
|
-
|
|
15
|
-
if (yargs.argv.env) {
|
|
16
|
-
paths.push(path.join(project.root, `.env.${yargs.argv.env}`));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
for (let i = 0; i < paths.length; i++) {
|
|
20
|
-
const path = paths[i];
|
|
21
|
-
const { error } = require("dotenv").config({ path });
|
|
22
|
-
if (boolean(yargs.argv.debug)) {
|
|
23
|
-
if (error) {
|
|
24
|
-
log.debug(`No environment file found on ${log.debug.hl(path)}.`);
|
|
25
|
-
} else {
|
|
26
|
-
log.success(`Successfully loaded environment variables from ${log.success.hl(path)}.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const { blue, red } = require("chalk");
|
|
32
|
-
const context = require("./context");
|
|
33
|
-
const { createCommands } = require("./commands");
|
|
34
|
-
|
|
35
|
-
yargs
|
|
36
|
-
.usage("Usage: $0 <command> [options]")
|
|
37
|
-
.demandCommand(1)
|
|
38
|
-
.recommendCommands()
|
|
39
|
-
.scriptName("webiny")
|
|
40
|
-
.epilogue(
|
|
41
|
-
`To find more information, docs and tutorials, see ${blue("https://docs.webiny.com")}.`
|
|
42
|
-
)
|
|
43
|
-
.epilogue(`Want to contribute? ${blue("https://github.com/webiny/webiny-js")}.`)
|
|
44
|
-
.fail(function (msg, error, yargs) {
|
|
45
|
-
if (msg) {
|
|
46
|
-
if (msg.includes("Not enough non-option arguments")) {
|
|
47
|
-
console.log();
|
|
48
|
-
context.error(red("Command was not invoked as expected!"));
|
|
49
|
-
context.info(
|
|
50
|
-
`Some non-optional arguments are missing. See the usage examples printed below.`
|
|
51
|
-
);
|
|
52
|
-
console.log();
|
|
53
|
-
yargs.showHelp();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (msg.includes("Missing required argument")) {
|
|
58
|
-
const args = msg
|
|
59
|
-
.split(":")[1]
|
|
60
|
-
.split(",")
|
|
61
|
-
.map(v => v.trim());
|
|
62
|
-
|
|
63
|
-
console.log();
|
|
64
|
-
context.error(red("Command was not invoked as expected!"));
|
|
65
|
-
context.info(
|
|
66
|
-
`Missing required argument(s): ${args
|
|
67
|
-
.map(arg => red(arg))
|
|
68
|
-
.join(", ")}. See the usage examples printed below.`
|
|
69
|
-
);
|
|
70
|
-
console.log();
|
|
71
|
-
yargs.showHelp();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
console.log();
|
|
75
|
-
context.error(red("Command execution was aborted!"));
|
|
76
|
-
context.error(msg);
|
|
77
|
-
console.log();
|
|
78
|
-
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (error) {
|
|
83
|
-
context.error(error.message);
|
|
84
|
-
// Unfortunately, yargs doesn't provide passed args here, so we had to do it via process.argv.
|
|
85
|
-
if (process.argv.includes("--debug")) {
|
|
86
|
-
context.debug(error);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log();
|
|
90
|
-
const plugins = context.plugins.byType("cli-command-error");
|
|
91
|
-
for (let i = 0; i < plugins.length; i++) {
|
|
92
|
-
const plugin = plugins[i];
|
|
93
|
-
plugin.handle({
|
|
94
|
-
error,
|
|
95
|
-
context
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
process.exit(1);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
(async () => {
|
|
104
|
-
await createCommands(yargs, context);
|
|
105
|
-
// Enable help and run the CLI.
|
|
106
|
-
yargs.help().argv;
|
|
107
|
-
})();
|