@backstage/cli 0.35.5-next.0 → 0.36.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 (106) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/config/jest.js +2 -2
  3. package/dist/index.cjs.js +1 -0
  4. package/dist/modules/auth/commands/list.cjs.js +23 -0
  5. package/dist/modules/auth/commands/login.cjs.js +316 -0
  6. package/dist/modules/auth/commands/logout.cjs.js +55 -0
  7. package/dist/modules/auth/commands/printToken.cjs.js +41 -0
  8. package/dist/modules/auth/commands/select.cjs.js +32 -0
  9. package/dist/modules/auth/commands/show.cjs.js +59 -0
  10. package/dist/modules/auth/index.cjs.js +44 -0
  11. package/dist/modules/auth/lib/auth.cjs.js +60 -0
  12. package/dist/modules/auth/lib/http.cjs.js +26 -0
  13. package/dist/modules/auth/lib/localServer.cjs.js +80 -0
  14. package/dist/modules/auth/lib/pkce.cjs.js +23 -0
  15. package/dist/modules/auth/lib/prompt.cjs.js +44 -0
  16. package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
  17. package/dist/modules/auth/lib/storage.cjs.js +152 -0
  18. package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
  19. package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
  20. package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
  21. package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
  22. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  23. package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
  24. package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
  25. package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
  26. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
  27. package/dist/modules/build/commands/repo/build.cjs.js +46 -11
  28. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
  29. package/dist/modules/build/commands/repo/start.cjs.js +54 -5
  30. package/dist/modules/build/index.cjs.js +32 -123
  31. package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
  32. package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
  33. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
  34. package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
  35. package/dist/modules/build/lib/config.cjs.js +94 -0
  36. package/dist/modules/build/lib/optionsParser.cjs.js +22 -0
  37. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
  38. package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
  39. package/dist/modules/build/lib/role.cjs.js +1 -1
  40. package/dist/modules/config/commands/docs.cjs.js +19 -2
  41. package/dist/modules/config/commands/print.cjs.js +41 -13
  42. package/dist/modules/config/commands/schema.cjs.js +25 -6
  43. package/dist/modules/config/commands/validate.cjs.js +38 -7
  44. package/dist/modules/config/index.cjs.js +6 -65
  45. package/dist/modules/config/lib/config.cjs.js +6 -22
  46. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
  47. package/dist/modules/create-github-app/index.cjs.js +1 -9
  48. package/dist/modules/info/commands/info.cjs.js +26 -6
  49. package/dist/modules/info/index.cjs.js +1 -23
  50. package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
  51. package/dist/modules/lint/commands/repo/lint.cjs.js +99 -27
  52. package/dist/modules/lint/index.cjs.js +2 -60
  53. package/dist/modules/lint/lib/optionsParser.cjs.js +22 -0
  54. package/dist/modules/maintenance/commands/repo/fix.cjs.js +32 -9
  55. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
  56. package/dist/modules/maintenance/index.cjs.js +2 -64
  57. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  58. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  59. package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
  60. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  61. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  62. package/dist/modules/migrate/commands/versions/bump.cjs.js +48 -20
  63. package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
  64. package/dist/modules/migrate/index.cjs.js +12 -55
  65. package/dist/modules/new/commands/new.cjs.js +70 -15
  66. package/dist/modules/new/index.cjs.js +1 -29
  67. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
  68. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
  69. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
  70. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
  71. package/dist/modules/test/commands/package/test.cjs.js +1 -10
  72. package/dist/modules/test/commands/repo/test.cjs.js +51 -39
  73. package/dist/modules/test/index.cjs.js +2 -32
  74. package/dist/modules/translations/commands/export.cjs.js +25 -1
  75. package/dist/modules/translations/commands/import.cjs.js +25 -1
  76. package/dist/modules/translations/index.cjs.js +2 -37
  77. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  78. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  79. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  80. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  81. package/dist/packages/cli/package.json.cjs.js +7 -6
  82. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  83. package/dist/packages/core-components/package.json.cjs.js +1 -1
  84. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  85. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  86. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  87. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  88. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  89. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  90. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  91. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  92. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  93. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  94. package/dist/wiring/CliInitializer.cjs.js +24 -7
  95. package/dist/wiring/version.cjs.js +20 -0
  96. package/package.json +26 -22
  97. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  98. package/dist/lib/lazy.cjs.js +0 -22
  99. package/dist/lib/optionsParser.cjs.js +0 -37
  100. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  101. package/dist/lib/yarnPlugin.cjs.js +0 -46
  102. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  103. /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
  104. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  105. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  106. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
