@webiny/cli 5.36.1 → 5.37.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.
@@ -0,0 +1,10 @@
1
+ const execa = require("execa");
2
+
3
+ module.exports.getNpxVersion = async () => {
4
+ try {
5
+ const { stdout } = await execa("npx", ["--version"]);
6
+ return stdout;
7
+ } catch (err) {
8
+ return "";
9
+ }
10
+ };
@@ -0,0 +1,41 @@
1
+ const execa = require("execa");
2
+
3
+ module.exports.getPulumiVersions = async () => {
4
+ let pulumi, pulumiAws;
5
+
6
+ try {
7
+ {
8
+ const { stdout } = await execa("yarn", [
9
+ "info",
10
+ "@pulumi/pulumi",
11
+ "-A",
12
+ "--name-only",
13
+ "--json"
14
+ ]);
15
+
16
+ const match = stdout.match(/npm:(.*?)"/);
17
+ if (match) {
18
+ pulumi = match[1];
19
+ }
20
+ }
21
+
22
+ {
23
+ const { stdout } = await execa("yarn", [
24
+ "info",
25
+ "@pulumi/aws",
26
+ "-A",
27
+ "--name-only",
28
+ "--json"
29
+ ]);
30
+
31
+ const match = stdout.match(/npm:(.*?)"/);
32
+ if (match) {
33
+ pulumiAws = match[1];
34
+ }
35
+ }
36
+ } catch (err) {
37
+ return "";
38
+ }
39
+
40
+ return [pulumi, pulumiAws];
41
+ };
@@ -0,0 +1,10 @@
1
+ const execa = require("execa");
2
+
3
+ module.exports.getYarnVersion = async () => {
4
+ try {
5
+ const { stdout } = await execa("yarn", ["--version"]);
6
+ return stdout;
7
+ } catch (err) {
8
+ return "";
9
+ }
10
+ };
@@ -0,0 +1,93 @@
1
+ const NO_VALUE = "-";
2
+
3
+ const getData = async context => {
4
+ const { getUser } = require("../wcp/utils");
5
+ const { getNpxVersion } = require("./getNpxVersion");
6
+ const { getPulumiVersions } = require("./getPulumiVersions");
7
+ const { getYarnVersion } = require("./getYarnVersion");
8
+
9
+ const [pulumiVersion, pulumiAwsVersion] = await getPulumiVersions();
10
+
11
+ return [
12
+ {
13
+ sectionName: "Webiny Project",
14
+ data: {
15
+ Name: context.project.name,
16
+ Version: context.version,
17
+ Template: context.project.config.template || NO_VALUE,
18
+ "Debug Enabled": process.env.DEBUG === "true" ? "Yes" : "No",
19
+ "Feature Flags": process.env.WEBINY_FEATURE_FLAGS || "N/A"
20
+ }
21
+ },
22
+ {
23
+ sectionName: "Webiny Control Panel (WCP)",
24
+ data: {
25
+ "Project ID": context.project.config.id || process.env.WCP_PROJECT_ID,
26
+ User: await getUser()
27
+ .catch(() => "N/A")
28
+ .then(res => res.email),
29
+ Authentication: process.env.WEBINY_PROJECT_ENVIRONMENT_API_KEY
30
+ ? "Project Environment API Key"
31
+ : "Personal Access Token"
32
+ }
33
+ },
34
+ {
35
+ sectionName: "Pulumi",
36
+ data: {
37
+ "@pulumi/pulumi": pulumiVersion,
38
+ "@pulumi/aws": pulumiAwsVersion,
39
+ "Used AWS Region": process.env.AWS_REGION,
40
+ "Secrets Provider": process.env.PULUMI_SECRETS_PROVIDER,
41
+ "Using Password": process.env.PULUMI_CONFIG_PASSPHRASE ? "Yes" : "No"
42
+ }
43
+ },
44
+ {
45
+ sectionName: "Host",
46
+ data: {
47
+ OS: `${process.platform} (${process.arch})`,
48
+ "Node.js": process.version,
49
+ NPX: await getNpxVersion(),
50
+ Yarn: await getYarnVersion()
51
+ }
52
+ }
53
+ ];
54
+ };
55
+
56
+ module.exports = {
57
+ type: "cli-command",
58
+ name: "cli-command-about",
59
+ create({ yargs, context }) {
60
+ yargs.command(
61
+ "about",
62
+ `Prints out information helpful for debugging purposes.`,
63
+ yargs => {
64
+ yargs.option("json", {
65
+ describe: "Emit output as JSON.",
66
+ type: "boolean",
67
+ default: false
68
+ });
69
+ },
70
+ async yargs => {
71
+ const data = await getData(context);
72
+
73
+ if (yargs.json) {
74
+ console.log(JSON.stringify(data, null, 2));
75
+ return;
76
+ }
77
+
78
+ data.forEach(({ sectionName, data }, index) => {
79
+ if (index > 0) {
80
+ console.log();
81
+ }
82
+
83
+ const { bold } = require("chalk");
84
+ console.log(bold(sectionName));
85
+
86
+ Object.keys(data).forEach(key => {
87
+ console.log(key.padEnd(30), data[key] || NO_VALUE);
88
+ });
89
+ });
90
+ }
91
+ );
92
+ }
93
+ };
package/commands/index.js CHANGED
@@ -1,9 +1,10 @@
1
+ const about = require("./about");
1
2
  const run = require("./run");
2
3
  const telemetry = require("./telemetry");
3
4
  const upgrade = require("./upgrade");
4
5
 
5
6
  module.exports.createCommands = async (yargs, context) => {
6
- context.plugins.register(run, telemetry, upgrade);
7
+ context.plugins.register(about, run, telemetry, upgrade);
7
8
 
8
9
  try {
9
10
  const wcp = require("./wcp");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/cli",
3
- "version": "5.36.1",
3
+ "version": "5.37.0-beta.0",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "webiny": "./bin.js"
@@ -13,8 +13,8 @@
13
13
  "author": "Pavel Denisjuk <pavel@webiny.com>",
14
14
  "description": "A tool to bootstrap a Webiny project.",
15
15
  "dependencies": {
16
- "@webiny/telemetry": "5.36.1",
17
- "@webiny/wcp": "5.36.1",
16
+ "@webiny/telemetry": "5.37.0-beta.0",
17
+ "@webiny/wcp": "5.37.0-beta.0",
18
18
  "boolean": "3.2.0",
19
19
  "camelcase": "5.3.1",
20
20
  "chalk": "4.1.2",
@@ -64,5 +64,5 @@
64
64
  ]
65
65
  }
66
66
  },
67
- "gitHead": "09c2454cad3aeba99988bd7bee678c6de4325caf"
67
+ "gitHead": "7bb6232942f0414e22a4549113dd112bb92e52c5"
68
68
  }