@backstage/cli 0.35.5-next.0 → 0.36.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 (71) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/config/jest.js +2 -2
  3. package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
  4. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  5. package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
  6. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
  7. package/dist/modules/build/commands/repo/build.cjs.js +1 -1
  8. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
  9. package/dist/modules/build/index.cjs.js +37 -4
  10. package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
  11. package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
  12. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
  13. package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
  14. package/dist/modules/build/lib/config.cjs.js +94 -0
  15. package/dist/{lib → modules/build/lib}/optionsParser.cjs.js +2 -2
  16. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
  17. package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
  18. package/dist/modules/config/commands/docs.cjs.js +18 -2
  19. package/dist/modules/config/commands/print.cjs.js +38 -11
  20. package/dist/modules/config/commands/schema.cjs.js +22 -4
  21. package/dist/modules/config/commands/validate.cjs.js +37 -7
  22. package/dist/modules/config/index.cjs.js +6 -65
  23. package/dist/modules/config/lib/config.cjs.js +6 -22
  24. package/dist/modules/create-github-app/index.cjs.js +1 -1
  25. package/dist/modules/info/commands/info.cjs.js +25 -6
  26. package/dist/modules/info/index.cjs.js +1 -23
  27. package/dist/modules/lint/commands/repo/lint.cjs.js +5 -3
  28. package/dist/modules/lint/index.cjs.js +1 -1
  29. package/dist/modules/lint/lib/optionsParser.cjs.js +37 -0
  30. package/dist/modules/maintenance/commands/repo/fix.cjs.js +1 -4
  31. package/dist/modules/maintenance/index.cjs.js +1 -45
  32. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  33. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  34. package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
  35. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  36. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  37. package/dist/modules/migrate/commands/versions/bump.cjs.js +7 -9
  38. package/dist/modules/migrate/index.cjs.js +11 -31
  39. package/dist/modules/new/index.cjs.js +1 -1
  40. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
  41. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +6 -6
  42. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +16 -16
  43. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
  44. package/dist/modules/test/commands/package/test.cjs.js +0 -3
  45. package/dist/modules/test/commands/repo/test.cjs.js +6 -5
  46. package/dist/modules/test/index.cjs.js +1 -1
  47. package/dist/modules/translations/commands/export.cjs.js +24 -1
  48. package/dist/modules/translations/commands/import.cjs.js +24 -1
  49. package/dist/modules/translations/index.cjs.js +2 -37
  50. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  51. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  52. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  53. package/dist/packages/cli/package.json.cjs.js +2 -4
  54. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  55. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  56. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  57. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  58. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  59. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  60. package/dist/wiring/CliInitializer.cjs.js +12 -5
  61. package/dist/wiring/version.cjs.js +20 -0
  62. package/package.json +13 -15
  63. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  64. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  65. package/dist/lib/yarnPlugin.cjs.js +0 -46
  66. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  67. /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
  68. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  69. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  70. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
  71. /package/dist/{lib → wiring}/lazy.cjs.js +0 -0
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var factory = require('../../wiring/factory.cjs.js');
6
6
  var commander = require('commander');
7
- var lazy = require('../../lib/lazy.cjs.js');
7
+ var lazy = require('../../wiring/lazy.cjs.js');
8
8
 
