@backstage/cli 0.32.2-next.0 → 0.33.0-next.2

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 (40) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/bin/backstage-cli-alpha +0 -0
  3. package/dist/index.cjs.js +14 -29
  4. package/dist/lib/removed.cjs.js +1 -1
  5. package/dist/lib/run.cjs.js +7 -7
  6. package/dist/modules/build/index.cjs.js +124 -52
  7. package/dist/modules/config/commands/docs.cjs.js +18 -1
  8. package/dist/modules/config/index.cjs.js +97 -30
  9. package/dist/modules/create-github-app/index.cjs.js +21 -9
  10. package/dist/modules/info/index.cjs.js +23 -5
  11. package/dist/modules/lint/index.cjs.js +68 -29
  12. package/dist/modules/maintenance/index.cjs.js +80 -18
  13. package/dist/modules/migrate/index.cjs.js +96 -30
  14. package/dist/modules/new/index.cjs.js +57 -28
  15. package/dist/modules/test/index.cjs.js +46 -20
  16. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  17. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  18. package/dist/packages/cli/package.json.cjs.js +1 -1
  19. package/dist/packages/core-components/package.json.cjs.js +1 -1
  20. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  21. package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +26 -0
  22. package/dist/packages/opaque-internal/src/OpaqueType.cjs.js +105 -0
  23. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  24. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  25. package/dist/wiring/CliInitializer.cjs.js +124 -0
  26. package/dist/wiring/CommandGraph.cjs.js +71 -0
  27. package/dist/wiring/CommandRegistry.cjs.js +14 -0
  28. package/dist/wiring/factory.cjs.js +15 -0
  29. package/dist/wiring/types.cjs.js +11 -0
  30. package/package.json +8 -9
  31. package/templates/backend-plugin/package.json.hbs +2 -1
  32. package/templates/backend-plugin-module/package.json.hbs +2 -1
  33. package/templates/frontend-plugin/package.json.hbs +2 -1
  34. package/templates/plugin-common-library/package.json.hbs +2 -1
  35. package/templates/plugin-node-library/package.json.hbs +2 -1
  36. package/templates/plugin-web-library/package.json.hbs +2 -1
  37. package/templates/scaffolder-backend-module/package.json.hbs +2 -1
  38. package/templates/scaffolder-backend-module/src/actions/example.ts +6 -12
  39. package/dist/commands/index.cjs.js +0 -52
  40. package/dist/modules/info/commands/info.cjs.js +0 -55
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ class OpaqueType {
4
+ /**
5
+ * Creates a new opaque type.
6
+ *
7
+ * @param options.type The type identifier of the opaque type
8
+ * @param options.versions The available versions of the opaque type
9
+ * @returns A new opaque type helper
10
+ */
11
+ static create(options) {
12
+ return new OpaqueType(options.type, new Set(options.versions));
13
+ }
14
+ #type;
15
+ #versions;
16
+ constructor(type, versions) {
17
+ this.#type = type;
18
+ this.#versions = versions;
19
+ }
20
+ /**
21
+ * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`
22
+ *
23
+ * @remarks
24
+ *
25
+ * This property is only useful for type checking, its runtime value is `undefined`.
26
+ */
27
+ TPublic = void 0;
28
+ /**
29
+ * The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`
30
+ *
31
+ * @remarks
32
+ *
33
+ * This property is only useful for type checking, its runtime value is `undefined`.
34
+ */
35
+ TInternal = void 0;
36
+ /**
37
+ * @param value Input value expected to be an instance of this opaque type
38
+ * @returns True if the value matches this opaque type
39
+ */
40
+ isType = (value) => {
41
+ return this.#isThisInternalType(value);
42
+ };
43
+ /**
44
+ * @param value Input value expected to be an instance of this opaque type
45
+ * @throws If the value is not an instance of this opaque type or is of an unsupported version
46
+ * @returns The internal version of the opaque type
47
+ */
48
+ toInternal = (value) => {
49
+ if (!this.#isThisInternalType(value)) {
50
+ throw new TypeError(
51
+ `Invalid opaque type, expected '${this.#type}', but got '${this.#stringifyUnknown(value)}'`
52
+ );
53
+ }
54
+ if (!this.#versions.has(value.version)) {
55
+ const versions = Array.from(this.#versions).map(this.#stringifyVersion);
56
+ if (versions.length > 1) {
57
+ versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;
58
+ }
59
+ const expected = versions.length > 2 ? versions.join(", ") : versions.join(" ");
60
+ throw new TypeError(
61
+ `Invalid opaque type instance, got version ${this.#stringifyVersion(
62
+ value.version
63
+ )}, expected ${expected}`
64
+ );
65
+ }
66
+ return value;
67
+ };
68
+ /**
69
+ * Creates an instance of the opaque type, returning the public type.
70
+ *
71
+ * @param version The version of the instance to create
72
+ * @param value The remaining public and internal properties of the instance
73
+ * @returns An instance of the opaque type
74
+ */
75
+ createInstance(version, props) {
76
+ return Object.assign(props, {
77
+ $$type: this.#type,
78
+ ...version && { version }
79
+ });
80
+ }
81
+ #isThisInternalType(value) {
82
+ if (value === null || typeof value !== "object") {
83
+ return false;
84
+ }
85
+ return value.$$type === this.#type;
86
+ }
87
+ #stringifyUnknown(value) {
88
+ if (typeof value !== "object") {
89
+ return `<${typeof value}>`;
90
+ }
91
+ if (value === null) {
92
+ return "<null>";
93
+ }
94
+ if ("$$type" in value) {
95
+ return String(value.$$type);
96
+ }
97
+ return String(value);
98
+ }
99
+ #stringifyVersion = (version) => {
100
+ return version ? `'${version}'` : "undefined";
101
+ };
102
+ }
103
+
104
+ exports.OpaqueType = OpaqueType;
105
+ //# sourceMappingURL=OpaqueType.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.8.3-next.1";
3
+ var version = "0.9.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.2.3-next.1";
3
+ var version = "0.3.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ var CommandGraph = require('./CommandGraph.cjs.js');
4
+ var types$1 = require('./types.cjs.js');
5
+ var CommandRegistry = require('./CommandRegistry.cjs.js');
6
+ var commander = require('commander');
7
+ var version = require('../lib/version.cjs.js');
8
+ var chalk = require('chalk');
9
+ var errors$1 = require('../lib/errors.cjs.js');
10
+ var errors = require('@backstage/errors');
11
+ var types = require('util/types');
12
+
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
+
15
+ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
16
+
17
+ class CliInitializer {
18
+ graph = new CommandGraph.CommandGraph();
19
+ commandRegistry = new CommandRegistry.CommandRegistry(this.graph);
20
+ #uninitiazedFeatures = [];
21
+ add(feature) {
22
+ if (types.isPromise(feature)) {
23
+ this.#uninitiazedFeatures.push(
24
+ feature.then((f) => unwrapFeature(f.default))
25
+ );
26
+ } else {
27
+ this.#uninitiazedFeatures.push(Promise.resolve(feature));
28
+ }
29
+ }
30
+ async #register(feature) {
31
+ if (types$1.OpaqueCliPlugin.isType(feature)) {
32
+ const internal = types$1.OpaqueCliPlugin.toInternal(feature);
33
+ await internal.init(this.commandRegistry);
34
+ } else {
35
+ throw new Error(`Unsupported feature type: ${feature.$$type}`);
36
+ }
37
+ }
38
+ async #doInit() {
39
+ const features = await Promise.all(this.#uninitiazedFeatures);
40
+ for (const feature of features) {
41
+ await this.#register(feature);
42
+ }
43
+ }
44
+ /**
45
+ * Actually parse argv and pass it to the command.
46
+ */
47
+ async run() {
48
+ await this.#doInit();
49
+ const programName = "backstage-cli";
50
+ const program = new commander.Command();
51
+ program.name(programName).version(version.version).allowUnknownOption(true).allowExcessArguments(true);
52
+ const queue = this.graph.atDepth(0).map((node) => ({
53
+ node,
54
+ argParser: program
55
+ }));
56
+ while (queue.length) {
57
+ const { node, argParser } = queue.shift();
58
+ if (node.$$type === "@tree/root") {
59
+ const treeParser = argParser.command(`${node.name} [command]`).description(node.name);
60
+ queue.push(
61
+ ...node.children.map((child) => ({
62
+ node: child,
63
+ argParser: treeParser
64
+ }))
65
+ );
66
+ } else {
67
+ argParser.command(node.name, { hidden: !!node.command.deprecated }).description(node.command.description).helpOption(false).allowUnknownOption(true).allowExcessArguments(true).action(async () => {
68
+ try {
69
+ const args = program.parseOptions(process.argv);
70
+ const nonProcessArgs = args.operands.slice(2);
71
+ const positionalArgs = [];
72
+ let index = 0;
73
+ for (let argIndex = 0; argIndex < nonProcessArgs.length; argIndex++) {
74
+ if (argIndex === index && node.command.path[argIndex] === nonProcessArgs[argIndex]) {
75
+ index += 1;
76
+ continue;
77
+ }
78
+ positionalArgs.push(nonProcessArgs[argIndex]);
79
+ }
80
+ await node.command.execute({
81
+ args: [...positionalArgs, ...args.unknown],
82
+ info: {
83
+ usage: [programName, ...node.command.path].join(" "),
84
+ description: node.command.description
85
+ }
86
+ });
87
+ process.exit(0);
88
+ } catch (error) {
89
+ errors.assertError(error);
90
+ errors$1.exitWithError(error);
91
+ }
92
+ });
93
+ }
94
+ }
95
+ program.on("command:*", () => {
96
+ console.log();
97
+ console.log(chalk__default.default.red(`Invalid command: ${program.args.join(" ")}`));
98
+ console.log();
99
+ program.outputHelp();
100
+ process.exit(1);
101
+ });
102
+ process.on("unhandledRejection", (rejection) => {
103
+ if (rejection instanceof Error) {
104
+ errors$1.exitWithError(rejection);
105
+ } else {
106
+ errors$1.exitWithError(new Error(`Unknown rejection: '${rejection}'`));
107
+ }
108
+ });
109
+ program.parse(process.argv);
110
+ }
111
+ }
112
+ function unwrapFeature(feature) {
113
+ if ("$$type" in feature) {
114
+ return feature;
115
+ }
116
+ if ("default" in feature) {
117
+ return feature.default;
118
+ }
119
+ return feature;
120
+ }
121
+
122
+ exports.CliInitializer = CliInitializer;
123
+ exports.unwrapFeature = unwrapFeature;
124
+ //# sourceMappingURL=CliInitializer.cjs.js.map
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ class CommandGraph {
4
+ graph = [];
5
+ /**
6
+ * Adds a command to the graph. The graph is sparse, so we use the path to determine the nodes
7
+ * to traverse. Only leaf nodes should have a command/action.
8
+ */
9
+ add(command) {
10
+ const path = command.path;
11
+ let current = this.graph;
12
+ for (let i = 0; i < path.length - 1; i++) {
13
+ const name = path[i];
14
+ let next = current.find((n) => n.name === name);
15
+ if (!next) {
16
+ next = { $$type: "@tree/root", name, children: [] };
17
+ current.push(next);
18
+ } else if (next.$$type === "@tree/leaf") {
19
+ throw new Error(
20
+ `Command already exists at path: "${path.slice(0, i).join(" ")}"`
21
+ );
22
+ }
23
+ current = next.children;
24
+ }
25
+ const last = current.find((n) => n.name === path[path.length - 1]);
26
+ if (last && last.$$type === "@tree/leaf") {
27
+ throw new Error(
28
+ `Command already exists at path: "${path.slice(0, -1).join(" ")}"`
29
+ );
30
+ } else {
31
+ current.push({
32
+ $$type: "@tree/leaf",
33
+ name: path[path.length - 1],
34
+ command
35
+ });
36
+ }
37
+ }
38
+ /**
39
+ * Given a path, try to find a command that matches it.
40
+ */
41
+ find(path) {
42
+ let current = this.graph;
43
+ for (let i = 0; i < path.length - 1; i++) {
44
+ const name = path[i];
45
+ const next = current.find((n) => n.name === name);
46
+ if (!next) {
47
+ return void 0;
48
+ } else if (next.$$type === "@tree/leaf") {
49
+ return void 0;
50
+ }
51
+ current = next.children;
52
+ }
53
+ const last = current.find((n) => n.name === path[path.length - 1]);
54
+ if (!last || last.$$type === "@tree/root") {
55
+ return void 0;
56
+ }
57
+ return last?.command;
58
+ }
59
+ atDepth(depth) {
60
+ let current = this.graph;
61
+ for (let i = 0; i < depth; i++) {
62
+ current = current.flatMap(
63
+ (n) => n.$$type === "@tree/root" ? n.children : []
64
+ );
65
+ }
66
+ return current;
67
+ }
68
+ }
69
+
70
+ exports.CommandGraph = CommandGraph;
71
+ //# sourceMappingURL=CommandGraph.cjs.js.map
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ class CommandRegistry {
4
+ graph;
5
+ constructor(graph) {
6
+ this.graph = graph;
7
+ }
8
+ addCommand(command) {
9
+ this.graph.add(command);
10
+ }
11
+ }
12
+
13
+ exports.CommandRegistry = CommandRegistry;
14
+ //# sourceMappingURL=CommandRegistry.cjs.js.map
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var describeParentCallSite = require('../packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js');
4
+ var types = require('./types.cjs.js');
5
+
6
+ function createCliPlugin(options) {
7
+ return types.OpaqueCliPlugin.createInstance("v1", {
8
+ pluginId: options.pluginId,
9
+ init: options.init,
10
+ description: `created at '${describeParentCallSite.describeParentCallSite()}'`
11
+ });
12
+ }
13
+
14
+ exports.createCliPlugin = createCliPlugin;
15
+ //# sourceMappingURL=factory.cjs.js.map
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var OpaqueType = require('../packages/opaque-internal/src/OpaqueType.cjs.js');
4
+
5
+ const OpaqueCliPlugin = OpaqueType.OpaqueType.create({
6
+ type: "@backstage/CliPlugin",
7
+ versions: ["v1"]
8
+ });
9
+
10
+ exports.OpaqueCliPlugin = OpaqueCliPlugin;
11
+ //# sourceMappingURL=types.cjs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli",
3
- "version": "0.32.2-next.0",
3
+ "version": "0.33.0-next.2",
4
4
  "description": "CLI for developing Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -20,8 +20,7 @@
