@backstage/cli 0.32.1 → 0.33.0-next.1

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 (61) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/bin/backstage-cli-alpha +0 -0
  3. package/config/jest.js +5 -4
  4. package/dist/index.cjs.js +14 -29
  5. package/dist/lib/removed.cjs.js +1 -1
  6. package/dist/lib/run.cjs.js +7 -7
  7. package/dist/modules/{start → build}/commands/package/start/startFrontend.cjs.js +6 -6
  8. package/dist/modules/build/index.cjs.js +125 -27
  9. package/dist/modules/build/lib/bundler/config.cjs.js +2 -39
  10. package/dist/modules/config/commands/docs.cjs.js +18 -1
  11. package/dist/modules/config/index.cjs.js +101 -30
  12. package/dist/modules/create-github-app/index.cjs.js +21 -9
  13. package/dist/modules/info/index.cjs.js +23 -5
  14. package/dist/modules/lint/commands/repo/lint.cjs.js +13 -1
  15. package/dist/modules/lint/index.cjs.js +68 -29
  16. package/dist/modules/maintenance/index.cjs.js +80 -18
  17. package/dist/modules/migrate/index.cjs.js +96 -30
  18. package/dist/modules/new/index.cjs.js +57 -28
  19. package/dist/modules/test/index.cjs.js +46 -20
  20. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  21. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  22. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  23. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  24. package/dist/packages/cli/package.json.cjs.js +1 -1
  25. package/dist/packages/core-components/package.json.cjs.js +1 -1
  26. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  27. package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +26 -0
  28. package/dist/packages/opaque-internal/src/OpaqueType.cjs.js +105 -0
  29. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  30. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  31. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  32. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  33. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  34. package/dist/wiring/CliInitializer.cjs.js +124 -0
  35. package/dist/wiring/CommandGraph.cjs.js +71 -0
  36. package/dist/wiring/CommandRegistry.cjs.js +14 -0
  37. package/dist/wiring/factory.cjs.js +15 -0
  38. package/dist/wiring/types.cjs.js +11 -0
  39. package/package.json +28 -29
  40. package/templates/backend-plugin/package.json.hbs +2 -1
  41. package/templates/backend-plugin-module/package.json.hbs +2 -1
  42. package/templates/frontend-plugin/package.json.hbs +2 -1
  43. package/templates/plugin-common-library/package.json.hbs +2 -1
  44. package/templates/plugin-node-library/package.json.hbs +2 -1
  45. package/templates/plugin-web-library/package.json.hbs +2 -1
  46. package/templates/scaffolder-backend-module/package.json.hbs +2 -1
  47. package/templates/scaffolder-backend-module/src/actions/example.ts +6 -12
  48. package/dist/commands/index.cjs.js +0 -55
  49. package/dist/modules/config/commands/print.cjs.js +0 -53
  50. package/dist/modules/config/commands/validate.cjs.js +0 -19
  51. package/dist/modules/info/commands/info.cjs.js +0 -55
  52. package/dist/modules/start/index.cjs.js +0 -38
  53. /package/dist/modules/{start → build}/commands/package/start/command.cjs.js +0 -0
  54. /package/dist/modules/{start → build}/commands/package/start/index.cjs.js +0 -0
  55. /package/dist/modules/{start → build}/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -0
  56. /package/dist/modules/{start → build}/commands/package/start/startBackend.cjs.js +0 -0
  57. /package/dist/modules/{start → build}/commands/package/start/startPackage.cjs.js +0 -0
  58. /package/dist/modules/{start → build}/commands/repo/start.cjs.js +0 -0
  59. /package/dist/modules/{start → build}/lib/ipc/IpcServer.cjs.js +0 -0
  60. /package/dist/modules/{start → build}/lib/ipc/ServerDataStore.cjs.js +0 -0
  61. /package/dist/modules/{start → build}/lib/runner/runBackend.cjs.js +0 -0
@@ -1,15 +1,27 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var factory = require('../../wiring/factory.cjs.js');
6
+ var commander = require('commander');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
 