@@ -1,17 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var fix = require('../../maintenance/commands/repo/fix.cjs.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- async function command() {
6
- console.log(
7
- "The `migrate package-exports` command is deprecated, use `repo fix` instead."
5
+ var cleye = require('cleye');
6
+
7
+ var packageExports = async ({ args, info }) => {
8
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
9
+ throw new Error(
10
+ "The `migrate package-exports` command has been removed, use `repo fix` instead."
8
11
  );
9
- const packages = await fix.readFixablePackages();
10
- for (const pkg of packages) {
11
- fix.fixPackageExports(pkg);
12
- }
13
- await fix.writeFixedPackages(packages);
14
- }
12
+ };
15
13
 
16
- exports.command = command;
14
+ exports.default = packageExports;
17
15
  //# sourceMappingURL=packageExports.cjs.js.map
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
3
6
  var fs = require('fs-extra');
4
7
  var path = require('node:path');
5
8
  var cliNode = require('@backstage/cli-node');
@@ -10,7 +13,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
10
13
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
14
 
12
15
  const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
13
- async function command() {
16
+ var packageLintConfigs = async ({ args, info }) => {
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
14
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
15
19
  const oldConfigs = [
16
20
  require.resolve("@backstage/cli/config/eslint.js"),
@@ -67,7 +71,7 @@ async function command() {
67
71
  if (hasPrettier) {
68
72
  await cliCommon.runOutput(["prettier", "--write", ...configPaths]);
69
73
  }
70
- }
74
+ };
71
75
 
72
- exports.command = command;
76
+ exports.default = packageLintConfigs;
73
77
  //# sourceMappingURL=packageLintConfigs.cjs.js.map
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var fs = require('fs-extra');
6
7
  var path = require('node:path');
7
8
  var getPackages = require('@manypkg/get-packages');
@@ -12,7 +13,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
12
13
 
13
14
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
15
 
15
- var packageRole = async () => {
16
+ var packageRole = async ({ args, info }) => {
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
16
18
  const { packages } = await getPackages.getPackages(cliCommon.targetPaths.dir);
17
19
  await Promise.all(
18
20
  packages.map(async ({ dir, packageJson: pkg }) => {
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
3
6
  var fs = require('fs-extra');
4
7
  var path = require('node:path');
5
8
  var cliNode = require('@backstage/cli-node');
@@ -10,7 +13,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
13
 
11
14
  const configArgPattern = /--config[=\s][^\s$]+/;
12
15
  const noStartRoles = ["cli", "common-library"];
13
- async function command() {
16
+ var packageScripts = async ({ args, info }) => {
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
14
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
15
19
  await Promise.all(
16
20
  packages.map(async ({ dir, packageJson }) => {
@@ -38,11 +42,11 @@ async function command() {
38
42
  }
39
43
  const testCmd = ["test"];
40
44
  if (scripts.test?.startsWith("backstage-cli test")) {
41
- const args = scripts.test.slice("backstage-cli test".length).split(" ").filter(Boolean);
42
- if (args.includes("--passWithNoTests")) {
43
- args.splice(args.indexOf("--passWithNoTests"), 1);
45
+ const testArgs = scripts.test.slice("backstage-cli test".length).split(" ").filter(Boolean);
46
+ if (testArgs.includes("--passWithNoTests")) {
47
+ testArgs.splice(testArgs.indexOf("--passWithNoTests"), 1);
44
48
  }
45
- testCmd.push(...args);
49
+ testCmd.push(...testArgs);
46
50
  }
47
51
  const expectedScripts = {
48
52
  ...hasStart && {
@@ -77,7 +81,7 @@ async function command() {
77
81
  }
78
82
  })
79
83
  );
80
- }
84
+ };
81
85
 
82
- exports.command = command;
86
+ exports.default = packageScripts;
83
87
  //# sourceMappingURL=packageScripts.cjs.js.map
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
3
6
  var fs = require('fs-extra');
4
7
  var path = require('node:path');
5
8
  var cliNode = require('@backstage/cli-node');
@@ -10,7 +13,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
13
 
11
14
  const REACT_ROUTER_DEPS = ["react-router", "react-router-dom"];
12
15
  const REACT_ROUTER_RANGE = "6.0.0-beta.0 || ^6.3.0";
13
- async function command() {
16
+ var reactRouterDeps = async ({ args, info }) => {
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
14
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
15
19
  await Promise.all(
16
20
  packages.map(async ({ dir, packageJson }) => {
@@ -41,7 +45,7 @@ async function command() {
41
45
  }
42
46
  })
43
47
  );
44
- }
48
+ };
45
49
 
46
- exports.command = command;
50
+ exports.default = reactRouterDeps;
47
51
  //# sourceMappingURL=reactRouterDeps.cjs.js.map
@@ -8,12 +8,11 @@ var fs = require('fs-extra');
8
8
  var chalk = require('chalk');
9
9
  var minimatch = require('minimatch');
10
10
  var semver = require('semver');
11
+ var cleye = require('cleye');
11
12
  var errors = require('@backstage/errors');
12
13
  var path = require('node:path');
13
- var yarnPlugin = require('../../../../lib/yarnPlugin.cjs.js');
14
- var Lockfile = require('../../../../lib/versioning/Lockfile.cjs.js');
15
- var packages = require('../../../../lib/versioning/packages.cjs.js');
16
14
  var cliNode = require('@backstage/cli-node');
15
+ var packages = require('../../lib/versioning/packages.cjs.js');
17
16
  var releaseManifests = require('@backstage/release-manifests');
18
17
  var migrate = require('./migrate.cjs.js');
19
18
  var utils = require('../../lib/utils.cjs.js');
@@ -38,11 +37,40 @@ function extendsDefaultPattern(pattern) {
38
37
  }
39
38
  return minimatch.minimatch("@backstage/", pattern.slice(0, -1));
40
39
  }
41
- var bump = async (opts) => {
40
+ var bump = async ({ args, info }) => {
41
+ const {
42
+ flags: { pattern: patternFlag, release, skipInstall, skipMigrate }
43
+ } = cleye.cli(
44
+ {
45
+ help: info,
46
+ booleanFlagNegation: true,
47
+ flags: {
48
+ pattern: {
49
+ type: String,
50
+ description: "Override glob for matching packages to upgrade"
51
+ },
52
+ release: {
53
+ type: String,
54
+ description: "Bump to a specific Backstage release line or version",
55
+ default: "main"
56
+ },
57
+ skipInstall: {
58
+ type: Boolean,
59
+ description: "Skips yarn install step"
60
+ },
61
+ skipMigrate: {
62
+ type: Boolean,
63
+ description: "Skips migration of any moved packages"
64
+ }
65
+ }
66
+ },
67
+ void 0,
68
+ args
69
+ );
42
70
  const lockfilePath = cliCommon.targetPaths.resolveRoot("yarn.lock");
43
- const lockfile = await Lockfile.Lockfile.load(lockfilePath);
44
- const hasYarnPlugin = await yarnPlugin.getHasYarnPlugin();
45
- let pattern = opts.pattern;
71
+ const lockfile = await cliNode.Lockfile.load(lockfilePath);
72
+ const yarnPluginEnabled = await cliNode.hasBackstageYarnPlugin();
73
+ let pattern = patternFlag;
46
74
  if (!pattern) {
47
75
  console.log(`Using default pattern glob ${DEFAULT_PATTERN_GLOB}`);
48
76
  pattern = DEFAULT_PATTERN_GLOB;
@@ -58,13 +86,13 @@ var bump = async (opts) => {
58
86
  findTargetVersion = createStrictVersionFinder({
59
87
  releaseManifest
60
88
  });
61
- } else if (semver__default.default.valid(opts.release)) {
62
- releaseManifest = await releaseManifests.getManifestByVersion({ version: opts.release });
89
+ } else if (semver__default.default.valid(release)) {
90
+ releaseManifest = await releaseManifests.getManifestByVersion({ version: release });
63
91
  findTargetVersion = createStrictVersionFinder({
64
92
  releaseManifest
65
93
  });
66
94
  } else {
67
- if (opts.release === "next") {
95
+ if (release === "next") {
68
96
  const next = await releaseManifests.getManifestByReleaseLine({
69
97
  releaseLine: "next",
70
98
  versionsBaseUrl: node_process.env.BACKSTAGE_VERSIONS_BASE_URL
@@ -76,16 +104,16 @@ var bump = async (opts) => {
76
104
  releaseManifest = semver__default.default.gt(next.releaseVersion, main.releaseVersion) ? next : main;
77
105
  } else {
78
106
  releaseManifest = await releaseManifests.getManifestByReleaseLine({
79
- releaseLine: opts.release,
107
+ releaseLine: release,
80
108
  versionsBaseUrl: node_process.env.BACKSTAGE_VERSIONS_BASE_URL
81
109
  });
82
110
  }
83
111
  findTargetVersion = createVersionFinder({
84
- releaseLine: opts.releaseLine,
112
+ releaseLine: release,
85
113
  releaseManifest
86
114
  });
87
115
  }
88
- if (hasYarnPlugin) {
116
+ if (yarnPluginEnabled) {
89
117
  console.log();
90
118
  console.log(
91
119
  `Updating yarn plugin to v${releaseManifest.releaseVersion}...`
@@ -147,7 +175,7 @@ var bump = async (opts) => {
147
175
  if (depType in pkgJson && dep.name in pkgJson[depType]) {
148
176
  const oldRange = pkgJson[depType][dep.name];
149
177
  const oldLockfileRange = await asLockfileVersion(oldRange);
150
- const useBackstageRange = hasYarnPlugin && // Only use backstage:^ versions if the package is present in
178
+ const useBackstageRange = yarnPluginEnabled && // Only use backstage:^ versions if the package is present in
151
179
  // the manifest for the release we're bumping to.
152
180
  releaseManifest.packages.find(
153
181
  ({ name: manifestPackageName }) => dep.name === manifestPackageName
@@ -174,7 +202,7 @@ var bump = async (opts) => {
174
202
  if (extendsDefaultPattern(pattern)) {
175
203
  await bumpBackstageJsonVersion(
176
204
  releaseManifest.releaseVersion,
177
- hasYarnPlugin
205
+ yarnPluginEnabled
178
206
  );
179
207
  } else {
180
208
  console.log(
@@ -183,18 +211,18 @@ var bump = async (opts) => {
183
211
  )
184
212
  );
185
213
  }
186
- if (!opts.skipInstall) {
214
+ if (!skipInstall) {
187
215
  await utils.runYarnInstall();
188
216
  } else {
189
217
  console.log();
190
218
  console.log(chalk__default.default.yellow(`Skipping yarn install`));
191
219
  }
192
- if (!opts.skipMigrate) {
220
+ if (!skipMigrate) {
193
221
  console.log();
194
222
  const changed = await migrate.migrateMovedPackages({
195
- pattern: opts.pattern
223
+ pattern: patternFlag
196
224
  });
197
- if (changed && !opts.skipInstall) {
225
+ if (changed && !skipInstall) {
198
226
  await utils.runYarnInstall();
199
227
  }
200
228
  }
@@ -228,7 +256,7 @@ var bump = async (opts) => {
228
256
  } else {
229
257
  console.log();
230
258
  }
231
- if (hasYarnPlugin) {
259
+ if (yarnPluginEnabled) {
232
260
  console.log();
233
261
  console.log(
234
262
  chalk__default.default.blue(
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var cliNode = require('@backstage/cli-node');
6
6
  var chalk = require('chalk');
7
7
  var path = require('node:path');
8
+ var cleye = require('cleye');
8
9
  var fs = require('fs-extra');
9
10
  var minimatch = require('minimatch');
10
11
  var utils = require('../../lib/utils.cjs.js');
@@ -15,10 +16,30 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
15
16
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
16
17
  var replace__default = /*#__PURE__*/_interopDefaultCompat(replace);
17
18
 
18
- var migrate = async (options) => {
19
+ var migrate = async ({ args, info }) => {
20
+ const {
21
+ flags: { pattern, skipCodeChanges }
22
+ } = cleye.cli(
23
+ {
24
+ help: info,
25
+ booleanFlagNegation: true,
26
+ flags: {
27
+ pattern: {
28
+ type: String,
29
+ description: "Override glob for matching packages to upgrade"
30
+ },
31
+ skipCodeChanges: {
32
+ type: Boolean,
33
+ description: "Skip code changes and only update package.json files"
34
+ }
35
+ }
36
+ },
37
+ void 0,
38
+ args
39
+ );
19
40
  const changed = await migrateMovedPackages({
20
- pattern: options.pattern,
21
- skipCodeChanges: options.skipCodeChanges
41
+ pattern,
42
+ skipCodeChanges
22
43
  });
23
44
  if (changed) {
24
45
  await utils.runYarnInstall();
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var factory = require('../../wiring/factory.cjs.js');
6
- var commander = require('commander');
7
- var lazy = require('../../lib/lazy.cjs.js');
8
6
 
9
7
  var index = factory.createCliPlugin({
10
8
  pluginId: "migrate",
@@ -12,87 +10,46 @@ var index = factory.createCliPlugin({
12
10
  reg.addCommand({
13
11
  path: ["versions:migrate"],
14
12
  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
- }
13
+ execute: { loader: () => import('./commands/versions/migrate.cjs.js') }
26
14
  });
27
15
  reg.addCommand({
28
16
  path: ["versions:bump"],
29
17
  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
- }
18
+ execute: { loader: () => import('./commands/versions/bump.cjs.js') }
42
19
  });
43
20
  reg.addCommand({
44
21
  path: ["migrate", "package-roles"],
45
22
  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" });
23
+ execute: {
24
+ loader: () => import('./commands/packageRole.cjs.js')
52
25
  }
53
26
  });
54
27
  reg.addCommand({
55
28
  path: ["migrate", "package-scripts"],
56
29
  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" });
30
+ execute: {
31
+ loader: () => import('./commands/packageScripts.cjs.js')
63
32
  }
64
33
  });
65
34
  reg.addCommand({
66
35
  path: ["migrate", "package-exports"],
67
36
  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" });
37
+ execute: {
38
+ loader: () => import('./commands/packageExports.cjs.js')
74
39
  }
75
40
  });
76
41
  reg.addCommand({
77
42
  path: ["migrate", "package-lint-configs"],
78
43
  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" });
44
+ execute: {
45
+ loader: () => import('./commands/packageLintConfigs.cjs.js')
85
46
  }
86
47
  });
87
48
  reg.addCommand({
88
49
  path: ["migrate", "react-router-deps"],
89
50
  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" });
51
+ execute: {
52
+ loader: () => import('./commands/reactRouterDeps.cjs.js')
96
53
  }
97
54
  });
98
55
  }
@@ -2,17 +2,73 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var createNewPackage = require('../lib/createNewPackage.cjs.js');
6
7
 
7
- var _new = async (opts) => {
8
+ var _new = async ({ args, info }) => {
9
+ for (const flag of ["skipInstall", "npmRegistry", "baseVersion"]) {
10
+ if (args.some((a) => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
11
+ process.stderr.write(
12
+ `DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead
13
+ `
14
+ );
15
+ }
16
+ }
8
17
  const {
9
- option: rawArgOptions,
10
- select: preselectedTemplateId,
11
- skipInstall,
12
- scope,
13
- private: isPrivate,
14
- ...otherGlobals
15
- } = opts;
18
+ flags: {
19
+ select,
20
+ option: rawArgOptions,
21
+ skipInstall,
22
+ scope,
23
+ npmRegistry,
24
+ baseVersion,
25
+ license,
26
+ private: isPrivate
27
+ }
28
+ } = cleye.cli(
29
+ {
30
+ help: info,
31
+ booleanFlagNegation: true,
32
+ flags: {
33
+ select: {
34
+ type: String,
35
+ description: "Select the thing you want to be creating upfront"
36
+ },
37
+ option: {
38
+ type: [String],
39
+ description: "Pre-fill options for the creation process",
40
+ default: []
41
+ },
42
+ skipInstall: {
43
+ type: Boolean,
44
+ description: `Skips running 'yarn install' and 'yarn lint --fix'`
45
+ },
46
+ scope: {
47
+ type: String,
48
+ description: "The scope to use for new packages"
49
+ },
50
+ npmRegistry: {
51
+ type: String,
52
+ description: "The package registry to use for new packages"
53
+ },
54
+ baseVersion: {
55
+ type: String,
56
+ description: "The version to use for any new packages (default: 0.1.0)"
57
+ },
58
+ license: {
59
+ type: String,
60
+ description: "The license to use for any new packages (default: Apache-2.0)"
61
+ },
62
+ private: {
63
+ type: Boolean,
64
+ description: "Mark new packages as private",
65
+ default: true
66
+ }
67
+ }
68
+ },
69
+ void 0,
70
+ args
71
+ );
16
72
  const prefilledParams = parseParams(rawArgOptions);
17
73
  let pluginInfix = void 0;
18
74
  let packagePrefix = void 0;
@@ -21,24 +77,23 @@ var _new = async (opts) => {
21
77
  packagePrefix = normalizedScope.includes("/") ? normalizedScope : `${normalizedScope}/`;
22
78
  pluginInfix = scope.includes("backstage") ? "plugin-" : "backstage-plugin-";
23
79
  }
24
- if (isPrivate === false || // set to false with --no-private flag
25
- Object.values(otherGlobals).filter(Boolean).length !== 0) {
80
+ if (isPrivate === false || [npmRegistry, baseVersion, license].filter(Boolean).length !== 0) {
26
81
  console.warn(
27
82
  `Global template configuration via CLI flags is deprecated, see https://backstage.io/docs/cli/new for information on how to configure package templating`
28
83
  );
29
84
  }
30
85
  await createNewPackage.createNewPackage({
31
86
  prefilledParams,
32
- preselectedTemplateId,
87
+ preselectedTemplateId: select,
33
88
  configOverrides: {
34
- license: otherGlobals.license,
35
- version: otherGlobals.baseVersion,
89
+ license,
90
+ version: baseVersion,
36
91
  private: isPrivate,
37
- publishRegistry: otherGlobals.npmRegistry,
92
+ publishRegistry: npmRegistry,
38
93
  packageNamePrefix: packagePrefix,
39
94
  packageNamePluginInfix: pluginInfix
40
95
  },
41
- skipInstall
96
+ skipInstall: Boolean(skipInstall)
42
97
  });
43
98
  };
44
99
  function parseParams(optionStrings) {
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var factory = require('../../wiring/factory.cjs.js');
6
- var commander = require('commander');
7
- var lazy = require('../../lib/lazy.cjs.js');
8
6
  var errors = require('@backstage/errors');
9
7
 
10
8
  var index = factory.createCliPlugin({
@@ -13,33 +11,7 @@ var index = factory.createCliPlugin({
13
11
  reg.addCommand({
14
12
  path: ["new"],
15
13
  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
- }
14
+ execute: { loader: () => import('./commands/new.cjs.js') }
43
15
  });
44
16
  reg.addCommand({
45
17
  path: ["create"],
@@ -9,13 +9,9 @@ var startCase = require('lodash/startCase');
9
9
  var upperCase = require('lodash/upperCase');
10
10
  var upperFirst = require('lodash/upperFirst');
11
11
  var lowerFirst = require('lodash/lowerFirst');
12
- var Lockfile = require('../../../../lib/versioning/Lockfile.cjs.js');
13
- require('minimatch');
14
- require('@manypkg/get-packages');
15
- require('@backstage/errors');
12
+ var cliNode = require('@backstage/cli-node');
16
13
  var cliCommon = require('@backstage/cli-common');
17
- var version = require('../../../../lib/version.cjs.js');
18
- var yarnPlugin = require('../../../../lib/yarnPlugin.cjs.js');
14
+ var version = require('../version.cjs.js');
19
15
 
20
16
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
21
17
 
@@ -43,12 +39,12 @@ class PortableTemplater {
43
39
  static async create(options = {}) {
44
40
  let lockfile;
45
41
  try {
46
- lockfile = await Lockfile.Lockfile.load(cliCommon.targetPaths.resolveRoot("yarn.lock"));
42
+ lockfile = await cliNode.Lockfile.load(cliCommon.targetPaths.resolveRoot("yarn.lock"));
47
43
  } catch {
48
44
  }
49
- const hasYarnPlugin = await yarnPlugin.getHasYarnPlugin();
45
+ const yarnPluginEnabled = await cliNode.hasBackstageYarnPlugin();
50
46
  const versionProvider = version.createPackageVersionProvider(lockfile, {
51
- preferBackstageProtocol: hasYarnPlugin
47
+ preferBackstageProtocol: yarnPluginEnabled
52
48
  });
53
49
  const templater = new PortableTemplater(
54
50
  {