@backstage/cli 0.35.4 → 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 (108) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/config/jest.js +2 -2
  3. package/dist/index.cjs.js +1 -0
  4. package/dist/modules/build/commands/package/build/command.cjs.js +7 -7
  5. package/dist/modules/build/commands/package/clean.cjs.js +21 -0
  6. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  7. package/dist/modules/build/commands/package/prepack.cjs.js +29 -0
  8. package/dist/modules/build/commands/package/start/command.cjs.js +3 -3
  9. package/dist/modules/build/commands/package/start/startBackend.cjs.js +2 -2
  10. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +4 -5
  11. package/dist/modules/build/commands/repo/build.cjs.js +7 -8
  12. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +10 -7
  13. package/dist/modules/build/commands/repo/start.cjs.js +3 -3
  14. package/dist/modules/build/index.cjs.js +37 -4
  15. package/dist/modules/build/lib/buildBackend.cjs.js +0 -2
  16. package/dist/modules/build/lib/buildFrontend.cjs.js +3 -6
  17. package/dist/modules/build/lib/builder/config.cjs.js +5 -5
  18. package/dist/modules/build/lib/builder/packager.cjs.js +7 -8
  19. package/dist/modules/build/lib/bundler/config.cjs.js +2 -3
  20. package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +2 -2
  21. package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +2 -2
  22. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +3 -3
  23. package/dist/modules/build/lib/bundler/packageDetection.cjs.js +2 -2
  24. package/dist/modules/build/lib/bundler/paths.cjs.js +8 -6
  25. package/dist/modules/build/lib/bundler/server.cjs.js +11 -11
  26. package/dist/modules/build/lib/config.cjs.js +94 -0
  27. package/dist/{lib → modules/build/lib}/optionsParser.cjs.js +2 -2
  28. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +10 -10
  29. package/dist/modules/build/lib/packager/productionPack.cjs.js +2 -2
  30. package/dist/{lib → modules/build/lib}/role.cjs.js +2 -2
  31. package/dist/modules/build/lib/runner/runBackend.cjs.js +2 -2
  32. package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +2 -2
  33. package/dist/modules/config/commands/docs.cjs.js +18 -2
  34. package/dist/modules/config/commands/print.cjs.js +38 -11
  35. package/dist/modules/config/commands/schema.cjs.js +22 -4
  36. package/dist/modules/config/commands/validate.cjs.js +37 -7
  37. package/dist/modules/config/index.cjs.js +6 -65
  38. package/dist/modules/config/lib/config.cjs.js +10 -26
  39. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +2 -2
  40. package/dist/modules/create-github-app/index.cjs.js +1 -1
  41. package/dist/modules/info/commands/info.cjs.js +29 -11
  42. package/dist/modules/info/index.cjs.js +1 -23
  43. package/dist/modules/lint/commands/package/lint.cjs.js +4 -4
  44. package/dist/modules/lint/commands/repo/lint.cjs.js +13 -12
  45. package/dist/modules/lint/index.cjs.js +1 -1
  46. package/dist/modules/lint/lib/optionsParser.cjs.js +37 -0
  47. package/dist/modules/maintenance/commands/repo/fix.cjs.js +8 -11
  48. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +4 -4
  49. package/dist/modules/maintenance/index.cjs.js +1 -45
  50. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  51. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  52. package/dist/modules/migrate/commands/packageRole.cjs.js +5 -3
  53. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  54. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  55. package/dist/modules/migrate/commands/versions/bump.cjs.js +15 -18
  56. package/dist/modules/migrate/index.cjs.js +11 -31
  57. package/dist/modules/new/index.cjs.js +1 -1
  58. package/dist/modules/new/lib/codeowners/codeowners.cjs.js +2 -2
  59. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +6 -11
  60. package/dist/modules/new/lib/execution/installNewPackage.cjs.js +4 -4
  61. package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +1 -2
  62. package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +2 -2
  63. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
  64. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
  65. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -33
  66. package/dist/modules/test/commands/package/test.cjs.js +1 -5
  67. package/dist/modules/test/commands/repo/test.cjs.js +9 -9
  68. package/dist/modules/test/index.cjs.js +4 -2
  69. package/dist/modules/translations/commands/export.cjs.js +127 -0
  70. package/dist/modules/translations/commands/import.cjs.js +164 -0
  71. package/dist/modules/translations/index.cjs.js +24 -0
  72. package/dist/modules/translations/lib/discoverPackages.cjs.js +121 -0
  73. package/dist/modules/translations/lib/extractTranslations.cjs.js +71 -0
  74. package/dist/modules/translations/lib/messageFilePath.cjs.js +43 -0
  75. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  76. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  77. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  78. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  79. package/dist/packages/cli/package.json.cjs.js +6 -8
  80. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  81. package/dist/packages/core-components/package.json.cjs.js +1 -1
  82. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  83. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  84. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  85. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  86. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  87. package/dist/packages/test-utils/package.json.cjs.js +1 -1
  88. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  89. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  90. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  91. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  92. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  93. package/dist/wiring/CliInitializer.cjs.js +12 -5
  94. package/dist/wiring/version.cjs.js +20 -0
  95. package/package.json +34 -36
  96. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  97. package/dist/lib/parallel.cjs.js +0 -141
  98. package/dist/lib/paths.cjs.js +0 -8
  99. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  100. package/dist/lib/yarnPlugin.cjs.js +0 -46
  101. package/dist/modules/maintenance/commands/package/clean.cjs.js +0 -19
  102. package/dist/modules/maintenance/commands/package/pack.cjs.js +0 -29
  103. /package/dist/{lib → modules/build/lib}/entryPoints.cjs.js +0 -0
  104. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  105. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  106. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  107. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
  108. /package/dist/{lib → wiring}/lazy.cjs.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @backstage/cli