20
20
  "license": "Apache-2.0",
21
21
  "main": "dist/index.cjs.js",
22
22
  "bin": {
23
- "backstage-cli": "bin/backstage-cli",
24
- "backstage-cli-alpha": "bin/backstage-cli-alpha"
23
+ "backstage-cli": "bin/backstage-cli"
25
24
  },
26
25
  "files": [
27
26
  "asset-types",
@@ -54,7 +53,7 @@
54
53
  "@backstage/config": "1.3.2",
55
54
  "@backstage/config-loader": "1.10.1",
56
55
  "@backstage/errors": "1.2.7",
57
- "@backstage/eslint-plugin": "0.1.10",
56
+ "@backstage/eslint-plugin": "0.1.11-next.0",
58
57
  "@backstage/integration": "1.17.0",
59
58
  "@backstage/release-manifests": "0.0.13",
60
59
  "@backstage/types": "1.2.1",
@@ -165,19 +164,19 @@
165
164
  },
166
165
  "devDependencies": {
167
166
  "@backstage/backend-plugin-api": "1.4.0-next.1",
168
- "@backstage/backend-test-utils": "1.6.0-next.1",
167
+ "@backstage/backend-test-utils": "1.6.0-next.2",
169
168
  "@backstage/catalog-client": "1.10.1-next.0",
170
169
  "@backstage/config": "1.3.2",
171
170
  "@backstage/core-app-api": "1.17.0",
172
- "@backstage/core-components": "0.17.2",
171
+ "@backstage/core-components": "0.17.3-next.0",
173
172
  "@backstage/core-plugin-api": "1.10.7",
174
- "@backstage/dev-utils": "1.1.11-next.1",
173
+ "@backstage/dev-utils": "1.1.11-next.2",
175
174
  "@backstage/errors": "1.2.7",
176
175
  "@backstage/plugin-auth-backend": "0.25.1-next.1",
177
176
  "@backstage/plugin-auth-backend-module-guest-provider": "0.2.9-next.1",
178
177
  "@backstage/plugin-catalog-node": "1.17.1-next.1",
179
- "@backstage/plugin-scaffolder-node": "0.8.3-next.1",
180
- "@backstage/plugin-scaffolder-node-test-utils": "0.2.3-next.1",
178
+ "@backstage/plugin-scaffolder-node": "0.9.0-next.2",
179
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.0-next.2",
181
180
  "@backstage/test-utils": "1.7.8",
182
181
  "@backstage/theme": "0.6.6",
183
182
  "@rspack/core": "^1.3.9",
@@ -8,7 +8,8 @@
8
8
  "types": "dist/index.d.ts"
9
9
  },
