@backstage/cli 0.36.0-next.1 → 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 (80) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/index.cjs.js +1 -0
  3. package/dist/modules/auth/commands/list.cjs.js +23 -0
  4. package/dist/modules/auth/commands/login.cjs.js +316 -0
  5. package/dist/modules/auth/commands/logout.cjs.js +55 -0
  6. package/dist/modules/auth/commands/printToken.cjs.js +41 -0
  7. package/dist/modules/auth/commands/select.cjs.js +32 -0
  8. package/dist/modules/auth/commands/show.cjs.js +59 -0
  9. package/dist/modules/auth/index.cjs.js +44 -0
  10. package/dist/modules/auth/lib/auth.cjs.js +60 -0
  11. package/dist/modules/auth/lib/http.cjs.js +26 -0
  12. package/dist/modules/auth/lib/localServer.cjs.js +80 -0
  13. package/dist/modules/auth/lib/pkce.cjs.js +23 -0
  14. package/dist/modules/auth/lib/prompt.cjs.js +44 -0
  15. package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
  16. package/dist/modules/auth/lib/storage.cjs.js +152 -0
  17. package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
  18. package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
  19. package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
  20. package/dist/modules/build/commands/package/clean.cjs.js +1 -1
  21. package/dist/modules/build/commands/package/postpack.cjs.js +1 -1
  22. package/dist/modules/build/commands/package/prepack.cjs.js +1 -1
  23. package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
  24. package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
  25. package/dist/modules/build/commands/repo/build.cjs.js +45 -10
  26. package/dist/modules/build/commands/repo/clean.cjs.js +1 -1
  27. package/dist/modules/build/commands/repo/start.cjs.js +54 -5
  28. package/dist/modules/build/index.cjs.js +5 -129
  29. package/dist/modules/build/lib/optionsParser.cjs.js +9 -24
  30. package/dist/modules/build/lib/role.cjs.js +1 -1
  31. package/dist/modules/config/commands/docs.cjs.js +1 -0
  32. package/dist/modules/config/commands/print.cjs.js +3 -2
  33. package/dist/modules/config/commands/schema.cjs.js +3 -2
  34. package/dist/modules/config/commands/validate.cjs.js +1 -0
  35. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
  36. package/dist/modules/create-github-app/index.cjs.js +1 -9
  37. package/dist/modules/info/commands/info.cjs.js +1 -0
  38. package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
  39. package/dist/modules/lint/commands/repo/lint.cjs.js +95 -25
  40. package/dist/modules/lint/index.cjs.js +2 -60
  41. package/dist/modules/lint/lib/optionsParser.cjs.js +9 -24
  42. package/dist/modules/maintenance/commands/repo/fix.cjs.js +31 -5
  43. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
  44. package/dist/modules/maintenance/index.cjs.js +2 -20
  45. package/dist/modules/migrate/commands/packageExports.cjs.js +1 -1
  46. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +1 -1
  47. package/dist/modules/migrate/commands/packageRole.cjs.js +1 -1
  48. package/dist/modules/migrate/commands/packageScripts.cjs.js +1 -1
  49. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +1 -1
  50. package/dist/modules/migrate/commands/versions/bump.cjs.js +41 -11
  51. package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
  52. package/dist/modules/migrate/index.cjs.js +2 -25
  53. package/dist/modules/new/commands/new.cjs.js +70 -15
  54. package/dist/modules/new/index.cjs.js +1 -29
  55. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +2 -2
  56. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +2 -2
  57. package/dist/modules/test/commands/package/test.cjs.js +1 -7
  58. package/dist/modules/test/commands/repo/test.cjs.js +45 -34
  59. package/dist/modules/test/index.cjs.js +2 -32
  60. package/dist/modules/translations/commands/export.cjs.js +1 -0
  61. package/dist/modules/translations/commands/import.cjs.js +1 -0
  62. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  63. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  64. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  65. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  66. package/dist/packages/cli/package.json.cjs.js +7 -4
  67. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  68. package/dist/packages/core-components/package.json.cjs.js +1 -1
  69. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  70. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  71. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  72. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  73. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  74. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  75. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  76. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  77. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  78. package/dist/wiring/CliInitializer.cjs.js +12 -2
  79. package/package.json +23 -17
  80. package/dist/wiring/lazy.cjs.js +0 -22
