@webiny/cli 0.0.0-unstable.eb196ccd2f β†’ 0.0.0-unstable.f6dc066313

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.
Files changed (49) hide show
  1. package/README.md +10 -6
  2. package/bin.js +9 -97
  3. package/files/references.json +1 -1
  4. package/index.js +2 -4
  5. package/package.json +16 -56
  6. package/commands/about/getDatabaseSetup.js +0 -45
  7. package/commands/about/getNpmVersion.js +0 -5
  8. package/commands/about/getNpxVersion.js +0 -5
  9. package/commands/about/getPulumiVersions.js +0 -43
  10. package/commands/about/getYarnVersion.js +0 -5
  11. package/commands/about/index.js +0 -97
  12. package/commands/index.js +0 -21
  13. package/commands/run/index.js +0 -38
  14. package/commands/telemetry/index.js +0 -31
  15. package/commands/upgrade/index.js +0 -108
  16. package/commands/wcp/hooks.js +0 -133
  17. package/commands/wcp/index.js +0 -8
  18. package/commands/wcp/login.js +0 -228
  19. package/commands/wcp/logout.js +0 -28
  20. package/commands/wcp/project.js +0 -203
  21. package/commands/wcp/utils/getProjectEnvironment.js +0 -120
  22. package/commands/wcp/utils/getUser.js +0 -100
  23. package/commands/wcp/utils/getWcpOrgProjectId.js +0 -9
  24. package/commands/wcp/utils/getWcpPat.js +0 -5
  25. package/commands/wcp/utils/getWcpProjectId.js +0 -3
  26. package/commands/wcp/utils/index.js +0 -19
  27. package/commands/wcp/utils/setProjectId.js +0 -44
  28. package/commands/wcp/utils/setWcpPat.js +0 -5
  29. package/commands/wcp/utils/updateUserLastActiveOn.js +0 -28
  30. package/commands/wcp/whoami.js +0 -43
  31. package/context.js +0 -137
  32. package/files/README.md +0 -1
  33. package/index.d.ts +0 -5
  34. package/regions.d.ts +0 -6
  35. package/regions.js +0 -30
  36. package/types.d.ts +0 -234
  37. package/utils/PluginsContainer.js +0 -49
  38. package/utils/createProjectApplicationWorkspace.js +0 -16
  39. package/utils/getProject.js +0 -48
  40. package/utils/getProjectApplication.js +0 -83
  41. package/utils/importModule.js +0 -43
  42. package/utils/index.d.ts +0 -28
  43. package/utils/index.js +0 -28
  44. package/utils/loadEnvVariables.js +0 -63
  45. package/utils/localStorage.js +0 -44
  46. package/utils/log.js +0 -67
  47. package/utils/sendEvent.js +0 -11
  48. package/utils/sleep.js +0 -3
  49. package/utils/sleepSync.js +0 -8
package/README.md CHANGED
@@ -1,7 +1,11 @@
1
- # webiny-cli
2
- [![](https://img.shields.io/npm/dw/webiny-cli.svg)](https://www.npmjs.com/package/webiny-cli)
3
- [![](https://img.shields.io/npm/v/webiny-cli.svg)](https://www.npmjs.com/package/webiny-cli)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
1
+ # @webiny/cli
6
2
 
7
- A pluggable tool to run commands within a Webiny project.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
6
+
7
+ πŸ“˜ **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
8
+
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
package/bin.js CHANGED
@@ -1,103 +1,15 @@
1
1
  #!/usr/bin/env node
2
+ import "tsx/esm";
2
3
 
3
- // Suppress punycode warnings. This is a known issue which we can't fix.
4
- require("./utils/suppressPunycodeWarnings");
4
+ // Suppress punycode warnings. This is a known issue we can't fix.
5
+ import "./utils/suppressPunycodeWarnings.js";
5
6
 
6
- // Ensure system requirements are met.
7
- require("@webiny/system-requirements").ensureSystemRequirements();
8
-
9
- // Detect different Webiny package versions.
10
- require("./utils/ensureSameWebinyPackageVersions").ensureSameWebinyPackageVersions();
11
-
12
- const yargs = require("yargs");
13
-
14
- // Disable help processing until after plugins are imported.
15
- yargs.help(false);
16
-
17
- // Loads environment variables from multiple sources.
18
- require("./utils/loadEnvVariables");
19
-
20
- const { blue, red, bold, bgYellow } = require("chalk");
21
- const context = require("./context");
22
- const { createCommands } = require("./commands");
23
-
24
- yargs
25
- .usage("Usage: $0 <command> [options]")
26
- .demandCommand(1)
27
- .recommendCommands()
28
- .scriptName("webiny")
29
- .epilogue(
30
- `To find more information, docs and tutorials, see ${blue("https://www.webiny.com/docs")}.`
31
- )
32
- .epilogue(`Want to contribute? ${blue("https://github.com/webiny/webiny-js")}.`)
33
- .fail(function (msg, error, yargs) {
34
- if (msg) {
35
- if (msg.includes("Not enough non-option arguments")) {
36
- console.log();
37
- context.error(red("Command was not invoked as expected!"));
38
- context.info(
39
- `Some non-optional arguments are missing. See the usage examples printed below.`
40
- );
41
- console.log();
42
- yargs.showHelp();
43
- return;
44
- }
7
+ import { Cli } from "@webiny/cli-core";
8
+ import { ensureSystemRequirements } from "@webiny/system-requirements";
45
9
 
46
- if (msg.includes("Missing required argument")) {
47
- const args = msg
48
- .split(":")[1]
49
- .split(",")
50
- .map(v => v.trim());
51
-
52
- console.log();
53
- context.error(red("Command was not invoked as expected!"));
54
- context.info(
55
- `Missing required argument(s): ${args
56
- .map(arg => red(arg))
57
- .join(", ")}. See the usage examples printed below.`
58
- );
59
- console.log();
60
- yargs.showHelp();
61
- return;
62
- }
63
- console.log();
64
- context.error(red("Command execution was aborted!"));
65
- context.error(msg);
66
- console.log();
67
-
68
- process.exit(1);
69
- }
70
-
71
- console.log();
72
- // Unfortunately, yargs doesn't provide passed args here, so we had to do it via process.argv.
73
- const debugEnabled = process.argv.includes("--debug");
74
- if (debugEnabled) {
75
- context.debug(error);
76
- } else {
77
- context.error(error.message);
78
- }
79
-
80
- const gracefulError = error.cause?.gracefulError;
81
- if (gracefulError instanceof Error) {
82
- console.log();
83
- console.log(bgYellow(bold("πŸ’‘ How can I resolve this?")));
84
- console.log(gracefulError.message);
85
- }
86
-
87
- const plugins = context.plugins.byType("cli-command-error");
88
- for (let i = 0; i < plugins.length; i++) {
89
- const plugin = plugins[i];
90
- plugin.handle({
91
- error,
92
- context
93
- });
94
- }
10
+ // Ensure system requirements are met.
11
+ ensureSystemRequirements();
95
12
 
96
- process.exit(1);
97
- });
13
+ const cli = await Cli.init();
98
14
 
99
- (async () => {
100
- await createCommands(yargs, context);
101
- // Enable help and run the CLI.
102
- yargs.help().argv;
103
- })();
15
+ await cli.run();