10
10
  "backstage": {
11
- "role": "backend-plugin"
11
+ "role": "backend-plugin",
12
+ "pluginId": "{{pluginId}}"
12
13
  },
13
14
  "scripts": {
14
15
  "start": "backstage-cli package start",
@@ -9,7 +9,8 @@
9
9
  "types": "dist/index.d.ts"
10
10
  },
11
11
  "backstage": {
12
- "role": "backend-plugin-module"
12
+ "role": "backend-plugin-module",
13
+ "pluginId": "{{pluginId}}"
13
14
  },
14
15
  "scripts": {
15
16
  "start": "backstage-cli package start",
@@ -8,7 +8,8 @@
8
8
  "types": "dist/index.d.ts"
9
9
  },
10
10
  "backstage": {
11
- "role": "frontend-plugin"
11
+ "role": "frontend-plugin",
12
+ "pluginId": "{{pluginId}}"
12
13
  },
13
14
  "sideEffects": false,
14
15
  "scripts": {
@@ -10,7 +10,8 @@
10
10
  "types": "dist/index.d.ts"
11
11
  },
12
12
  "backstage": {
13
- "role": "common-library"
13
+ "role": "common-library",
14
+ "pluginId": "{{pluginId}}"
14
15
  },
15
16
  "sideEffects": false,