2
2
 
3
+ ## 0.36.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - b36a60d: **BREAKING**: The `migrate package-exports` command has been removed. Use `repo fix` instead.
8
+
9
+ ### Patch Changes
10
+
11
+ - 0d2d0f2: Internal refactor of CLI modularization, moving individual commands to be implemented with cleye.
12
+ - 2fcba39: Internal refactor to move shared utilities into their consuming modules, reducing cross-module dependencies.
13
+ - c85ac86: Internal refactor to split `loadCliConfig` into separate implementations for the build and config CLI modules, removing a cross-module dependency.
14
+ - 61cb976: Migrated internal versioning utilities to use `@backstage/cli-node` instead of a local implementation.
15
+ - 825c81d: Internal refactor of CLI command modules.
16
+ - a9d23c4: Properly support `package.json` `workspaces` field
17
+ - Updated dependencies
18
+ - @backstage/cli-common@0.2.0-next.1
19
+ - @backstage/cli-node@0.2.19-next.1
20
+ - @backstage/module-federation-common@0.1.2-next.0
21
+ - @backstage/integration@2.0.0-next.1
22
+ - @backstage/catalog-model@1.7.6
23
+ - @backstage/config@1.3.6
24
+ - @backstage/config-loader@1.10.9-next.0
25
+ - @backstage/errors@1.2.7
26
+ - @backstage/eslint-plugin@0.2.2-next.0
27
+ - @backstage/release-manifests@0.0.13
28
+ - @backstage/types@1.2.2
29
+
30
+ ## 0.35.5-next.0
31
+
32
+ ### Patch Changes
33
+
34
+ - 246877a: Updated dependency `bfj` to `^9.0.2`.
35
+ - bba2e49: Internal refactor to use new concurrency utilities from `@backstage/cli-node`.
36
+ - fd50cb3: Added `translations export` and `translations import` commands for managing translation files.
37
+
38
+ The `translations export` command discovers all `TranslationRef` definitions across frontend plugin dependencies and exports their default messages as JSON files. The `translations import` command generates `TranslationResource` wiring code from translated JSON files, ready to be plugged into the app.
39
+
40
+ Both commands support a `--pattern` option for controlling the message file layout, for example `--pattern '{lang}/{id}.json'` for language-based directory grouping.
41
+
42
+ - 6738cf0: build(deps): bump `minimatch` from 9.0.5 to 10.2.1
43
+ - 70fc178: Migrated from deprecated `findPaths` to `targetPaths` and `findOwnPaths` from `@backstage/cli-common`.
44
+ - de62a9d: Upgraded `commander` dependency from `^12.0.0` to `^14.0.3` across all CLI packages.
45
+ - 092b41f: Updated dependency `webpack` to `~5.105.0`.
46
+ - Updated dependencies
47
+ - @backstage/cli-common@0.2.0-next.0
48
+ - @backstage/cli-node@0.2.19-next.0
49
+ - @backstage/eslint-plugin@0.2.2-next.0
50
+ - @backstage/integration@1.21.0-next.0
51
+ - @backstage/config-loader@1.10.9-next.0
52
+ - @backstage/catalog-model@1.7.6
53
+ - @backstage/config@1.3.6
54
+ - @backstage/errors@1.2.7
55
+ - @backstage/module-federation-common@0.1.0
56
+ - @backstage/release-manifests@0.0.13
57
+ - @backstage/types@1.2.2
58
+
3
59
  ## 0.35.4