@@ -34,6 +34,7 @@ var info = async ({ args, info }) => {
34
34
  } = cleye.cli(
35
35
  {
36
36
  help: info,
37
+ booleanFlagNegation: true,
37
38
  flags: {
38
39
  include: {
39
40
  type: [String],
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var fs = require('fs-extra');
6
+ var cleye = require('cleye');
6
7
  var cliCommon = require('@backstage/cli-common');
7
8
  var eslint = require('eslint');
8
9
 
@@ -10,29 +11,60 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
10
11
 
11
12
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
13
 
13
- var lint = async (directories, opts) => {
14
+ var lint = async ({ args, info }) => {
15
+ const {
16
+ flags: { fix, format, outputFile, maxWarnings },
17
+ _: directories
18
+ } = cleye.cli(
19
+ {
20
+ help: { ...info, usage: `${info.usage} [directories...]` },
21
+ booleanFlagNegation: true,
22
+ parameters: ["[directories...]"],
23
+ flags: {
24
+ fix: {
25
+ type: Boolean,
26
+ description: "Attempt to automatically fix violations"
27
+ },
28
+ format: {
29
+ type: String,
30
+ description: "Lint report output format",
31
+ default: "eslint-formatter-friendly"
32
+ },
33
+ outputFile: {
34
+ type: String,
35
+ description: "Write the lint report to a file instead of stdout"
36
+ },
37
+ maxWarnings: {
38
+ type: String,
39
+ description: "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
40
+ }
41
+ }
42
+ },
43
+ void 0,
44
+ args
45
+ );
14
46
  const eslint$1 = new eslint.ESLint({
15
47
  cwd: cliCommon.targetPaths.dir,
16
- fix: opts.fix,
48
+ fix,
17
49
  extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
18
50
  });
19
51
  const results = await eslint$1.lintFiles(
20
52
  directories.length ? directories : ["."]
21
53
  );
22
- const maxWarnings = opts.maxWarnings ?? -1;
23
- const ignoreWarnings = +maxWarnings === -1;
24
- const failed = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarnings;
25
- if (opts.fix) {
54
+ const maxWarningsNum = maxWarnings ? +maxWarnings : -1;
55
+ const ignoreWarnings = maxWarningsNum === -1;
56
+ const failed = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarningsNum;
57
+ if (fix) {
26
58
  await eslint.ESLint.outputFixes(results);
27
59
  }
28
- const formatter = await eslint$1.loadFormatter(opts.format);
29
- if (opts.format === "eslint-formatter-friendly") {
60
+ const formatter = await eslint$1.loadFormatter(format);
61
+ if (format === "eslint-formatter-friendly") {
30
62
  process.chdir(cliCommon.targetPaths.rootDir);
31
63
  }
32
64
  const resultText = await formatter.format(results);
33
65
  if (resultText) {
34
- if (opts.outputFile) {
35
- await fs__default.default.writeFile(cliCommon.targetPaths.resolve(opts.outputFile), resultText);
66
+ if (outputFile) {
67
+ await fs__default.default.writeFile(cliCommon.targetPaths.resolve(outputFile), resultText);
36
68
  } else {
37
69
  console.log(resultText);
38
70
  }
@@ -1,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var chalk = require('chalk');
4
6
  var fs = require('fs-extra');
7
+ var cleye = require('cleye');
5
8
  var crypto = require('node:crypto');
6
9
  var path = require('node:path');
7
10
  var cliNode = require('@backstage/cli-node');
@@ -18,31 +21,98 @@ function depCount(pkg) {
18
21
  const devDeps = pkg.devDependencies ? Object.keys(pkg.devDependencies).length : 0;
19
22
  return deps + devDeps;
20
23
  }
21
- async function command(opts, cmd) {
24
+ var lint = async ({ args, info }) => {
25
+ for (const flag of [
26
+ "outputFile",
27
+ "successCache",
28
+ "successCacheDir",
29
+ "maxWarnings"
30
+ ]) {
31
+ if (args.some((a) => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
32
+ process.stderr.write(
33
+ `DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead
34
+ `
35
+ );
36
+ }
37
+ }
38
+ const {
39
+ flags: {
40
+ fix,
41
+ format,
42
+ outputFile,
43
+ successCache: useSuccessCache,
44
+ successCacheDir,
45
+ since,
46
+ maxWarnings
47
+ }
48
+ } = cleye.cli(
49
+ {
50
+ help: info,
51
+ booleanFlagNegation: true,
52
+ flags: {
53
+ fix: {
54
+ type: Boolean,
55
+ description: "Attempt to automatically fix violations"
56
+ },
57
+ format: {
58
+ type: String,
59
+ description: "Lint report output format",
60
+ default: "eslint-formatter-friendly"
61
+ },
62
+ outputFile: {
63
+ type: String,
64
+ description: "Write the lint report to a file instead of stdout"
65
+ },
66
+ successCache: {
67
+ type: Boolean,
68
+ description: "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
69
+ },
70
+ successCacheDir: {
71
+ type: String,
72
+ description: "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
73
+ },
74
+ since: {
75
+ type: String,
76
+ description: "Only lint packages that changed since the specified ref"
77
+ },
78
+ maxWarnings: {
79
+ type: String,
80
+ description: "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
81
+ }
82
+ }
83
+ },
84
+ void 0,
85
+ args
86
+ );
22
87
  let packages = await cliNode.PackageGraph.listTargetPackages();
23
88
  const cache = cliNode.SuccessCache.create({
24
89
  name: "lint",
25
- basePath: opts.successCacheDir
90
+ basePath: successCacheDir
26
91
  });
27
- const cacheContext = opts.successCache ? {
92
+ const cacheContext = useSuccessCache ? {
28
93
  entries: await cache.read(),
29
94
  lockfile: await cliNode.Lockfile.load(cliCommon.targetPaths.resolveRoot("yarn.lock"))
30
95
  } : void 0;
31
- if (opts.since) {
96
+ if (since) {
32
97
  const graph = cliNode.PackageGraph.fromPackages(packages);
33
98
  packages = await graph.listChangedPackages({
34
- ref: opts.since,
99
+ ref: since,
35
100
  analyzeLockfile: true
36
101
  });
37
102
  }
38
103
  packages.sort((a, b) => depCount(b.packageJson) - depCount(a.packageJson));
39
- if (opts.format === "eslint-formatter-friendly") {
104
+ if (format === "eslint-formatter-friendly") {
40
105
  process.chdir(cliCommon.targetPaths.rootDir);
41
106
  }
42
107
  if (!process.env.FORCE_COLOR) {
43
108
  process.env.FORCE_COLOR = "1";
44
109
  }
45
- const parseLintScript = optionsParser.createScriptOptionsParser(cmd, ["package", "lint"]);
110
+ const parseLintScript = optionsParser.createScriptOptionsParser(["package", "lint"], {
111
+ fix: { type: "boolean" },
112
+ format: { type: "string" },
113
+ "output-file": { type: "string" },
114
+ "max-warnings": { type: "string" }
115
+ });
46
116
  const items = await Promise.all(
47
117
  packages.map(async (pkg) => {
48
118
  const lintOptions = parseLintScript(pkg.packageJson.scripts?.lint);
@@ -75,20 +145,20 @@ async function command(opts, cmd) {
75
145
  items: items.filter((item) => item.lintOptions),
76
146
  // Filter out packages without lint script
77
147
  context: {
78
- fix: Boolean(opts.fix),
79
- format: opts.format,
148
+ fix: Boolean(fix),
149
+ format,
80
150
  shouldCache: Boolean(cacheContext),
81
- maxWarnings: opts.maxWarnings ?? -1,
151
+ maxWarnings: maxWarnings ?? "-1",
82
152
  successCache: cacheContext?.entries,
83
153
  rootDir: cliCommon.targetPaths.rootDir
84
154
  },
85
155
  workerFactory: async ({
86
- fix,
87
- format,
156
+ fix: workerFix,
157
+ format: workerFormat,
88
158
  shouldCache,
89
159
  successCache,
90
160
  rootDir,
91
- maxWarnings
161
+ maxWarnings: workerMaxWarnings
92
162
  }) => {
93
163
  const { ESLint } = require("eslint");
94
164
  const crypto = require("node:crypto");
@@ -104,7 +174,7 @@ async function command(opts, cmd) {
104
174
  const start = Date.now();
105
175
  const eslint = new ESLint({
106
176
  cwd: fullDir,
107
- fix,
177
+ fix: workerFix,
108
178
  extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
109
179
  });
110
180
  let sha = void 0;
@@ -140,17 +210,17 @@ async function command(opts, cmd) {
140
210
  return { relativeDir, sha, failed: false };
141
211
  }
142
212
  }
143
- const formatter = await eslint.loadFormatter(format);
213
+ const formatter = await eslint.loadFormatter(workerFormat);
144
214
  const results = await eslint.lintFiles(["."]);
145
215
  const count = String(results.length).padStart(3);
146
216
  const time = ((Date.now() - start) / 1e3).toFixed(2);
147
217
  console.log(`Checked ${count} files in ${relativeDir} ${time}s`);
148
- if (fix) {
218
+ if (workerFix) {
149
219
  await ESLint.outputFixes(results);
150
220
  }
151
- const ignoreWarnings = +maxWarnings === -1;
221
+ const ignoreWarnings = +workerMaxWarnings === -1;
152
222
  const resultText = formatter.format(results);
153
- const failed2 = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarnings;
223
+ const failed2 = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > +workerMaxWarnings;
154
224
  return {
155
225
  relativeDir,
156
226
  resultText,
@@ -174,8 +244,8 @@ async function command(opts, cmd) {
174
244
  console.log(chalk__default.default.red(`Lint failed in ${relativeDir}`));
175
245
  failed = true;
176
246
  if (resultText) {
177
- if (opts.outputFile) {
178
- if (opts.format === "json") {
247
+ if (outputFile) {
248
+ if (format === "json") {
179
249
  jsonResults.push(resultText);
180
250
  } else {
181
251
  errorOutput += `${resultText}
@@ -190,15 +260,15 @@ async function command(opts, cmd) {
190
260
  outputSuccessCache.push(sha);
191
261
  }
192
262
  }
193
- if (opts.format === "json") {
263
+ if (format === "json") {
194
264
  let mergedJsonResults = [];
195
265
  for (const jsonResult of jsonResults) {
196
266
  mergedJsonResults = mergedJsonResults.concat(JSON.parse(jsonResult));
197
267
  }
198
268
  errorOutput = JSON.stringify(mergedJsonResults, null, 2);
199
269
  }
200
- if (opts.outputFile && errorOutput) {
201
- await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(opts.outputFile), errorOutput);
270
+ if (outputFile && errorOutput) {
271
+ await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(outputFile), errorOutput);
202
272
  }
203
273
  if (cacheContext) {
204
274
  await cache.write(outputSuccessCache);
@@ -206,7 +276,7 @@ async function command(opts, cmd) {
206
276
  if (failed) {
207
277
  process.exit(1);
208
278
  }
209
- }
279
+ };
210
280
 
211
- exports.command = command;
281
+ exports.default = lint;
212
282
  //# sourceMappingURL=lint.cjs.js.map
@@ -3,80 +3,22 @@
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('../../wiring/lazy.cjs.js');
8
6
 
9
- function registerPackageLintCommand(command) {
10
- command.arguments("[directories...]");
11
- command.option("--fix", "Attempt to automatically fix violations");
12
- command.option(
13
- "--format <format>",
14
- "Lint report output format",
15
- "eslint-formatter-friendly"
16
- );
17
- command.option(
18
- "--output-file <path>",
19
- "Write the lint report to a file instead of stdout"
20
- );
21
- command.option(
22
- "--max-warnings <number>",
23
- "Fail if more than this number of warnings. -1 allows warnings. (default: -1)"
24
- );
25
- command.description("Lint a package");
26
- command.action(lazy.lazy(() => import('./commands/package/lint.cjs.js'), "default"));
27
- }
28
7
  var index = factory.createCliPlugin({
29
8
  pluginId: "lint",
30
9
  init: async (reg) => {
31
10
  reg.addCommand({
32
11
  path: ["package", "lint"],
33
12
  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
- }
13
+ execute: { loader: () => import('./commands/package/lint.cjs.js') }
39
14
  });
40
15
  reg.addCommand({
41
16
  path: ["repo", "lint"],
42
17
  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
- }
18
+ execute: { loader: () => import('./commands/repo/lint.cjs.js') }
76
19
  });
77
20
  }
78
21
  });
79
22
 
80
23
  exports.default = index;
81
- exports.registerPackageLintCommand = registerPackageLintCommand;
82
24
  //# sourceMappingURL=index.cjs.js.map
@@ -1,35 +1,20 @@
1
1
  'use strict';
2
2
 
3
- function createScriptOptionsParser(anyCmd, commandPath) {
4
- let rootCmd = anyCmd;
5
- while (rootCmd.parent) {
6
- rootCmd = rootCmd.parent;
7
- }
8
- let targetCmd = rootCmd;
9
- for (const name of commandPath) {
10
- targetCmd = targetCmd?.commands.find((c) => c.name() === name);
11
- }
12
- if (!targetCmd) {
13
- throw new Error(
14
- `Could not find package command '${commandPath.join(" ")}'`
15
- );
16
- }
17
- const cmd = targetCmd;
3
+ var node_util = require('node:util');
4
+ var shellQuote = require('shell-quote');
5
+
6
+ function createScriptOptionsParser(commandPath, options) {
18
7
  const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
19
8
  return (scriptStr) => {
20
9
  if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
21
10
  return void 0;
22
11
  }
23
12
  const argsStr = scriptStr.slice(expectedScript.length).trim();
24
- const currentOpts = cmd._optionValues;
25
- const currentStore = cmd._storeOptionsAsProperties;
26
- const result = {};
27
- cmd._storeOptionsAsProperties = false;
28
- cmd._optionValues = result;
29
- cmd.parseOptions(argsStr.split(" "));
30
- cmd._optionValues = currentOpts;
31
- cmd._storeOptionsAsProperties = currentStore;
32
- return result;
13
+ const args = argsStr ? shellQuote.parse(argsStr).filter(
14
+ (e) => typeof e === "string"
15
+ ) : [];
16
+ const { values } = node_util.parseArgs({ args, strict: false, options });
17
+ return values;
33
18
  };
34
19
  }
35
20
 
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var cliNode = require('@backstage/cli-node');
6
+ var cleye = require('cleye');
4
7
  var fs = require('fs-extra');
5
8
  var path = require('node:path');
6
9
  var cliCommon = require('@backstage/cli-common');
@@ -361,11 +364,34 @@ function fixPeerModules(pkg) {
361
364
  }
362
365
  }
363
366
  }
364
- async function command(opts) {
367
+ var fix = async ({
368
+ args,
369
+ info
370
+ }) => {
371
+ const {
372
+ flags: { publish, check }
373
+ } = cleye.cli(
374
+ {
375
+ help: info,
376
+ booleanFlagNegation: true,
377
+ flags: {
378
+ publish: {
379
+ type: Boolean,
380
+ description: "Enable additional fixes that only apply when publishing packages"
381
+ },
382
+ check: {
383
+ type: Boolean,
384
+ description: "Fail if any packages would have been changed by the command"
385
+ }
386
+ }
387
+ },
388
+ void 0,
389
+ args
390
+ );
365
391
  const packages = await readFixablePackages();
366
392
  const fixRepositoryField = createRepositoryFieldFixer();
367
393
  const fixers = [fixPackageExports, fixSideEffects];
368
- if (opts.publish) {
394
+ if (publish) {
369
395
  fixers.push(
370
396
  fixRepositoryField,
371
397
  fixPluginId,
@@ -378,17 +404,17 @@ async function command(opts) {
378
404
  fixer(pkg, packages);
379
405
  }
380
406
  }
381
- if (opts.check) {
407
+ if (check) {
382
408
  if (printPackageFixHint(packages)) {
383
409
  process.exit(1);
384
410
  }
385
411
  } else {
386
412
  await writeFixedPackages(packages);
387
413
  }
388
- }
414
+ };
389
415
 
390
- exports.command = command;
391
416
  exports.createRepositoryFieldFixer = createRepositoryFieldFixer;
417
+ exports.default = fix;
392
418
  exports.fixPackageExports = fixPackageExports;
393
419
  exports.fixPeerModules = fixPeerModules;
394
420
  exports.fixPluginId = fixPluginId;
@@ -1,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var chalk = require('chalk');
4
6
  var eslint = require('eslint');
7
+ var cleye = require('cleye');
5
8
  var path = require('node:path');
6
9
  var cliNode = require('@backstage/cli-node');
7
10
  var cliCommon = require('@backstage/cli-common');
@@ -10,7 +13,20 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
10
13
 
11
14
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
12
15
 
13
- async function command(opts) {
16
+ var listDeprecations = async ({ args, info }) => {
17
+ const {
18
+ flags: { json }
19
+ } = cleye.cli(
20
+ {
21
+ help: info,
22
+ booleanFlagNegation: true,
23
+ flags: {
24
+ json: { type: Boolean, description: "Output as JSON" }
25
+ }
26
+ },
27
+ void 0,
28
+ args
29
+ );
14
30
  const packages = await cliNode.PackageGraph.listTargetPackages();
15
31
  const eslint$1 = new eslint.ESLint({
16
32
  cwd: cliCommon.targetPaths.dir,
@@ -56,7 +72,7 @@ async function command(opts) {
56
72
  stderr.clearLine(0);
57
73
  stderr.cursorTo(0);
58
74
  }
59
- if (opts.json) {
75
+ if (json) {
60
76
  console.log(JSON.stringify(deprecations, null, 2));
61
77
  } else {
62
78
  for (const d of deprecations) {
@@ -68,7 +84,7 @@ async function command(opts) {
68
84
  if (deprecations.length > 0) {
69
85
  process.exit(1);
70
86
  }
71
- }
87
+ };
72
88
 
73
- exports.command = command;
89
+ exports.default = listDeprecations;
74
90
  //# sourceMappingURL=list-deprecations.cjs.js.map
@@ -2,9 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var commander = require('commander');
6
5
  var factory = require('../../wiring/factory.cjs.js');
7
- var lazy = require('../../wiring/lazy.cjs.js');
8
6
 
9
7
  var index = factory.createCliPlugin({
10
8
  pluginId: "maintenance",
@@ -12,28 +10,12 @@ var index = factory.createCliPlugin({
12
10
  reg.addCommand({
13
11
  path: ["repo", "fix"],
14
12
  description: "Automatically fix packages in the project",
15
- execute: async ({ args }) => {
16
- const command = new commander.Command();
17
- const defaultCommand = command.option(
18
- "--publish",
19
- "Enable additional fixes that only apply when publishing packages"
20
- ).option(
21
- "--check",
22
- "Fail if any packages would have been changed by the command"
23
- ).action(lazy.lazy(() => import('./commands/repo/fix.cjs.js'), "command"));
24
- await defaultCommand.parseAsync(args, { from: "user" });
25
- }
13
+ execute: { loader: () => import('./commands/repo/fix.cjs.js') }
26
14
  });
27
15
  reg.addCommand({
28
16
  path: ["repo", "list-deprecations"],
29
17
  description: "List deprecations",
30
- execute: async ({ args }) => {
31
- const command = new commander.Command();
32
- const defaultCommand = command.option("--json", "Output as JSON").action(
33
- lazy.lazy(() => import('./commands/repo/list-deprecations.cjs.js'), "command")
34
- );
35
- await defaultCommand.parseAsync(args, { from: "user" });
36
- }
18
+ execute: { loader: () => import('./commands/repo/list-deprecations.cjs.js') }
37
19
  });
38
20
  }
39
21
  });
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var cleye = require('cleye');
6
6
 
7
7
  var packageExports = async ({ args, info }) => {
8
- cleye.cli({ help: info }, void 0, args);
8
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
9
9
  throw new Error(
10
10
  "The `migrate package-exports` command has been removed, use `repo fix` instead."
11
11
  );
@@ -14,7 +14,7 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
14
 
15
15
  const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
16
16
  var packageLintConfigs = async ({ args, info }) => {
17
- cleye.cli({ help: info }, void 0, args);
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
18
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
19
19
  const oldConfigs = [
20
20
  require.resolve("@backstage/cli/config/eslint.js"),
@@ -14,7 +14,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
14
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
15
 
16
16
  var packageRole = async ({ args, info }) => {
17
- cleye.cli({ help: info }, void 0, args);
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
18
18
  const { packages } = await getPackages.getPackages(cliCommon.targetPaths.dir);
19
19
  await Promise.all(
20
20
  packages.map(async ({ dir, packageJson: pkg }) => {
@@ -14,7 +14,7 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
14
  const configArgPattern = /--config[=\s][^\s$]+/;
15
15
  const noStartRoles = ["cli", "common-library"];
16
16
  var packageScripts = async ({ args, info }) => {
17
- cleye.cli({ help: info }, void 0, args);
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
18
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
19
19
  await Promise.all(
20
20
  packages.map(async ({ dir, packageJson }) => {
@@ -14,7 +14,7 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
14
  const REACT_ROUTER_DEPS = ["react-router", "react-router-dom"];
15
15
  const REACT_ROUTER_RANGE = "6.0.0-beta.0 || ^6.3.0";
16
16
  var reactRouterDeps = async ({ args, info }) => {
17
- cleye.cli({ help: info }, void 0, args);
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
18
18
  const packages = await cliNode.PackageGraph.listTargetPackages();
19
19
  await Promise.all(
20
20
  packages.map(async ({ dir, packageJson }) => {