5
- function registerCommands(program) {
6
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(
7
- lazy.lazy(
8
- () => import('./commands/create-github-app/index.cjs.js'),
9
- "default"
10
- )
11
- );
12
- }
9
+ var index = factory.createCliPlugin({
10
+ pluginId: "new",
11
+ init: async (reg) => {
12
+ reg.addCommand({
13
+ path: ["create-github-app"],
14
+ description: "Create new GitHub App in your organization.",
15
+ execute: async ({ args }) => {
16
+ const command = new commander.Command();
17
+ const defaultCommand = command.argument("<github-org>").action(
18
+ lazy.lazy(() => import('./commands/create-github-app/index.cjs.js'), "default")
19
+ );
20
+ await defaultCommand.parseAsync(args, { from: "user" });
21
+ }
22
+ });
23
+ }
24
+ });
13
25
 
14
- exports.registerCommands = registerCommands;
26
+ exports.default = index;
15
27
  //# sourceMappingURL=index.cjs.js.map
@@ -1,10 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var lazy = require('../../lib/lazy.cjs.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function registerCommands(program) {
6
- program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy.lazy(() => import('./commands/info.cjs.js'), "default"));
7
- }
5
+ var yargs = require('yargs');
6
+ var factory = require('../../wiring/factory.cjs.js');
8
7
 
9
- exports.registerCommands = registerCommands;
8
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
+
10
+ var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
11
+
12
+ var index = factory.createCliPlugin({
13
+ pluginId: "info",
14
+ init: async (reg) => {
15
+ reg.addCommand({
16
+ path: ["info"],
17
+ description: "Show helpful information for debugging and reporting bugs",
18
+ execute: async ({ args }) => {
19
+ yargs__default.default().parse(args);
20
+ const { default: command } = require("./commands/info");
21
+ await command();
22
+ }
23
+ });
24
+ }
25
+ });
26
+
27
+ exports.default = index;
10
28
  //# sourceMappingURL=index.cjs.js.map
@@ -160,6 +160,7 @@ async function command(opts, cmd) {
160
160
  }
161
161
  });
162
162
  const outputSuccessCache = [];
163
+ const jsonResults = [];
163
164
  let errorOutput = "";
164
165
  let failed = false;