16
17
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "types": "dist/index.d.ts"
10
10
  },
11
11
  "backstage": {
12
- "role": "node-library"
12
+ "role": "node-library",
13
+ "pluginId": "{{pluginId}}"
13
14
  },
14
15
  "scripts": {
15
16
  "build": "backstage-cli package build",
@@ -9,7 +9,8 @@
9
9
  "types": "dist/index.d.ts"
10
10
  },
11
11
  "backstage": {
12
- "role": "web-library"
12
+ "role": "web-library",
13
+ "pluginId": "{{pluginId}}"
13
14
  },
14
15
  "sideEffects": false,
15
16
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "types": "dist/index.d.ts"
10
10
  },
11
11
  "backstage": {
12
- "role": "backend-plugin-module"
12
+ "role": "backend-plugin-module",
13
+ "pluginId": "scaffolder"
13
14
  },
14
15
  "scripts": {
15
16
  "start": "backstage-cli package start",
@@ -12,22 +12,16 @@ import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
12
12
  export function createExampleAction() {
13
13
  // For more information on how to define custom actions, see
14
14
  // https://backstage.io/docs/features/software-templates/writing-custom-actions
15
- return createTemplateAction<{
16
- myParameter: string;
17
- }>({
15
+ return createTemplateAction({
18
16
  id: 'acme:example',
19
17
  description: 'Runs an example action',
20
18
  schema: {
21
19
  input: {
22
- type: 'object',
23
- required: ['myParameter'],
24
- properties: {
25
- myParameter: {
26
- title: 'An example parameter',
27
- description: "This is an example parameter, don't set it to foo",
28
- type: 'string',
29
- },
30
- },
20
+ myParameter: z =>
21
+ z.string({
22
+ description:
23
+ "This is an example parameter, don't set it to foo",
24
+ }),
31
25
  },
32
26
  },
33
27
  async handler(ctx) {
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('../modules/config/index.cjs.js');
4
- var index$2 = require('../modules/build/index.cjs.js');
5
- var index$3 = require('../modules/info/index.cjs.js');
6
- var index$1 = require('../modules/migrate/index.cjs.js');
7
- var index$6 = require('../modules/test/index.cjs.js');
8
- var index$7 = require('../modules/lint/index.cjs.js');
9
- var index$8 = require('../modules/maintenance/index.cjs.js');
10
- var removed = require('../lib/removed.cjs.js');
11
- var index$4 = require('../modules/new/index.cjs.js');
12
- var index$5 = require('../modules/create-github-app/index.cjs.js');
13
-
14
- function registerRepoCommand(program) {
15
- const command = program.command("repo [command]").description("Command that run across an entire Backstage project");
16
- index$2.registerRepoCommands(command);
17
- index$6.registerRepoCommands(command);
18
- index$7.registerRepoCommands(command);
19
- index$8.registerRepoCommands(command);
20
- }
21
- function registerScriptCommand(program) {
22
- const command = program.command("package [command]").description("Lifecycle scripts for individual packages");
23
- index$2.registerPackageCommands(command);
24
- index$6.registerPackageCommands(command);
25
- index$8.registerPackageCommands(command);
26
- index$7.registerPackageCommands(command);
27
- }
28
- function registerCommands(program) {
29
- index.registerCommands(program);
30
- registerRepoCommand(program);
31
- registerScriptCommand(program);
32
- index$1.registerCommands(program);
33
- index$2.registerCommands(program);
34
- index$3.registerCommands(program);
35
- index$4.registerCommands(program);
36
- index$5.registerCommands(program);
37
- program.command("plugin:diff").allowUnknownOption(true).action(removed.removed("use 'backstage-cli fix' instead"));
38
- program.command("test").allowUnknownOption(true).action(
39
- removed.removed(
40
- "use 'backstage-cli repo test' or 'backstage-cli package test' instead"
41
- )
42
- );
43
- program.command("clean").allowUnknownOption(true).action(removed.removed("use 'backstage-cli package clean' instead"));
44
- program.command("versions:check").allowUnknownOption(true).action(removed.removed("use 'yarn dedupe' or 'yarn-deduplicate' instead"));
45
- program.command("install").allowUnknownOption(true).action(removed.removed());
46
- program.command("onboard").allowUnknownOption(true).action(removed.removed());
47
- }
48
-
49
- exports.registerCommands = registerCommands;
50
- exports.registerRepoCommand = registerRepoCommand;
51
- exports.registerScriptCommand = registerScriptCommand;
52
- //# sourceMappingURL=index.cjs.js.map
@@ -1,55 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _package = require('../../../packages/cli/package.json.cjs.js');
6
- var os = require('os');
7
- var run = require('../../../lib/run.cjs.js');
8
- var paths = require('../../../lib/paths.cjs.js');
9
- var Lockfile = require('../../../lib/versioning/Lockfile.cjs.js');
10
- require('minimatch');
11
- require('@manypkg/get-packages');
12
- require('chalk');
13
- require('../../../lib/versioning/yarn.cjs.js');
14
- var fs = require('fs-extra');
15
-
16
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
17
-
18
- var os__default = /*#__PURE__*/_interopDefaultCompat(os);
19
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
20
-
21
- var info = async () => {
22
- await new Promise(async () => {
23
- const yarnVersion = await run.runPlain("yarn --version");
24
- const isLocal = fs__default.default.existsSync(paths.paths.resolveOwn("./src"));
25
- const backstageFile = paths.paths.resolveTargetRoot("backstage.json");
26
- let backstageVersion = "N/A";
27
- if (fs__default.default.existsSync(backstageFile)) {
28
- try {
29
- const backstageJson = await fs__default.default.readJSON(backstageFile);
30
- backstageVersion = backstageJson.version ?? "N/A";
31
- } catch (error) {
32
- console.warn('The "backstage.json" file is not in the expected format');
33
- console.log();
34
- }
35
- }
36
- console.log(`OS: ${os__default.default.type} ${os__default.default.release} - ${os__default.default.platform}/${os__default.default.arch}`);
37
- console.log(`node: ${process.version}`);
38
- console.log(`yarn: ${yarnVersion}`);
39
- console.log(`cli: ${_package.version} (${isLocal ? "local" : "installed"})`);
40
- console.log(`backstage: ${backstageVersion}`);
41
- console.log();
42
- console.log("Dependencies:");
43
- const lockfilePath = paths.paths.resolveTargetRoot("yarn.lock");
44
- const lockfile = await Lockfile.Lockfile.load(lockfilePath);
45
- const deps = [...lockfile.keys()].filter((n) => n.startsWith("@backstage/"));
46
- const maxLength = Math.max(...deps.map((d) => d.length));
47
- for (const dep of deps) {
48
- const versions = new Set(lockfile.get(dep).map((i) => i.version));
49
- console.log(` ${dep.padEnd(maxLength)} ${[...versions].join(", ")}`);
50
- }
51
- });
52
- };
53
-
54
- exports.default = info;
55
- //# sourceMappingURL=info.cjs.js.map