4
60
 
5
61
  ### Patch Changes
package/config/jest.js CHANGED
@@ -336,8 +336,8 @@ async function getRootConfig() {
336
336
  rejectFrontendNetworkRequests,
337
337
  };
338
338
 
339
- const workspacePatterns =
340
- rootPkgJson.workspaces && rootPkgJson.workspaces.packages;
339
+ const ws = rootPkgJson.workspaces;
340
+ const workspacePatterns = Array.isArray(ws) ? ws : ws?.packages;
341
341
 
342
342
  // Check if we're running within a specific monorepo package. In that case just get the single project config.
343
343
  if (!workspacePatterns || paths.targetRoot !== paths.targetDir) {
package/dist/index.cjs.js CHANGED
@@ -13,6 +13,7 @@ var CliInitializer = require('./wiring/CliInitializer.cjs.js');
13
13
  initializer.add(import('./modules/migrate/index.cjs.js'));
14
14
  initializer.add(import('./modules/new/index.cjs.js'));
15
15
  initializer.add(import('./modules/test/index.cjs.js'));
16
+ initializer.add(import('./modules/translations/index.cjs.js'));
16
17
  await initializer.run();
17
18
  })();
18
19
  //# sourceMappingURL=index.cjs.js.map
@@ -3,9 +3,9 @@
3
3
  var fs = require('fs-extra');
4
4
  var packager = require('../../../lib/builder/packager.cjs.js');
5
5
  var types = require('../../../lib/builder/types.cjs.js');
6
- var role = require('../../../../../lib/role.cjs.js');
6
+ var role = require('../../../lib/role.cjs.js');
7
7
  var cliNode = require('@backstage/cli-node');
8
- var paths = require('../../../../../lib/paths.cjs.js');
8
+ var cliCommon = require('@backstage/cli-common');
9
9
  var buildFrontend = require('../../../lib/buildFrontend.cjs.js');
10
10
  var buildBackend = require('../../../lib/buildBackend.cjs.js');
11
11
  var urls = require('../../../lib/urls.cjs.js');
@@ -24,18 +24,18 @@ async function command(opts) {
24
24
  if (urls.isValidUrl(arg)) {
25
25
  return arg;
26
26
  }
27
- return paths.paths.resolveTarget(arg);
27
+ return cliCommon.targetPaths.resolve(arg);
28
28
  });
29
29
  if (role$1 === "frontend") {
30
30
  return buildFrontend.buildFrontend({
31
- targetDir: paths.paths.targetDir,
31
+ targetDir: cliCommon.targetPaths.dir,
32
32
  configPaths,
33
33
  writeStats: Boolean(opts.stats),
34
34
  webpack
35
35
  });
36
36
  }