165
166
  for (const {
@@ -173,8 +174,12 @@ async function command(opts, cmd) {
173
174
  failed = true;
174
175
  if (resultText) {
175
176
  if (opts.outputFile) {
176
- errorOutput += `${resultText}
177
+ if (opts.format === "json") {
178
+ jsonResults.push(resultText);
179
+ } else {
180
+ errorOutput += `${resultText}
177
181
  `;
182
+ }
178
183
  } else {
179
184
  console.log();
180
185
  console.log(resultText.trimStart());
@@ -184,6 +189,13 @@ async function command(opts, cmd) {
184
189
  outputSuccessCache.push(sha);
185
190
  }
186
191
  }
192
+ if (opts.format === "json") {
193
+ let mergedJsonResults = [];
194
+ for (const jsonResult of jsonResults) {
195
+ mergedJsonResults = mergedJsonResults.concat(JSON.parse(jsonResult));
196
+ }
197
+ errorOutput = JSON.stringify(mergedJsonResults, null, 2);
198
+ }
187
199
  if (opts.outputFile && errorOutput) {
188
200
  await fs__default.default.writeFile(paths.paths.resolveTargetRoot(opts.outputFile), errorOutput);
189
201
  }
@@ -1,43 +1,82 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var factory = require('../../wiring/factory.cjs.js');
6
+ var commander = require('commander');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
 
5
- function registerPackageCommands(command) {
6
- command.command("lint [directories...]").option(
7
- "--format <format>",
8
- "Lint report output format",
9
- "eslint-formatter-friendly"
10
- ).option(
11
- "--output-file <path>",
12
- "Write the lint report to a file instead of stdout"
13
- ).option("--fix", "Attempt to automatically fix violations").option(
14
- "--max-warnings <number>",
15
- "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
16
- ).description("Lint a package").action(lazy.lazy(() => import('./commands/package/lint.cjs.js'), "default"));
17
- }
18
- function registerRepoCommands(command) {
19
- command.command("lint").description("Lint all packages in the project").option(
9
+ function registerPackageLintCommand(command) {
10
+ command.arguments("[directories...]");
11
+ command.option("--fix", "Attempt to automatically fix violations");
12
+ command.option(
20
13
  "--format <format>",
21
14
  "Lint report output format",
22
15
  "eslint-formatter-friendly"
23
- ).option(
16
+ );
17
+ command.option(
24
18
  "--output-file <path>",
25
19
  "Write the lint report to a file instead of stdout"
26
- ).option(
27
- "--since <ref>",
28
- "Only lint packages that changed since the specified ref"
29
- ).option(
30
- "--successCache",
31
- "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
32
- ).option(
33
- "--successCacheDir <path>",
34
- "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
35
- ).option(
20
+ );
21
+ command.option(
36
22
  "--max-warnings <number>",
37
23
  "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
38
- ).option("--fix", "Attempt to automatically fix violations").action(lazy.lazy(() => import('./commands/repo/lint.cjs.js'), "command"));
24
+ );
25
+ command.description("Lint a package");
26
+ command.action(lazy.lazy(() => import('./commands/package/lint.cjs.js'), "default"));
39
27
  }
28
+ var index = factory.createCliPlugin({
29
+ pluginId: "lint",
30
+ init: async (reg) => {
31
+ reg.addCommand({
32
+ path: ["package", "lint"],
33
+ description: "Lint a package",
34
+ execute: async ({ args }) => {
35
+ const command = new commander.Command();
36
+ registerPackageLintCommand(command);
37
+ await command.parseAsync(args, { from: "user" });
38
+ }
39
+ });
40
+ reg.addCommand({
41
+ path: ["repo", "lint"],
42
+ description: "Lint a repository",
43
+ execute: async ({ args }) => {
44
+ const command = new commander.Command();
45
+ registerPackageLintCommand(command.command("package").command("lint"));
46
+ command.option("--fix", "Attempt to automatically fix violations");
47
+ command.option(
48
+ "--format <format>",
49
+ "Lint report output format",
50
+ "eslint-formatter-friendly"
51
+ );
52
+ command.option(
53
+ "--output-file <path>",
54
+ "Write the lint report to a file instead of stdout"
55
+ );
56
+ command.option(
57
+ "--successCache",
58
+ "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
59
+ );
60
+ command.option(
61
+ "--successCacheDir <path>",
62
+ "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
63
+ );
64
+ command.option(
65
+ "--since <ref>",
66
+ "Only lint packages that changed since the specified ref"
67
+ );
68
+ command.option(
69
+ "--max-warnings <number>",
70
+ "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
71
+ );
72
+ command.description("Lint a repository");
73
+ command.action(lazy.lazy(() => import('./commands/repo/lint.cjs.js'), "command"));
74
+ await command.parseAsync(args, { from: "user" });
75
+ }
76
+ });
77
+ }
78
+ });
40
79
 
41
- exports.registerPackageCommands = registerPackageCommands;
42
- exports.registerRepoCommands = registerRepoCommands;
80
+ exports.default = index;
81
+ exports.registerPackageLintCommand = registerPackageLintCommand;
43
82
  //# sourceMappingURL=index.cjs.js.map
@@ -1,24 +1,86 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var commander = require('commander');
6
+ var factory = require('../../wiring/factory.cjs.js');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
 
5
- function registerPackageCommands(command) {
6
- command.command("clean").description("Delete cache directories").action(lazy.lazy(() => import('./commands/package/clean.cjs.js'), "default"));
7
- command.command("prepack").description("Prepares a package for packaging before publishing").action(lazy.lazy(() => import('./commands/package/pack.cjs.js'), "pre"));
8
- command.command("postpack").description("Restores the changes made by the prepack command").action(lazy.lazy(() => import('./commands/package/pack.cjs.js'), "post"));
9
- }
10
- function registerRepoCommands(command) {
11
- command.command("fix").description("Automatically fix packages in the project").option(
12
- "--publish",
13
- "Enable additional fixes that only apply when publishing packages"
14
- ).option(
15
- "--check",
16
- "Fail if any packages would have been changed by the command"
17
- ).action(lazy.lazy(() => import('./commands/repo/fix.cjs.js'), "command"));
18
- command.command("clean").description("Delete cache and output directories").action(lazy.lazy(() => import('./commands/repo/clean.cjs.js'), "command"));
19
- command.command("list-deprecations").description("List deprecations").option("--json", "Output as JSON").action(lazy.lazy(() => import('./commands/repo/list-deprecations.cjs.js'), "command"));
20
- }
9
+ var index = factory.createCliPlugin({
10
+ pluginId: "maintenance",
11
+ init: async (reg) => {
12
+ reg.addCommand({
13
+ path: ["package", "clean"],
14
+ description: "Delete cache directories",
15
+ execute: async ({ args }) => {
16
+ const command = new commander.Command();
17
+ const defaultCommand = command.action(
18
+ lazy.lazy(() => import('./commands/package/clean.cjs.js'), "default")
19
+ );
20
+ await defaultCommand.parseAsync(args, { from: "user" });
21
+ }
22
+ });
23
+ reg.addCommand({
24
+ path: ["package", "prepack"],
25
+ description: "Prepares a package for packaging before publishing",
26
+ execute: async ({ args }) => {
27
+ const command = new commander.Command();
28
+ const defaultCommand = command.action(
29
+ lazy.lazy(() => import('./commands/package/pack.cjs.js'), "pre")
30
+ );
31
+ await defaultCommand.parseAsync(args, { from: "user" });
32
+ }
33
+ });
34
+ reg.addCommand({
35
+ path: ["package", "postpack"],
36
+ description: "Restores the changes made by the prepack command",
37
+ execute: async ({ args }) => {
38
+ const command = new commander.Command();
39
+ const defaultCommand = command.action(
40
+ lazy.lazy(() => import('./commands/package/pack.cjs.js'), "post")
41
+ );
42
+ await defaultCommand.parseAsync(args, { from: "user" });
43
+ }
44
+ });
45
+ reg.addCommand({
46
+ path: ["repo", "fix"],
47
+ description: "Automatically fix packages in the project",
48
+ execute: async ({ args }) => {
49
+ const command = new commander.Command();
50
+ const defaultCommand = command.option(
51
+ "--publish",
52
+ "Enable additional fixes that only apply when publishing packages"
53
+ ).option(
54
+ "--check",
55
+ "Fail if any packages would have been changed by the command"
56
+ ).action(lazy.lazy(() => import('./commands/repo/fix.cjs.js'), "command"));
57
+ await defaultCommand.parseAsync(args, { from: "user" });
58
+ }
59
+ });
60
+ reg.addCommand({
61
+ path: ["repo", "clean"],
62
+ description: "Delete cache and output directories",
63
+ execute: async ({ args }) => {
64
+ const command = new commander.Command();
65
+ const defaultCommand = command.action(
66
+ lazy.lazy(() => import('./commands/repo/clean.cjs.js'), "command")
67
+ );
68
+ await defaultCommand.parseAsync(args, { from: "user" });
69
+ }
70
+ });
71
+ reg.addCommand({
72
+ path: ["repo", "list-deprecations"],
73
+ description: "List deprecations",
74
+ execute: async ({ args }) => {
75
+ const command = new commander.Command();
76
+ const defaultCommand = command.option("--json", "Output as JSON").action(
77
+ lazy.lazy(() => import('./commands/repo/list-deprecations.cjs.js'), "command")
78
+ );
79
+ await defaultCommand.parseAsync(args, { from: "user" });
80
+ }
81
+ });
82
+ }
83
+ });
21
84
 
22
- exports.registerPackageCommands = registerPackageCommands;
23
- exports.registerRepoCommands = registerRepoCommands;
85
+ exports.default = index;
24
86
  //# sourceMappingURL=index.cjs.js.map
@@ -1,36 +1,102 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var factory = require('../../wiring/factory.cjs.js');
6
+ var commander = require('commander');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
 
5
- function registerCommands(program) {
6
- program.command("versions:bump").option(
7
- "--pattern <glob>",
8
- "Override glob for matching packages to upgrade"
9
- ).option(
10
- "--release <version|next|main>",
11
- "Bump to a specific Backstage release line or version",
12
- "main"
13
- ).option("--skip-install", "Skips yarn install step").option("--skip-migrate", "Skips migration of any moved packages").description("Bump Backstage packages to the latest versions").action(lazy.lazy(() => import('./commands/versions/bump.cjs.js'), "default"));
14
- program.command("versions:migrate").option(
15
- "--pattern <glob>",
16
- "Override glob for matching packages to upgrade"
17
- ).option(
18
- "--skip-code-changes",
19
- "Skip code changes and only update package.json files"
20
- ).description(
21
- "Migrate any plugins that have been moved to the @backstage-community namespace automatically"
22
- ).action(lazy.lazy(() => import('./commands/versions/migrate.cjs.js'), "default"));
23
- const command = program.command("migrate [command]").description("Migration utilities");
24
- command.command("package-roles").description(`Add package role field to packages that don't have it`).action(lazy.lazy(() => import('./commands/packageRole.cjs.js'), "default"));
25
- command.command("package-scripts").description("Set package scripts according to each package role").action(lazy.lazy(() => import('./commands/packageScripts.cjs.js'), "command"));
26
- command.command("package-exports").description("Synchronize package subpath export definitions").action(lazy.lazy(() => import('./commands/packageExports.cjs.js'), "command"));
27
- command.command("package-lint-configs").description(
28
- "Migrates all packages to use @backstage/cli/config/eslint-factory"
29
- ).action(lazy.lazy(() => import('./commands/packageLintConfigs.cjs.js'), "command"));
30
- command.command("react-router-deps").description(
31
- "Migrates the react-router dependencies for all packages to be peer dependencies"
32
- ).action(lazy.lazy(() => import('./commands/reactRouterDeps.cjs.js'), "command"));
33
- }
9
+ var index = factory.createCliPlugin({
10
+ pluginId: "migrate",
11
+ init: async (reg) => {
12
+ reg.addCommand({
13
+ path: ["versions:migrate"],
14
+ description: "Migrate any plugins that have been moved to the @backstage-community namespace automatically",
15
+ execute: async ({ args }) => {
16
+ const command = new commander.Command();
17
+ const defaultCommand = command.option(
18
+ "--pattern <glob>",
19
+ "Override glob for matching packages to upgrade"
20
+ ).option(
21
+ "--skip-code-changes",
22
+ "Skip code changes and only update package.json files"
23
+ ).action(lazy.lazy(() => import('./commands/versions/migrate.cjs.js'), "default"));
24
+ await defaultCommand.parseAsync(args, { from: "user" });
25
+ }
26
+ });
27
+ reg.addCommand({
28
+ path: ["versions:bump"],
29
+ description: "Bump Backstage packages to the latest versions",
30
+ execute: async ({ args }) => {
31
+ const command = new commander.Command();
32
+ const defaultCommand = command.option(
33
+ "--pattern <glob>",
34
+ "Override glob for matching packages to upgrade"
35
+ ).option(
36
+ "--release <version|next|main>",
37
+ "Bump to a specific Backstage release line or version",
38
+ "main"
39
+ ).option("--skip-install", "Skips yarn install step").option("--skip-migrate", "Skips migration of any moved packages").action(lazy.lazy(() => import('./commands/versions/bump.cjs.js'), "default"));
40
+ await defaultCommand.parseAsync(args, { from: "user" });
41
+ }
42
+ });
43
+ reg.addCommand({
44
+ path: ["migrate", "package-roles"],
45
+ description: `Add package role field to packages that don't have it`,
46
+ execute: async ({ args }) => {
47
+ const command = new commander.Command();
48
+ const defaultCommand = command.action(
49
+ lazy.lazy(() => import('./commands/packageRole.cjs.js'), "default")
50
+ );
51
+ await defaultCommand.parseAsync(args, { from: "user" });
52
+ }
53
+ });
54
+ reg.addCommand({
55
+ path: ["migrate", "package-scripts"],
56
+ description: "Set package scripts according to each package role",
57
+ execute: async ({ args }) => {
58
+ const command = new commander.Command();
59
+ const defaultCommand = command.action(
60
+ lazy.lazy(() => import('./commands/packageScripts.cjs.js'), "command")
61
+ );
62
+ await defaultCommand.parseAsync(args, { from: "user" });
63
+ }
64
+ });
65
+ reg.addCommand({
66
+ path: ["migrate", "package-exports"],
67
+ description: "Synchronize package subpath export definitions",
68
+ execute: async ({ args }) => {
69
+ const command = new commander.Command();
70
+ const defaultCommand = command.action(
71
+ lazy.lazy(() => import('./commands/packageExports.cjs.js'), "command")
72
+ );
73
+ await defaultCommand.parseAsync(args, { from: "user" });
74
+ }
75
+ });
76
+ reg.addCommand({
77
+ path: ["migrate", "package-lint-configs"],
78
+ description: "Migrates all packages to use @backstage/cli/config/eslint-factory",
79
+ execute: async ({ args }) => {
80
+ const command = new commander.Command();
81
+ const defaultCommand = command.action(
82
+ lazy.lazy(() => import('./commands/packageLintConfigs.cjs.js'), "command")
83
+ );
84
+ await defaultCommand.parseAsync(args, { from: "user" });
85
+ }
86
+ });
87
+ reg.addCommand({
88
+ path: ["migrate", "react-router-deps"],
89
+ description: "Migrates the react-router dependencies for all packages to be peer dependencies",
90
+ execute: async ({ args }) => {
91
+ const command = new commander.Command();
92
+ const defaultCommand = command.action(
93
+ lazy.lazy(() => import('./commands/reactRouterDeps.cjs.js'), "command")
94
+ );
95
+ await defaultCommand.parseAsync(args, { from: "user" });
96
+ }
97
+ });
98
+ }
99
+ });
34
100
 
35
- exports.registerCommands = registerCommands;
101
+ exports.default = index;
36
102
  //# sourceMappingURL=index.cjs.js.map
@@ -1,35 +1,64 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var factory = require('../../wiring/factory.cjs.js');
6
+ var commander = require('commander');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
  var removed = require('../../lib/removed.cjs.js');
5
9
 
6
- function registerCommands(program) {
7
- program.command("new").storeOptionsAsProperties(false).description(
8
- "Open up an interactive guide to creating new things in your app"
9
- ).option(
10
- "--select <name>",
11
- "Select the thing you want to be creating upfront"
12
- ).option(
13
- "--option <name>=<value>",
14
- "Pre-fill options for the creation process",
15
- (opt, arr) => [...arr, opt],
16
- []
17
- ).option(
18
- "--skip-install",
19
- `Skips running 'yarn install' and 'yarn lint --fix'`
20
- ).option("--scope <scope>", "The scope to use for new packages").option(
21
- "--npm-registry <URL>",
22
- "The package registry to use for new packages"
23
- ).option(
24
- "--baseVersion <version>",
25
- "The version to use for any new packages (default: 0.1.0)"
26
- ).option(
27
- "--license <license>",
28
- "The license to use for any new packages (default: Apache-2.0)"
29
- ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => import('./commands/new.cjs.js'), "default"));
30
- program.command("create").allowUnknownOption(true).action(removed.removed("use 'backstage-cli new' instead"));
31
- program.command("create-plugin").allowUnknownOption(true).action(removed.removed("use 'backstage-cli new' instead"));
32
- }
10
+ var index = factory.createCliPlugin({
11
+ pluginId: "new",
12
+ init: async (reg) => {
13
+ reg.addCommand({
14
+ path: ["new"],
15
+ description: "Open up an interactive guide to creating new things in your app",
16
+ execute: async ({ args }) => {
17
+ const command = new commander.Command();
18
+ const defaultCommand = command.storeOptionsAsProperties(false).description(
19
+ "Open up an interactive guide to creating new things in your app"
20
+ ).option(
21
+ "--select <name>",
22
+ "Select the thing you want to be creating upfront"
23
+ ).option(
24
+ "--option <name>=<value>",
25
+ "Pre-fill options for the creation process",
26
+ (opt, arr) => [...arr, opt],
27
+ []
28
+ ).option(
29
+ "--skip-install",
30
+ `Skips running 'yarn install' and 'yarn lint --fix'`
31
+ ).option("--scope <scope>", "The scope to use for new packages").option(
32
+ "--npm-registry <URL>",
33
+ "The package registry to use for new packages"
34
+ ).option(
35
+ "--baseVersion <version>",
36
+ "The version to use for any new packages (default: 0.1.0)"
37
+ ).option(
38
+ "--license <license>",
39
+ "The license to use for any new packages (default: Apache-2.0)"
40
+ ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => import('./commands/new.cjs.js'), "default"));
41
+ await defaultCommand.parseAsync(args, { from: "user" });
42
+ }
43
+ });
44
+ reg.addCommand({
45
+ path: ["create"],
46
+ description: "Create a new Backstage app",
47
+ deprecated: true,
48
+ execute: async () => {
49
+ removed.removed("use 'backstage-cli new' instead")();
50
+ }
51
+ });
52
+ reg.addCommand({
53
+ path: ["create-plugin"],
54
+ description: "Create a new Backstage plugin",
55
+ deprecated: true,
56
+ execute: async () => {
57
+ removed.removed("use 'backstage-cli new' instead")();
58
+ }
59
+ });
60
+ }
61
+ });
33
62
 
34
- exports.registerCommands = registerCommands;
63
+ exports.default = index;
35
64
  //# sourceMappingURL=index.cjs.js.map
@@ -1,26 +1,52 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var factory = require('../../wiring/factory.cjs.js');
6
+ var commander = require('commander');
3
7
  var lazy = require('../../lib/lazy.cjs.js');
4
8
 
5
- function registerRepoCommands(command) {
6
- command.command("test").allowUnknownOption(true).option(
7
- "--since <ref>",
8
- "Only test packages that changed since the specified ref"
9
- ).option(
10
- "--successCache",
11
- "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
12
- ).option(
13
- "--successCacheDir <path>",
14
- "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
15
- ).option(
16
- "--jest-help",
17
- "Show help for Jest CLI options, which are passed through"
18
- ).description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => import('./commands/repo/test.cjs.js'), "command"));
19
- }
20
- function registerPackageCommands(command) {
21
- command.command("test").allowUnknownOption(true).helpOption(", --backstage-cli-help").description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy.lazy(() => import('./commands/package/test.cjs.js'), "default"));
22
- }
9
+ var index = factory.createCliPlugin({
10
+ pluginId: "test",
11
+ init: async (reg) => {
12
+ reg.addCommand({
13
+ path: ["repo", "test"],
14
+ description: "Run tests, forwarding args to Jest, defaulting to watch mode",
15
+ execute: async ({ args }) => {
16
+ const command = new commander.Command();
17
+ command.allowUnknownOption(true);
18
+ command.option(
19
+ "--since <ref>",
20
+ "Only test packages that changed since the specified ref"
21
+ );
22
+ command.option("--successCache", "Enable success caching");
23
+ command.option(
24
+ "--successCacheDir <path>",
25
+ "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
26
+ );
27
+ command.option(
28
+ "--jest-help",
29
+ "Show help for Jest CLI options, which are passed through"
30
+ );
31
+ command.action(lazy.lazy(() => import('./commands/repo/test.cjs.js'), "command"));
32
+ await command.parseAsync(args, { from: "user" });
33
+ }
34
+ });
35
+ reg.addCommand({
36
+ path: ["package", "test"],
37
+ description: "Run tests, forwarding args to Jest, defaulting to watch mode",
38
+ execute: async ({ args }) => {
39
+ const command = new commander.Command();
40
+ command.allowUnknownOption(true);
41
+ command.helpOption(", --backstage-cli-help");
42
+ command.action(
43
+ lazy.lazy(() => import('./commands/package/test.cjs.js'), "default")
44
+ );
45
+ await command.parseAsync(args, { from: "user" });
46
+ }
47
+ });
48
+ }
49
+ });
23
50
 
24
- exports.registerPackageCommands = registerPackageCommands;
25
- exports.registerRepoCommands = registerRepoCommands;
51
+ exports.default = index;
26
52
  //# sourceMappingURL=index.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.10.0";
3
+ var version = "0.11.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 = "1.3.1";
3
+ var version = "1.4.0-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map