9
9
  var index = factory.createCliPlugin({
10
10
  pluginId: "migrate",
@@ -43,56 +43,36 @@ var index = factory.createCliPlugin({
43
43
  reg.addCommand({
44
44
  path: ["migrate", "package-roles"],
45
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" });
46
+ execute: {
47
+ loader: () => import('./commands/packageRole.cjs.js')
52
48
  }
53
49
  });
54
50
  reg.addCommand({
55
51
  path: ["migrate", "package-scripts"],
56
52
  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" });
53
+ execute: {
54
+ loader: () => import('./commands/packageScripts.cjs.js')
63
55
  }
64
56
  });
65
57
  reg.addCommand({
66
58
  path: ["migrate", "package-exports"],
67
59
  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" });
60
+ execute: {
61
+ loader: () => import('./commands/packageExports.cjs.js')
74
62
  }
75
63
  });
76
64
  reg.addCommand({
77
65
  path: ["migrate", "package-lint-configs"],
78
66
  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" });
67
+ execute: {
68
+ loader: () => import('./commands/packageLintConfigs.cjs.js')
85
69
  }
86
70
  });
87
71
  reg.addCommand({
88
72
  path: ["migrate", "react-router-deps"],
89
73
  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" });
74
+ execute: {
75
+ loader: () => import('./commands/reactRouterDeps.cjs.js')
96
76
  }
97
77
  });
98
78
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var factory = require('../../wiring/factory.cjs.js');
6
6
  var commander = require('commander');
7
- var lazy = require('../../lib/lazy.cjs.js');
7
+ var lazy = require('../../wiring/lazy.cjs.js');
8
8
  var errors = require('@backstage/errors');
9
9
 
10
10
  var index = factory.createCliPlugin({
@@ -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
  {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var z = require('zod');
3
+ var zod = require('zod');
4
4
  var fs = require('fs-extra');
5
5
  var recursiveReaddir = require('recursive-readdir');
6
6
  var path = require('node:path');
@@ -15,11 +15,11 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
15
15
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
16
16
  var recursiveReaddir__default = /*#__PURE__*/_interopDefaultCompat(recursiveReaddir);
17
17
 
18
- const templateDefinitionSchema = z.z.object({
19
- name: z.z.string(),
20
- role: z.z.enum(types.TEMPLATE_ROLES),
21
- description: z.z.string().optional(),
22
- values: z.z.record(z.z.string()).optional()
18
+ const templateDefinitionSchema = zod.z.object({
19
+ name: zod.z.string(),
20
+ role: zod.z.enum(types.TEMPLATE_ROLES),
21
+ description: zod.z.string().optional(),
22
+ values: zod.z.record(zod.z.string()).optional()
23
23
  }).strict();
24
24
  async function loadPortableTemplate(pointer) {
25
25
  if (pointer.target.match(/https?:\/\//)) {
@@ -6,7 +6,7 @@ var cliCommon = require('@backstage/cli-common');
6
6
  var defaultTemplates = require('../defaultTemplates.cjs.js');
7
7
  var types = require('../types.cjs.js');
8
8
  var yaml = require('yaml');
9
- var z = require('zod');
9
+ var zod = require('zod');
10
10
  var v3 = require('zod-validation-error/v3');
11
11
  var errors = require('@backstage/errors');
12
12
 
@@ -22,20 +22,20 @@ const defaults = {
22
22
  packageNamePrefix: "@internal/",
23
23
  packageNamePluginInfix: "plugin-"
24
24
  };
25
- const newConfigSchema = z.z.object({
26
- templates: z.z.array(z.z.string()).optional(),
27
- globals: z.z.object({
28
- license: z.z.string().optional(),
29
- version: z.z.string().optional(),
30
- private: z.z.boolean().optional(),
31
- publishRegistry: z.z.string().optional(),
32
- namePrefix: z.z.string().optional(),
33
- namePluginInfix: z.z.string().optional()
25
+ const newConfigSchema = zod.z.object({
26
+ templates: zod.z.array(zod.z.string()).optional(),
27
+ globals: zod.z.object({
28
+ license: zod.z.string().optional(),
29
+ version: zod.z.string().optional(),
30
+ private: zod.z.boolean().optional(),
31
+ publishRegistry: zod.z.string().optional(),
32
+ namePrefix: zod.z.string().optional(),
33
+ namePluginInfix: zod.z.string().optional()
34
34
  }).optional()
35
35
  }).strict();
36
- const pkgJsonWithNewConfigSchema = z.z.object({
37
- backstage: z.z.object({
38
- cli: z.z.object({
36
+ const pkgJsonWithNewConfigSchema = zod.z.object({
37
+ backstage: zod.z.object({
38
+ cli: zod.z.object({
39
39
  new: newConfigSchema.optional()
40
40
  }).optional()
41
41
  }).optional()
@@ -110,9 +110,9 @@ function resolveLocalTemplatePath(pointer, basePath) {
110
110
  paths: [basePath]
111
111
  });
112
112
  }
113
- const partialTemplateDefinitionSchema = z.z.object({
114
- name: z.z.string(),
115
- description: z.z.string().optional()
113
+ const partialTemplateDefinitionSchema = zod.z.object({
114
+ name: zod.z.string(),
115
+ description: zod.z.string().optional()
116
116
  });
117
117
  async function peekLocalTemplateDefinition(target) {
118
118
  const content = await fs__default.default.readFile(target, "utf8");
@@ -1,37 +1,33 @@
1
1
  'use strict';
2
2
 
3
- var fs = require('fs-extra');
4
3
  var semver = require('semver');
5
- var cliCommon = require('@backstage/cli-common');
6
- var _package$k = require('../packages/backend-plugin-api/package.json.cjs.js');
7
- var _package$j = require('../packages/backend-test-utils/package.json.cjs.js');
8
- var _package$i = require('../packages/catalog-client/package.json.cjs.js');
9
- var _package$h = require('../packages/cli/package.json.cjs.js');
10
- var _package$g = require('../packages/config/package.json.cjs.js');
11
- var _package$f = require('../packages/core-app-api/package.json.cjs.js');
12
- var _package$e = require('../packages/core-components/package.json.cjs.js');
13
- var _package$d = require('../packages/core-plugin-api/package.json.cjs.js');
14
- var _package$c = require('../packages/dev-utils/package.json.cjs.js');
15
- var _package$b = require('../packages/errors/package.json.cjs.js');
16
- var _package$a = require('../packages/frontend-defaults/package.json.cjs.js');
17
- var _package$9 = require('../packages/frontend-plugin-api/package.json.cjs.js');
18
- var _package$8 = require('../packages/frontend-test-utils/package.json.cjs.js');
19
- var _package$7 = require('../packages/test-utils/package.json.cjs.js');
20
- var _package$4 = require('../plugins/scaffolder-node/package.json.cjs.js');
21
- var _package$3 = require('../plugins/scaffolder-node-test-utils/package.json.cjs.js');
22
- var _package$2 = require('../plugins/auth-backend/package.json.cjs.js');
23
- var _package$1 = require('../plugins/auth-backend-module-guest-provider/package.json.cjs.js');
24
- var _package = require('../plugins/catalog-node/package.json.cjs.js');
25
- var _package$6 = require('../packages/theme/package.json.cjs.js');
26
- var _package$5 = require('../packages/types/package.json.cjs.js');
27
- var _package$l = require('../packages/backend-defaults/package.json.cjs.js');
4
+ var _package$k = require('../../../packages/backend-plugin-api/package.json.cjs.js');
5
+ var _package$j = require('../../../packages/backend-test-utils/package.json.cjs.js');
6
+ var _package$i = require('../../../packages/catalog-client/package.json.cjs.js');
7
+ var _package$h = require('../../../packages/cli/package.json.cjs.js');
8
+ var _package$g = require('../../../packages/config/package.json.cjs.js');
9
+ var _package$f = require('../../../packages/core-app-api/package.json.cjs.js');
10
+ var _package$e = require('../../../packages/core-components/package.json.cjs.js');
11
+ var _package$d = require('../../../packages/core-plugin-api/package.json.cjs.js');
12
+ var _package$c = require('../../../packages/dev-utils/package.json.cjs.js');
13
+ var _package$b = require('../../../packages/errors/package.json.cjs.js');
14
+ var _package$a = require('../../../packages/frontend-defaults/package.json.cjs.js');
15
+ var _package$9 = require('../../../packages/frontend-plugin-api/package.json.cjs.js');
16
+ var _package$8 = require('../../../packages/frontend-test-utils/package.json.cjs.js');
17
+ var _package$7 = require('../../../packages/test-utils/package.json.cjs.js');
18
+ var _package$4 = require('../../../plugins/scaffolder-node/package.json.cjs.js');
19
+ var _package$3 = require('../../../plugins/scaffolder-node-test-utils/package.json.cjs.js');
20
+ var _package$2 = require('../../../plugins/auth-backend/package.json.cjs.js');
21
+ var _package$1 = require('../../../plugins/auth-backend-module-guest-provider/package.json.cjs.js');
22
+ var _package = require('../../../plugins/catalog-node/package.json.cjs.js');
23
+ var _package$6 = require('../../../packages/theme/package.json.cjs.js');
24
+ var _package$5 = require('../../../packages/types/package.json.cjs.js');
25
+ var _package$l = require('../../../packages/backend-defaults/package.json.cjs.js');
28
26
 
29
27
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
30
28
 
31
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
32
29
  var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
33
30
 
34
- const ownPaths = cliCommon.findOwnPaths(__dirname);
35
31
  const packageVersions = {
36
32
  "@backstage/backend-defaults": _package$l.version,
37
33
  "@backstage/backend-plugin-api": _package$k.version,
@@ -56,12 +52,6 @@ const packageVersions = {
56
52
  "@backstage/plugin-auth-backend-module-guest-provider": _package$1.version,
57
53
  "@backstage/plugin-catalog-node": _package.version
58
54
  };
59
- function findVersion() {
60
- const pkgContent = fs__default.default.readFileSync(ownPaths.resolve("package.json"), "utf8");
61
- return JSON.parse(pkgContent).version;
62
- }
63
- const version = findVersion();
64
- fs__default.default.pathExistsSync(ownPaths.resolve("src"));
65
55
  function createPackageVersionProvider(lockfile, options) {
66
56
  return (name, versionHint) => {
67
57
  const packageVersion = packageVersions[name];
@@ -97,7 +87,5 @@ function createPackageVersionProvider(lockfile, options) {
97
87
  }
98
88
 
99
89
  exports.createPackageVersionProvider = createPackageVersionProvider;
100
- exports.findVersion = findVersion;
101
90
  exports.packageVersions = packageVersions;
102
- exports.version = version;
103
91
  //# sourceMappingURL=version.cjs.js.map
@@ -45,9 +45,6 @@ var test = async (_opts, cmd) => {
45
45
  if (!process.env.NODE_OPTIONS?.includes("--node-snapshot")) {
46
46
  process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : ""}--no-node-snapshot`;
47
47
  }
48
- if (args.includes("--help")) {
49
- process.stdout._handle.setBlocking(true);
50
- }
51
48
  try {
52
49
  require.resolve("jest");
53
50
  } catch {
@@ -7,7 +7,6 @@ var jestCli = require('jest-cli');
7
7
  var path = require('node:path');
8
8
  var cliNode = require('@backstage/cli-node');
9
9
  var cliCommon = require('@backstage/cli-common');
10
- var SuccessCache = require('../../../../lib/cache/SuccessCache.cjs.js');
11
10
 
12
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
13
12
 
@@ -184,7 +183,6 @@ async function command(opts, cmd) {
184
183
  if (args.includes("--jest-help")) {
185
184
  removeOptionArg(args, "--jest-help");
186
185
  args.push("--help");
187
- process.stdout._handle.setBlocking(true);
188
186
  }
189
187
  if (opts.successCache) {
190
188
  removeOptionArg(args, "--successCache", 1);
@@ -201,7 +199,10 @@ async function command(opts, cmd) {
201
199
  `The --successCache flag can not be combined with the --shard flag`
202
200
  );
203
201
  }
204
- const cache = new SuccessCache.SuccessCache("test", opts.successCacheDir);
202
+ const cache = cliNode.SuccessCache.create({
203
+ name: "test",
204
+ basePath: opts.successCacheDir
205
+ });
205
206
  const graph = await getPackageGraph();
206
207
  const projectHashes = /* @__PURE__ */ new Map();
207
208
  const outputSuccessCache = new Array();
@@ -219,7 +220,7 @@ async function command(opts, cmd) {
219
220
  baseHash.update(process.version);
220
221
  baseHash.update("\0");
221
222
  baseHash.update(
222
- SuccessCache.SuccessCache.trimPaths(JSON.stringify(globalRootConfig))
223
+ cliNode.SuccessCache.trimPaths(JSON.stringify(globalRootConfig))
223
224
  );
224
225
  const baseSha = baseHash.digest("hex");
225
226
  return projectConfigs.filter((project) => {
@@ -238,7 +239,7 @@ async function command(opts, cmd) {
238
239
  const depHash = getPackageTreeHash(depPkg.name);
239
240
  hash.update(`${depName}:${depHash}`);
240
241
  }
241
- hash.update(SuccessCache.SuccessCache.trimPaths(JSON.stringify(project)));
242
+ hash.update(cliNode.SuccessCache.trimPaths(JSON.stringify(project)));
242
243
  hash.update(lockfile.getDependencyTreeHash(packageName));
243
244
  const sha = hash.digest("hex");
244
245
  projectHashes.set(packageName, sha);
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var factory = require('../../wiring/factory.cjs.js');
6
6
  var commander = require('commander');
7
- var lazy = require('../../lib/lazy.cjs.js');
7
+ var lazy = require('../../wiring/lazy.cjs.js');
8
8
 
9
9
  var index = factory.createCliPlugin({
10
10
  pluginId: "test",
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var cliCommon = require('@backstage/cli-common');
6
7
  var fs = require('fs-extra');
7
8
  var path = require('node:path');
@@ -13,7 +14,29 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
13
14
 
14
15
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
16
 
16
- var _export = async (options) => {
17
+ var _export = async ({ args, info }) => {
18
+ const {
19
+ flags: { output, pattern }
20
+ } = cleye.cli(
21
+ {
22
+ help: info,
23
+ flags: {
24
+ output: {
25
+ type: String,
26
+ default: "translations",
27
+ description: "Output directory for exported messages and manifest"
28
+ },
29
+ pattern: {
30
+ type: String,
31
+ default: messageFilePath.DEFAULT_MESSAGE_PATTERN,
32
+ description: "File path pattern for message files, with {id} and {lang} placeholders"
33
+ }
34
+ }
35
+ },
36
+ void 0,
37
+ args
38
+ );
39
+ const options = { output, pattern };
17
40
  messageFilePath.validatePattern(options.pattern);
18
41
  const targetPackageJson = await discoverPackages.readTargetPackage(
19
42
  cliCommon.targetPaths.dir,
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var cliCommon = require('@backstage/cli-common');
6
7
  var fs = require('fs-extra');
7
8
  var path = require('node:path');
@@ -12,7 +13,29 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
12
13
 
13
14
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
15
 
15
- var _import = async (options) => {
16
+ var _import = async ({ args, info }) => {
17
+ const {
18
+ flags: { input, output }
19
+ } = cleye.cli(
20
+ {
21
+ help: info,
22
+ flags: {
23
+ input: {
24
+ type: String,
25
+ default: "translations",
26
+ description: "Input directory containing the manifest and translated message files"
27
+ },
28
+ output: {
29
+ type: String,
30
+ default: "src/translations/resources.ts",
31
+ description: "Output path for the generated wiring module"
32
+ }
33
+ }
34
+ },
35
+ void 0,
36
+ args
37
+ );
38
+ const options = { input, output };
16
39
  await discoverPackages.readTargetPackage(cliCommon.targetPaths.dir, cliCommon.targetPaths.rootDir);
17
40
  const inputDir = path.resolve(cliCommon.targetPaths.dir, options.input);
18
41
  const manifestPath = path.resolve(inputDir, "manifest.json");
@@ -2,14 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var yargs = require('yargs');
6
5
  var factory = require('../../wiring/factory.cjs.js');
7
- var lazy = require('../../lib/lazy.cjs.js');
8
- var messageFilePath = require('./lib/messageFilePath.cjs.js');
9
-
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
-
12
- var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
13
6
 
14
7
  var index = factory.createCliPlugin({
15
8
  pluginId: "translations",
@@ -17,40 +10,12 @@ var index = factory.createCliPlugin({
17
10
  reg.addCommand({
18
11
  path: ["translations", "export"],
19
12
  description: "Export translation messages from an app and all of its frontend plugins to JSON files",
20
- execute: async ({ args }) => {
21
- const argv = await yargs__default.default().options({
22
- output: {
23
- type: "string",
24
- default: "translations",
25
- description: "Output directory for exported messages and manifest"
26
- },
27
- pattern: {
28
- type: "string",
29
- default: messageFilePath.DEFAULT_MESSAGE_PATTERN,
30
- description: "File path pattern for message files, with {id} and {lang} placeholders"
31
- }
32
- }).help().parse(args);
33
- await lazy.lazy(() => import('./commands/export.cjs.js'), "default")(argv);
34
- }
13
+ execute: { loader: () => import('./commands/export.cjs.js') }
35
14
  });
36
15
  reg.addCommand({
37
16
  path: ["translations", "import"],
38
17
  description: "Generate translation resource wiring from translated JSON files",
39
- execute: async ({ args }) => {
40
- const argv = await yargs__default.default().options({
41
- input: {
42
- type: "string",
43
- default: "translations",
44
- description: "Input directory containing the manifest and translated message files"
45
- },
46
- output: {
47
- type: "string",
48
- default: "src/translations/resources.ts",
49
- description: "Output path for the generated wiring module"
50
- }
51
- }).help().parse(args);
52
- await lazy.lazy(() => import('./commands/import.cjs.js'), "default")(argv);
53
- }
18
+ execute: { loader: () => import('./commands/import.cjs.js') }
54
19
  });
55
20
  }
56
21
  });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.15.3-next.0";
3
+ var version = "0.16.0-next.1";
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.11.1-next.0";
3
+ var version = "1.11.1-next.1";
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.13.1-next.0";
3
+ var version = "1.14.0-next.1";
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.35.5-next.0";
3
+ var version = "0.36.0-next.1";
4
4
  var dependencies = {
5
5
  "@backstage/catalog-model": "workspace:^",
6
6
  "@backstage/cli-common": "workspace:^",
@@ -32,12 +32,11 @@ var dependencies = {
32
32
  "@types/webpack-env": "^1.15.2",
33
33
  "@typescript-eslint/eslint-plugin": "^8.17.0",
34
34
  "@typescript-eslint/parser": "^8.16.0",
35
- "@yarnpkg/lockfile": "^1.1.0",
36
- "@yarnpkg/parsers": "^3.0.0",
37
35
  bfj: "^9.0.2",
38
36
  buffer: "^6.0.3",
39
37
  chalk: "^4.0.0",
40
38
  chokidar: "^3.3.1",
39
+ cleye: "^2.2.1",
41
40
  commander: "^14.0.3",
42
41
  "cross-fetch": "^4.0.0",
43
42
  "cross-spawn": "^7.0.3",
@@ -137,7 +136,6 @@ var devDependencies = {
137
136
  "@types/tar": "^6.1.1",
138
137
  "@types/terser-webpack-plugin": "^5.0.4",
139
138
  "@types/webpack-sources": "^3.2.3",
140
- "@types/yarnpkg__lockfile": "^1.1.4",
141
139
  del: "^8.0.0",
142
140
  "esbuild-loader": "^4.0.0",
143
141
  "eslint-webpack-plugin": "^4.2.0",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.1.21-next.0";
3
+ var version = "1.1.21-next.1";
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.5.1-next.0";
3
+ var version = "0.5.1-next.1";
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.27.1-next.0";
3
+ var version = "0.27.1-next.1";
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 = "2.1.0-next.0";
3
+ var version = "2.1.0-next.1";
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.12.6-next.0";
3
+ var version = "0.13.0-next.1";
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.3.9-next.0";
3
+ var version = "0.3.9-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -4,9 +4,9 @@ var CommandGraph = require('./CommandGraph.cjs.js');
4
4
  var types$1 = require('./types.cjs.js');
5
5
  var CommandRegistry = require('./CommandRegistry.cjs.js');
6
6
  var commander = require('commander');
7
- var version = require('../lib/version.cjs.js');
7
+ var version = require('./version.cjs.js');
8
8
  var chalk = require('chalk');
9
- var errors = require('../lib/errors.cjs.js');
9
+ var errors = require('./errors.cjs.js');
10
10
  var errors$1 = require('@backstage/errors');
11
11
  var types = require('node:util/types');
12
12
 
@@ -77,13 +77,20 @@ class CliInitializer {
77
77
  }
78
78
  positionalArgs.push(nonProcessArgs[argIndex]);
79
79
  }
80
- await node.command.execute({
80
+ const context = {
81
81
  args: [...positionalArgs, ...args.unknown],
82
82
  info: {
83
83
  usage: [programName, ...node.command.path].join(" "),
84
84
  description: node.command.description
85
85
  }
86
- });
86
+ };
87
+ if (typeof node.command.execute === "function") {
88
+ await node.command.execute(context);
89
+ } else {
90
+ const mod = await node.command.execute.loader();
91
+ const fn = typeof mod.default === "function" ? mod.default : mod.default.default;
92
+ await fn(context);
93
+ }
87
94
  process.exit(0);
88
95
  } catch (error) {
89
96
  errors.exitWithError(error);
@@ -101,7 +108,7 @@ class CliInitializer {
101
108
  process.on("unhandledRejection", (rejection) => {
102
109
  errors.exitWithError(new errors$1.ForwardedError("Unhandled rejection", rejection));
103
110
  });
104
- program.parse(process.argv);
111
+ await program.parseAsync(process.argv);
105
112
  }
106
113
  }
107
114
  function unwrapFeature(feature) {