37
37
  return buildBackend.buildBackend({
38
- targetDir: paths.paths.targetDir,
38
+ targetDir: cliCommon.targetPaths.dir,
39
39
  configPaths,
40
40
  skipBuildDependencies: Boolean(opts.skipBuildDependencies),
41
41
  minify: Boolean(opts.minify)
@@ -56,7 +56,7 @@ async function command(opts) {
56
56
  if (isModuleFederationRemote) {
57
57
  console.log("Building package as a module federation remote");
58
58
  return buildFrontend.buildFrontend({
59
- targetDir: paths.paths.targetDir,
59
+ targetDir: cliCommon.targetPaths.dir,
60
60
  configPaths: [],
61
61
  writeStats: Boolean(opts.stats),
62
62
  isModuleFederationRemote,
@@ -75,7 +75,7 @@ async function command(opts) {
75
75
  outputs.add(types.Output.types);
76
76
  }
77
77
  const packageJson = await fs__default.default.readJson(
78
- paths.paths.resolveTarget("package.json")
78
+ cliCommon.targetPaths.resolve("package.json")
79
79
  );
80
80
  return packager.buildPackage({
81
81
  outputs,
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
6
+ var fs = require('fs-extra');
7
+ var cliCommon = require('@backstage/cli-common');
8
+
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
+
11
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
+
13
+ var clean = async ({ args, info }) => {
14
+ cleye.cli({ help: info }, void 0, args);
15
+ await fs__default.default.remove(cliCommon.targetPaths.resolve("dist"));
16
+ await fs__default.default.remove(cliCommon.targetPaths.resolve("dist-types"));
17
+ await fs__default.default.remove(cliCommon.targetPaths.resolve("coverage"));
18
+ };
19
+
20
+ exports.default = clean;
21
+ //# sourceMappingURL=clean.cjs.js.map
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
6
+ var cliCommon = require('@backstage/cli-common');
7
+ var productionPack = require('../../lib/packager/productionPack.cjs.js');
8
+
9
+ var postpack = async ({ args, info }) => {
10
+ cleye.cli({ help: info }, void 0, args);
11
+ await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
12
+ };
13
+
14
+ exports.default = postpack;
15
+ //# sourceMappingURL=postpack.cjs.js.map
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
6
+ var fs = require('fs-extra');
7
+ var cliCommon = require('@backstage/cli-common');
8
+ var productionPack = require('../../lib/packager/productionPack.cjs.js');
9
+ var publishing = require('../../lib/publishing.cjs.js');
10
+ var typeDistProject = require('../../lib/typeDistProject.cjs.js');
11
+
12
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
13
+
14
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
+
16
+ var prepack = async ({ args, info }) => {
17
+ cleye.cli({ help: info }, void 0, args);
18
+ publishing.publishPreflightCheck({
19
+ dir: cliCommon.targetPaths.dir,
20
+ packageJson: await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"))
21
+ });
22
+ await productionPack.productionPack({
23
+ packageDir: cliCommon.targetPaths.dir,
24
+ featureDetectionProject: await typeDistProject.createTypeDistProject()
25
+ });
26
+ };
27
+
28
+ exports.default = prepack;
29
+ //# sourceMappingURL=prepack.cjs.js.map
@@ -2,14 +2,14 @@
2
2
 
3
3
  var startPackage = require('./startPackage.cjs.js');
4
4
  var resolveLinkedWorkspace = require('./resolveLinkedWorkspace.cjs.js');
5
- var role = require('../../../../../lib/role.cjs.js');
6
- var paths = require('../../../../../lib/paths.cjs.js');
5
+ var role = require('../../../lib/role.cjs.js');
6
+ var cliCommon = require('@backstage/cli-common');
7
7
 
8
8
  async function command(opts) {
9
9
  await startPackage.startPackage({
10
10
  role: await role.findRoleFromCommand(opts),
11
11
  entrypoint: opts.entrypoint,
12
- targetDir: paths.paths.targetDir,
12
+ targetDir: cliCommon.targetPaths.dir,
13
13
  configPaths: opts.config,
14
14
  checksEnabled: Boolean(opts.check),
15
15
  linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(opts.link),
@@ -2,7 +2,7 @@
2
2
 
3
3
  var fs = require('fs-extra');
4
4
  var path = require('node:path');
5
- var paths = require('../../../../../lib/paths.cjs.js');
5
+ var cliCommon = require('@backstage/cli-common');
6
6
  var runBackend = require('../../../lib/runner/runBackend.cjs.js');
7
7
 
8
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -22,7 +22,7 @@ async function startBackend(options) {
22
22
  }
23
23
  async function startBackendPlugin(options) {
24
24
  const hasDevIndexEntry = await fs__default.default.pathExists(
25
- path.resolve(options.targetDir ?? paths.paths.targetDir, "dev/index.ts")
25
+ path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "dev/index.ts")
26
26
  );
27
27
  if (!hasDevIndexEntry) {
28
28
  console.warn(
@@ -11,10 +11,9 @@ require('ts-checker-rspack-plugin');
11
11
  require('html-webpack-plugin');
12
12
  require('react-dev-utils/ModuleScopePlugin');
13
13
  require('@module-federation/enhanced/rspack');
14
- var paths = require('../../../../../lib/paths.cjs.js');
15
14
  require('lodash/pickBy');
16
- require('@backstage/cli-common');
17
- require('../../../../../lib/version.cjs.js');
15
+ var cliCommon = require('@backstage/cli-common');
16
+ require('../../../../../wiring/version.cjs.js');
18
17
  var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
19
18
  require('@manypkg/get-packages');
20
19
  require('chalk');
@@ -24,7 +23,7 @@ var server = require('../../../lib/bundler/server.cjs.js');
24
23
 
25
24
  async function startFrontend(options) {
26
25
  const packageJson = await fs.readJson(
27
- path.resolve(options.targetDir ?? paths.paths.targetDir, "package.json")
26
+ path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "package.json")
28
27
  );
29
28
  if (!hasReactDomClient.hasReactDomClient()) {
30
29
  console.warn(
@@ -41,7 +40,7 @@ async function startFrontend(options) {
41
40
  linkedWorkspace: options.linkedWorkspace,
42
41
  moduleFederationRemote: options.isModuleFederationRemote ? await moduleFederation.getModuleFederationRemoteOptions(
43
42
  packageJson,
44
- path.resolve(paths.paths.targetDir)
43
+ path.resolve(cliCommon.targetPaths.dir)
45
44
  ) : void 0
46
45
  });
47
46
  await waitForExit();
@@ -3,12 +3,11 @@
3
3
  var chalk = require('chalk');
4
4
  var path = require('node:path');
5
5
  var packager = require('../../lib/builder/packager.cjs.js');
6
- var paths = require('../../../../lib/paths.cjs.js');
6
+ var cliCommon = require('@backstage/cli-common');
7
7
  var cliNode = require('@backstage/cli-node');
8
- var parallel = require('../../../../lib/parallel.cjs.js');
9
8
  var buildFrontend = require('../../lib/buildFrontend.cjs.js');
10
9
  var buildBackend = require('../../lib/buildBackend.cjs.js');
11
- var optionsParser = require('../../../../lib/optionsParser.cjs.js');
10
+ var optionsParser = require('../../lib/optionsParser.cjs.js');
12
11
 
13
12
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
13
 
@@ -61,7 +60,7 @@ async function command(opts, cmd) {
61
60
  targetDir: pkg.dir,
62
61
  packageJson: pkg.packageJson,
63
62
  outputs,
64
- logPrefix: `${chalk__default.default.cyan(path.relative(paths.paths.targetRoot, pkg.dir))}: `,
63
+ logPrefix: `${chalk__default.default.cyan(path.relative(cliCommon.targetPaths.rootDir, pkg.dir))}: `,
65
64
  workspacePackages: packages,
66
65
  minify: opts.minify ?? buildOptions.minify
67
66
  };
@@ -70,9 +69,9 @@ async function command(opts, cmd) {
70
69
  await packager.buildPackages(options);
71
70
  if (opts.all) {
72
71
  console.log("Building apps");
73
- await parallel.runParallelWorkers({
72
+ await cliNode.runConcurrentTasks({
74
73
  items: apps,
75
- parallelismFactor: 1 / 2,
74
+ concurrencyFactor: 1 / 2,
76
75
  worker: async (pkg) => {
77
76
  const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
78
77
  if (!buildOptions) {
@@ -90,9 +89,9 @@ async function command(opts, cmd) {
90
89
  }
91
90
  });
92
91
  console.log("Building backends");
93
- await parallel.runParallelWorkers({
92
+ await cliNode.runConcurrentTasks({
94
93
  items: backends,
95
- parallelismFactor: 1 / 2,
94
+ concurrencyFactor: 1 / 2,
96
95
  worker: async (pkg) => {
97
96
  const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
98
97
  if (!buildOptions) {
@@ -1,20 +1,23 @@
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');
6
- var paths = require('../../../../lib/paths.cjs.js');
7
9
  var cliCommon = require('@backstage/cli-common');
8
10
 
9
11
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
12
 
11
13
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
14
 
13
- async function command() {
15
+ var clean = async ({ args, info }) => {
16
+ cleye.cli({ help: info }, void 0, args);
14
17
  const packages = await cliNode.PackageGraph.listTargetPackages();
15
- await fs__default.default.remove(paths.paths.resolveTargetRoot("dist"));
16
- await fs__default.default.remove(paths.paths.resolveTargetRoot("dist-types"));
17
- await fs__default.default.remove(paths.paths.resolveTargetRoot("coverage"));
18
+ await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist"));
19
+ await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist-types"));
20
+ await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("coverage"));
18
21
  await Promise.all(
19
22
  Array.from(Array(10), async () => {
20
23
  while (packages.length > 0) {
@@ -32,7 +35,7 @@ async function command() {
32
35
  }
33
36
  })
34
37
  );
35
- }
38
+ };
36
39
 
37
- exports.command = command;
40
+ exports.default = clean;
38
41
  //# sourceMappingURL=clean.cjs.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  var cliNode = require('@backstage/cli-node');
4
4
  var path = require('node:path');
5
- var paths = require('../../../../lib/paths.cjs.js');
5
+ var cliCommon = require('@backstage/cli-common');
6
6
  var resolveLinkedWorkspace = require('../package/start/resolveLinkedWorkspace.cjs.js');
7
7
  var startPackage = require('../package/start/startPackage.cjs.js');
8
8
  var node_util = require('node:util');
@@ -47,7 +47,7 @@ async function findTargetPackages(namesOrPaths, pluginIds) {
47
47
  (pkg) => nameOrPath === pkg.packageJson.name
48
48
  );
49
49
  if (!matchingPackage) {
50
- const absPath = paths.paths.resolveTargetRoot(nameOrPath);
50
+ const absPath = cliCommon.targetPaths.resolveRoot(nameOrPath);
51
51
  matchingPackage = packages.find(
52
52
  (pkg) => path.relative(pkg.dir, absPath) === ""
53
53
  );
@@ -65,7 +65,7 @@ async function findTargetPackages(namesOrPaths, pluginIds) {
65
65
  (pkg) => pkg.packageJson.backstage?.role === role
66
66
  );
67
67
  if (matchingPackages.length > 1) {
68
- const expectedPath = paths.paths.resolveTargetRoot(
68
+ const expectedPath = cliCommon.targetPaths.resolveRoot(
69
69
  role === "frontend" ? "packages/app" : "packages/backend"
70
70
  );
71
71
  const matchByPath = matchingPackages.find(
@@ -4,9 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var commander = require('commander');
6
6
  var factory = require('../../wiring/factory.cjs.js');
7
- var lazy = require('../../lib/lazy.cjs.js');
8
- var index = require('../config/index.cjs.js');
7
+ var lazy = require('../../wiring/lazy.cjs.js');
9
8
 
9
+ const configOption = [
10
+ "--config <path>",
11
+ "Config files to load instead of app-config.yaml",
12
+ (opt, opts) => opts ? [...opts, opt] : [opt],
13
+ Array()
14
+ ];
10
15
  function registerPackageCommands(command) {
11
16
  command.command("build").description("Build a package for production deployment or publishing").option("--role <name>", "Run the command with an explicit package role").option(
12
17
  "--minify",
@@ -83,7 +88,7 @@ const buildPlugin = factory.createCliPlugin({
83
88
  description: "Start a package for local development",
84
89
  execute: async ({ args }) => {
85
90
  const command = new commander.Command();
86
- const defaultCommand = command.option(...index.configOption).option(
91
+ const defaultCommand = command.option(...configOption).option(
87
92
  "--role <name>",
88
93
  "Run the command with an explicit package role"
89
94
  ).option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
@@ -115,7 +120,7 @@ const buildPlugin = factory.createCliPlugin({
115
120
  "Start the dev entry-point for any matching plugin package in the repo",
116
121
  (opt, opts) => opts ? [...opts, opt] : [opt],
117
122
  Array()
118
- ).option(...index.configOption).option(
123
+ ).option(...configOption).option(
119
124
  "--inspect [host]",
120
125
  "Enable debugger in Node.js environments. Applies to backend package only"
121
126
  ).option(
@@ -133,6 +138,34 @@ const buildPlugin = factory.createCliPlugin({
133
138
  await defaultCommand.parseAsync(args, { from: "user" });
134
139
  }
135
140
  });
141
+ reg.addCommand({
142
+ path: ["package", "clean"],
143
+ description: "Delete cache directories",
144
+ execute: {
145
+ loader: () => import('./commands/package/clean.cjs.js')
146
+ }
147
+ });
148
+ reg.addCommand({
149
+ path: ["package", "prepack"],
150
+ description: "Prepares a package for packaging before publishing",
151
+ execute: {
152
+ loader: () => import('./commands/package/prepack.cjs.js')
153
+ }
154
+ });
155
+ reg.addCommand({
156
+ path: ["package", "postpack"],
157
+ description: "Restores the changes made by the prepack command",
158
+ execute: {
159
+ loader: () => import('./commands/package/postpack.cjs.js')
160
+ }
161
+ });
162
+ reg.addCommand({
163
+ path: ["repo", "clean"],
164
+ description: "Delete cache and output directories",
165
+ execute: {
166
+ loader: () => import('./commands/repo/clean.cjs.js')
167
+ }
168
+ });
136
169
  reg.addCommand({
137
170
  path: ["build-workspace"],
138
171
  description: "Builds a temporary dist workspace from the provided packages",
@@ -5,7 +5,6 @@ var fs = require('fs-extra');
5
5
  var path = require('node:path');
6
6
  var tar = require('tar');
7
7
  var createDistWorkspace = require('./packager/createDistWorkspace.cjs.js');
8
- var parallel = require('../../../lib/parallel.cjs.js');
9
8
  var packager = require('./builder/packager.cjs.js');
10
9
  var types = require('./builder/types.cjs.js');
11
10
  var cliNode = require('@backstage/cli-node');
@@ -53,7 +52,6 @@ async function buildBackend(options) {
53
52
  configPaths,
54
53
  buildDependencies: !skipBuildDependencies,
55
54
  buildExcludes: [pkg.name],
56
- parallelism: parallel.getEnvironmentParallelism(),
57
55
  skeleton: SKELETON_FILE,
58
56
  minify
59
57
  });
@@ -8,20 +8,18 @@ require('chalk');
8
8
  require('react-dev-utils/openBrowser');
9
9
  require('@rspack/core');
10
10
  require('@rspack/dev-server');
11
- require('../../../lib/paths.cjs.js');
12
- var config = require('../../config/lib/config.cjs.js');
11
+ require('@backstage/cli-common');
12
+ var config = require('./config.cjs.js');
13
13
  require('eslint-rspack-plugin');
14
14
  require('ts-checker-rspack-plugin');
15
15
  require('html-webpack-plugin');
16
16
  require('react-dev-utils/ModuleScopePlugin');
17
17
  require('@module-federation/enhanced/rspack');
18
18
  require('lodash/pickBy');
19
- require('@backstage/cli-common');
20
- require('../../../lib/version.cjs.js');
19
+ require('../../../wiring/version.cjs.js');
21
20
  require('yn');
22
21
  require('@manypkg/get-packages');
23
22
  require('./bundler/packageDetection.cjs.js');
24
- var parallel = require('../../../lib/parallel.cjs.js');
25
23
 
26
24
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
27
25
 
@@ -35,7 +33,6 @@ async function buildFrontend(options) {
35
33
  await bundle.buildBundle({
36
34
  targetDir,
37
35
  entry: "src/index",
38
- parallelism: parallel.getEnvironmentParallelism(),
39
36
  statsJsonEnabled: writeStats,
40
37
  moduleFederationRemote: options.isModuleFederationRemote ? await moduleFederation.getModuleFederationRemoteOptions(
41
38
  packageJson,
@@ -13,8 +13,8 @@ var json = require('@rollup/plugin-json');
13
13
  var yaml = require('@rollup/plugin-yaml');
14
14
  var plugins = require('./plugins.cjs.js');
15
15
  var types = require('./types.cjs.js');
16
- var paths = require('../../../../lib/paths.cjs.js');
17
- var entryPoints = require('../../../../lib/entryPoints.cjs.js');
16
+ var cliCommon = require('@backstage/cli-common');
17
+ var entryPoints = require('../entryPoints.cjs.js');
18
18
 
19
19
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
20
20
 
@@ -85,7 +85,7 @@ function multiOutputFormat() {
85
85
  }
86
86
  async function makeRollupConfigs(options) {
87
87
  const configs = new Array();
88
- const targetDir = options.targetDir ?? paths.paths.targetDir;
88
+ const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
89
89
  let targetPkg = options.packageJson;
90
90
  if (!targetPkg) {
91
91
  const packagePath = path.resolve(targetDir, "package.json");
@@ -219,9 +219,9 @@ async function makeRollupConfigs(options) {
219
219
  const input = Object.fromEntries(
220
220
  scriptEntryPoints.map((e) => [
221
221
  e.name,
222
- paths.paths.resolveTargetRoot(
222
+ cliCommon.targetPaths.resolveRoot(
223
223
  "dist-types",
224
- path.relative(paths.paths.targetRoot, targetDir),
224
+ path.relative(cliCommon.targetPaths.rootDir, targetDir),
225
225
  e.path.replace(/\.(?:ts|tsx)$/, ".d.ts")
226
226
  )
227
227
  ])
@@ -4,11 +4,10 @@ var fs = require('fs-extra');
4
4
  var rollup = require('rollup');
5
5
  var chalk = require('chalk');
6
6
  var path = require('node:path');
7
- var paths = require('../../../../lib/paths.cjs.js');
7
+ var cliCommon = require('@backstage/cli-common');
8
8
  var config = require('./config.cjs.js');
9
9
  var types = require('./types.cjs.js');
10
10
  var cliNode = require('@backstage/cli-node');
11
- var parallel = require('../../../../lib/parallel.cjs.js');
12
11
 
13
12
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
13
 
@@ -26,7 +25,7 @@ function formatErrorMessage(error) {
26
25
  `;
27
26
  for (const { text, location } of error.errors) {
28
27
  const { line, column } = location;
29
- const path$1 = path.relative(paths.paths.targetDir, error.id);
28
+ const path$1 = path.relative(cliCommon.targetPaths.dir, error.id);
30
29
  const loc = chalk__default.default.cyan(`${path$1}:${line}:${column}`);
31
30
  if (text === 'Unexpected "<"' && error.id.endsWith(".js")) {
32
31
  msg += `${loc}: ${text}, JavaScript files with JSX should use a .jsx extension`;
@@ -41,12 +40,12 @@ function formatErrorMessage(error) {
41
40
  }
42
41
  } else {
43
42
  if (error.loc) {
44
- const file = `${paths.paths.resolveTarget(error.loc.file || error.id)}`;
43
+ const file = `${cliCommon.targetPaths.resolve(error.loc.file || error.id)}`;
45
44
  const pos = `${error.loc.line}:${error.loc.column}`;
46
45
  msg += `${file} [${pos}]
47
46
  `;
48
47
  } else if (error.id) {
49
- msg += `${paths.paths.resolveTarget(error.id)}
48
+ msg += `${cliCommon.targetPaths.resolve(error.id)}
50
49
  `;
51
50
  }
52
51
  msg += `${error}
@@ -78,7 +77,7 @@ async function rollupBuild(config) {
78
77
  const buildPackage = async (options) => {
79
78
  try {
80
79
  const { resolutions } = await fs__default.default.readJson(
81
- paths.paths.resolveTargetRoot("package.json")
80
+ cliCommon.targetPaths.resolveRoot("package.json")
82
81
  );
83
82
  if (resolutions?.esbuild) {
84
83
  console.warn(
@@ -90,7 +89,7 @@ const buildPackage = async (options) => {
90
89
  } catch {
91
90
  }
92
91
  const rollupConfigs = await config.makeRollupConfigs(options);
93
- const targetDir = options.targetDir ?? paths.paths.targetDir;
92
+ const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
94
93
  await fs__default.default.remove(path.resolve(targetDir, "dist"));
95
94
  const buildTasks = rollupConfigs.map(rollupBuild);
96
95
  await Promise.all(buildTasks);
@@ -104,7 +103,7 @@ const buildPackages = async (options) => {
104
103
  options.map(({ targetDir }) => fs__default.default.remove(path.resolve(targetDir, "dist")))
105
104
  );
106
105
  const buildTasks = rollupConfigs.flat().map((opts) => () => rollupBuild(opts));
107
- await parallel.runParallelWorkers({
106
+ await cliNode.runConcurrentTasks({
108
107
  items: buildTasks,
109
108
  worker: async (task) => task()
110
109
  });
@@ -7,13 +7,12 @@ var tsCheckerRspackPlugin = require('ts-checker-rspack-plugin');
7
7
  var HtmlWebpackPlugin = require('html-webpack-plugin');
8
8
  var ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
9
9
  var rspack = require('@module-federation/enhanced/rspack');
10
- var paths = require('../../../../lib/paths.cjs.js');
11
10
  var fs = require('fs-extra');
12
11
  var optimization = require('./optimization.cjs.js');
13
12
  var pickBy = require('lodash/pickBy');
14
13
  var cliCommon = require('@backstage/cli-common');
15
14
  var transforms = require('./transforms.cjs.js');
16
- var version = require('../../../../lib/version.cjs.js');
15
+ var version = require('../../../../wiring/version.cjs.js');
17
16
  var yn = require('yn');
18
17
  var hasReactDomClient = require('./hasReactDomClient.cjs.js');
19
18
  var linkWorkspaces = require('./linkWorkspaces.cjs.js');
@@ -62,7 +61,7 @@ async function readBuildInfo() {
62
61
  );
63
62
  }
64
63
  const { version: packageVersion } = await fs__default.default.readJson(
65
- paths.paths.resolveTarget("package.json")
64
+ cliCommon.targetPaths.resolve("package.json")
66
65
  );
67
66
  return {
68
67
  cliVersion: version.version,
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var paths = require('../../../../lib/paths.cjs.js');
3
+ var cliCommon = require('@backstage/cli-common');
4
4
 
5
5
  function hasReactDomClient() {
6
6
  try {
7
7
  require.resolve("react-dom/client", {
8
- paths: [paths.paths.targetDir]
8
+ paths: [cliCommon.targetPaths.dir]
9
9
  });
10
10
  return true;
11
11
  } catch {