@backstage/cli 0.35.5-next.0 → 0.36.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/config/jest.js +2 -2
  3. package/dist/index.cjs.js +1 -0
  4. package/dist/modules/auth/commands/list.cjs.js +23 -0
  5. package/dist/modules/auth/commands/login.cjs.js +316 -0
  6. package/dist/modules/auth/commands/logout.cjs.js +55 -0
  7. package/dist/modules/auth/commands/printToken.cjs.js +41 -0
  8. package/dist/modules/auth/commands/select.cjs.js +32 -0
  9. package/dist/modules/auth/commands/show.cjs.js +59 -0
  10. package/dist/modules/auth/index.cjs.js +44 -0
  11. package/dist/modules/auth/lib/auth.cjs.js +60 -0
  12. package/dist/modules/auth/lib/http.cjs.js +26 -0
  13. package/dist/modules/auth/lib/localServer.cjs.js +80 -0
  14. package/dist/modules/auth/lib/pkce.cjs.js +23 -0
  15. package/dist/modules/auth/lib/prompt.cjs.js +44 -0
  16. package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
  17. package/dist/modules/auth/lib/storage.cjs.js +152 -0
  18. package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
  19. package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
  20. package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
  21. package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
  22. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  23. package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
  24. package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
  25. package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
  26. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
  27. package/dist/modules/build/commands/repo/build.cjs.js +46 -11
  28. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
  29. package/dist/modules/build/commands/repo/start.cjs.js +54 -5
  30. package/dist/modules/build/index.cjs.js +32 -123
  31. package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
  32. package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
  33. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
  34. package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
  35. package/dist/modules/build/lib/config.cjs.js +94 -0
  36. package/dist/modules/build/lib/optionsParser.cjs.js +22 -0
  37. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
  38. package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
  39. package/dist/modules/build/lib/role.cjs.js +1 -1
  40. package/dist/modules/config/commands/docs.cjs.js +19 -2
  41. package/dist/modules/config/commands/print.cjs.js +41 -13
  42. package/dist/modules/config/commands/schema.cjs.js +25 -6
  43. package/dist/modules/config/commands/validate.cjs.js +38 -7
  44. package/dist/modules/config/index.cjs.js +6 -65
  45. package/dist/modules/config/lib/config.cjs.js +6 -22
  46. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
  47. package/dist/modules/create-github-app/index.cjs.js +1 -9
  48. package/dist/modules/info/commands/info.cjs.js +26 -6
  49. package/dist/modules/info/index.cjs.js +1 -23
  50. package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
  51. package/dist/modules/lint/commands/repo/lint.cjs.js +99 -27
  52. package/dist/modules/lint/index.cjs.js +2 -60
  53. package/dist/modules/lint/lib/optionsParser.cjs.js +22 -0
  54. package/dist/modules/maintenance/commands/repo/fix.cjs.js +32 -9
  55. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
  56. package/dist/modules/maintenance/index.cjs.js +2 -64
  57. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  58. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  59. package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
  60. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  61. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  62. package/dist/modules/migrate/commands/versions/bump.cjs.js +48 -20
  63. package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
  64. package/dist/modules/migrate/index.cjs.js +12 -55
  65. package/dist/modules/new/commands/new.cjs.js +70 -15
  66. package/dist/modules/new/index.cjs.js +1 -29
  67. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
  68. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
  69. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
  70. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
  71. package/dist/modules/test/commands/package/test.cjs.js +1 -10
  72. package/dist/modules/test/commands/repo/test.cjs.js +51 -39
  73. package/dist/modules/test/index.cjs.js +2 -32
  74. package/dist/modules/translations/commands/export.cjs.js +25 -1
  75. package/dist/modules/translations/commands/import.cjs.js +25 -1
  76. package/dist/modules/translations/index.cjs.js +2 -37
  77. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  78. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  79. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  80. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  81. package/dist/packages/cli/package.json.cjs.js +7 -6
  82. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  83. package/dist/packages/core-components/package.json.cjs.js +1 -1
  84. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  85. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  86. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  87. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  88. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  89. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  90. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  91. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  92. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  93. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  94. package/dist/wiring/CliInitializer.cjs.js +24 -7
  95. package/dist/wiring/version.cjs.js +20 -0
  96. package/package.json +26 -22
  97. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  98. package/dist/lib/lazy.cjs.js +0 -22
  99. package/dist/lib/optionsParser.cjs.js +0 -37
  100. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  101. package/dist/lib/yarnPlugin.cjs.js +0 -46
  102. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  103. /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
  104. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  105. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  106. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
@@ -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, booleanFlagNegation: true }, void 0, args);
11
+ await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
12
+ };
13
+
14
+ exports.default = postpack;
15
+ //# sourceMappingURL=postpack.cjs.js.map
@@ -1,16 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var productionPack = require('../../../build/lib/packager/productionPack.cjs.js');
4
- var cliCommon = require('@backstage/cli-common');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
5
6
  var fs = require('fs-extra');
7
+ var cliCommon = require('@backstage/cli-common');
8
+ var productionPack = require('../../lib/packager/productionPack.cjs.js');
6
9
  var publishing = require('../../lib/publishing.cjs.js');
7
- var typeDistProject = require('../../../../lib/typeDistProject.cjs.js');
10
+ var typeDistProject = require('../../lib/typeDistProject.cjs.js');
8
11
 
9
12
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
13
 
11
14
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
15
 
13
- const pre = async () => {
16
+ var prepack = async ({ args, info }) => {
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
14
18
  publishing.publishPreflightCheck({
15
19
  dir: cliCommon.targetPaths.dir,
16
20
  packageJson: await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"))
@@ -20,10 +24,6 @@ const pre = async () => {
20
24
  featureDetectionProject: await typeDistProject.createTypeDistProject()
21
25
  });
22
26
  };
23
- const post = async () => {
24
- await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
25
- };
26
27
 
27
- exports.post = post;
28
- exports.pre = pre;
29
- //# sourceMappingURL=pack.cjs.js.map
28
+ exports.default = prepack;
29
+ //# sourceMappingURL=prepack.cjs.js.map
@@ -1,23 +1,80 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
3
6
  var startPackage = require('./startPackage.cjs.js');
4
7
  var resolveLinkedWorkspace = require('./resolveLinkedWorkspace.cjs.js');
5
8
  var role = require('../../../lib/role.cjs.js');
6
9
  var cliCommon = require('@backstage/cli-common');
7
10
 
8
- async function command(opts) {
11
+ var command = async ({ args, info }) => {
12
+ const {
13
+ flags: {
14
+ config,
15
+ role: role$1,
16
+ check,
17
+ require: requirePath,
18
+ link,
19
+ entrypoint,
20
+ inspect,
21
+ inspectBrk
22
+ }
23
+ } = cleye.cli(
24
+ {
25
+ help: info,
26
+ booleanFlagNegation: true,
27
+ flags: {
28
+ config: {
29
+ type: [String],
30
+ description: "Config files to load instead of app-config.yaml",
31
+ default: []
32
+ },
33
+ role: {
34
+ type: String,
35
+ description: "Run the command with an explicit package role"
36
+ },
37
+ check: {
38
+ type: Boolean,
39
+ description: "Enable type checking and linting if available"
40
+ },
41
+ require: {
42
+ type: String,
43
+ description: "Add a --require argument to the node process"
44
+ },
45
+ link: {
46
+ type: String,
47
+ description: "Link an external workspace for module resolution"
48
+ },
49
+ entrypoint: {
50
+ type: String,
51
+ description: 'The entrypoint to start from, relative to the package root. Can point to either a file (without extension) or a directory (in which case the index file in that directory is used). Defaults to "dev"'
52
+ },
53
+ inspect: {
54
+ type: String,
55
+ description: "Enable the Node.js inspector, optionally at a specific host:port"
56
+ },
57
+ inspectBrk: {
58
+ type: String,
59
+ description: "Enable the Node.js inspector and break before user code starts"
60
+ }
61
+ }
62
+ },
63
+ void 0,
64
+ args
65
+ );
9
66
  await startPackage.startPackage({
10
- role: await role.findRoleFromCommand(opts),
11
- entrypoint: opts.entrypoint,
67
+ role: await role.findRoleFromCommand({ role: role$1 }),
68
+ entrypoint,
12
69
  targetDir: cliCommon.targetPaths.dir,
13
- configPaths: opts.config,
14
- checksEnabled: Boolean(opts.check),
15
- linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(opts.link),
16
- inspectEnabled: opts.inspect,
17
- inspectBrkEnabled: opts.inspectBrk,
18
- require: opts.require
70
+ configPaths: config,
71
+ checksEnabled: Boolean(check),
72
+ linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(link),
73
+ inspectEnabled: inspect || (inspect === "" ? true : void 0),
74
+ inspectBrkEnabled: inspectBrk || (inspectBrk === "" ? true : void 0),
75
+ require: requirePath
19
76
  });
20
- }
77
+ };
21
78
 
22
- exports.command = command;
79
+ exports.default = command;
23
80
  //# sourceMappingURL=command.cjs.js.map
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var command = require('./command.cjs.js');
4
6
 
5
7
 
6
8
 
7
- exports.command = command.command;
9
+ exports.default = command.default;
8
10
  //# sourceMappingURL=index.cjs.js.map
@@ -13,7 +13,7 @@ require('react-dev-utils/ModuleScopePlugin');
13
13
  require('@module-federation/enhanced/rspack');
14
14
  require('lodash/pickBy');
15
15
  var cliCommon = require('@backstage/cli-common');
16
- require('../../../../../lib/version.cjs.js');
16
+ require('../../../../../wiring/version.cjs.js');
17
17
  var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
18
18
  require('@manypkg/get-packages');
19
19
  require('chalk');
@@ -1,25 +1,52 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var chalk = require('chalk');
6
+ var cleye = require('cleye');
4
7
  var path = require('node:path');
5
8
  var packager = require('../../lib/builder/packager.cjs.js');
6
9
  var cliCommon = require('@backstage/cli-common');
7
10
  var cliNode = require('@backstage/cli-node');
8
11
  var buildFrontend = require('../../lib/buildFrontend.cjs.js');
9
12
  var buildBackend = require('../../lib/buildBackend.cjs.js');
10
- var optionsParser = require('../../../../lib/optionsParser.cjs.js');
13
+ var optionsParser = require('../../lib/optionsParser.cjs.js');
11
14
 
12
15
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
13
16
 
14
17
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
15
18
 
16
- async function command(opts, cmd) {
19
+ var build = async ({ args, info }) => {
20
+ const {
21
+ flags: { all, since, minify }
22
+ } = cleye.cli(
23
+ {
24
+ help: info,
25
+ booleanFlagNegation: true,
26
+ flags: {
27
+ all: {
28
+ type: Boolean,
29
+ description: "Build all packages, including bundled app and backend packages."
30
+ },
31
+ since: {
32
+ type: String,
33
+ description: "Only build packages and their dev dependents that changed since the specified ref"
34
+ },
35
+ minify: {
36
+ type: Boolean,
37
+ description: "Minify the generated code. Does not apply to app package (app is minified by default)."
38
+ }
39
+ }
40
+ },
41
+ void 0,
42
+ args
43
+ );
17
44
  let packages = await cliNode.PackageGraph.listTargetPackages();
18
45
  const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
19
- if (opts.since) {
46
+ if (since) {
20
47
  const graph = cliNode.PackageGraph.fromPackages(packages);
21
48
  const changedPackages = await graph.listChangedPackages({
22
- ref: opts.since,
49
+ ref: since,
23
50
  analyzeLockfile: true
24
51
  });
25
52
  const withDevDependents = graph.collectPackageNames(
@@ -30,7 +57,14 @@ async function command(opts, cmd) {
30
57
  }
31
58
  const apps = new Array();
32
59
  const backends = new Array();
33
- const parseBuildScript = optionsParser.createScriptOptionsParser(cmd, ["package", "build"]);
60
+ const parseBuildScript = optionsParser.createScriptOptionsParser(["package", "build"], {
61
+ role: { type: "string" },
62
+ minify: { type: "boolean" },
63
+ "skip-build-dependencies": { type: "boolean" },
64
+ stats: { type: "boolean" },
65
+ config: { type: "string", multiple: true },
66
+ "module-federation": { type: "boolean" }
67
+ });
34
68
  const options = packages.flatMap((pkg) => {
35
69
  const role = pkg.packageJson.backstage?.role ?? cliNode.PackageRoles.detectRoleFromPackage(pkg.packageJson);
36
70
  if (!role) {
@@ -62,12 +96,12 @@ async function command(opts, cmd) {
62
96
  outputs,
63
97
  logPrefix: `${chalk__default.default.cyan(path.relative(cliCommon.targetPaths.rootDir, pkg.dir))}: `,
64
98
  workspacePackages: packages,
65
- minify: opts.minify ?? buildOptions.minify
99
+ minify: minify ?? Boolean(buildOptions.minify)
66
100
  };
67
101
  });
68
102
  console.log("Building packages");
69
103
  await packager.buildPackages(options);
70
- if (opts.all) {
104
+ if (all) {
71
105
  console.log("Building apps");
72
106
  await cliNode.runConcurrentTasks({
73
107
  items: apps,
@@ -80,9 +114,10 @@ async function command(opts, cmd) {
80
114
  );
81
115
  return;
82
116
  }
117
+ const configPaths = buildOptions.config;
83
118
  await buildFrontend.buildFrontend({
84
119
  targetDir: pkg.dir,
85
- configPaths: buildOptions.config ?? [],
120
+ configPaths: Array.isArray(configPaths) ? configPaths : [],
86
121
  writeStats: Boolean(buildOptions.stats),
87
122
  webpack
88
123
  });
@@ -103,12 +138,12 @@ async function command(opts, cmd) {
103
138
  await buildBackend.buildBackend({
104
139
  targetDir: pkg.dir,
105
140
  skipBuildDependencies: true,
106
- minify: opts.minify ?? buildOptions.minify
141
+ minify: minify ?? Boolean(buildOptions.minify)
107
142
  });
108
143
  }
109
144
  });
110
145
  }
111
- }
146
+ };
112
147
 
113
- exports.command = command;
148
+ exports.default = build;
114
149
  //# sourceMappingURL=build.cjs.js.map
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cleye = require('cleye');
3
6
  var fs = require('fs-extra');
4
7
  var path = require('node:path');
5
8
  var cliNode = require('@backstage/cli-node');
@@ -9,7 +12,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
9
12
 
10
13
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
14
 
12
- async function command() {
15
+ var clean = async ({ args, info }) => {
16
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
13
17
  const packages = await cliNode.PackageGraph.listTargetPackages();
14
18
  await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist"));
15
19
  await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist-types"));
@@ -31,7 +35,7 @@ async function command() {
31
35
  }
32
36
  })
33
37
  );
34
- }
38
+ };
35
39
 
36
- exports.command = command;
40
+ exports.default = clean;
37
41
  //# sourceMappingURL=clean.cjs.js.map
@@ -1,8 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var cliNode = require('@backstage/cli-node');
4
6
  var path = require('node:path');
5
7
  var cliCommon = require('@backstage/cli-common');
8
+ var cleye = require('cleye');
6
9
  var resolveLinkedWorkspace = require('../package/start/resolveLinkedWorkspace.cjs.js');
7
10
  var startPackage = require('../package/start/startPackage.cjs.js');
8
11
  var node_util = require('node:util');
@@ -13,9 +16,55 @@ const ACCEPTED_PACKAGE_ROLES = [
13
16
  "frontend-plugin",
14
17
  "backend-plugin"
15
18
  ];
16
- async function command(namesOrPaths, options) {
17
- const targetPackages = await findTargetPackages(namesOrPaths, options.plugin);
18
- const packageOptions = await resolvePackageOptions(targetPackages, options);
19
+ var start = async ({ args, info }) => {
20
+ const {
21
+ flags: { plugin, config, require: requirePath, link, inspect, inspectBrk },
22
+ _: namesOrPaths
23
+ } = cleye.cli(
24
+ {
25
+ help: { ...info, usage: `${info.usage} [packages...]` },
26
+ booleanFlagNegation: true,
27
+ parameters: ["[packages...]"],
28
+ flags: {
29
+ plugin: {
30
+ type: [String],
31
+ description: "Start the dev entry-point for any matching plugin package in the repo",
32
+ default: []
33
+ },
34
+ config: {
35
+ type: [String],
36
+ description: "Config files to load instead of app-config.yaml",
37
+ default: []
38
+ },
39
+ require: {
40
+ type: String,
41
+ description: "Add a --require argument to the node process. Applies to backend package only"
42
+ },
43
+ link: {
44
+ type: String,
45
+ description: "Link an external workspace for module resolution"
46
+ },
47
+ inspect: {
48
+ type: String,
49
+ description: "Enable the Node.js inspector, optionally at a specific host:port"
50
+ },
51
+ inspectBrk: {
52
+ type: String,
53
+ description: "Enable the Node.js inspector and break before user code starts"
54
+ }
55
+ }
56
+ },
57
+ void 0,
58
+ args
59
+ );
60
+ const targetPackages = await findTargetPackages(namesOrPaths, plugin);
61
+ const packageOptions = await resolvePackageOptions(targetPackages, {
62
+ config,
63
+ inspect: inspect || (inspect === "" ? true : void 0),
64
+ inspectBrk: inspectBrk || (inspectBrk === "" ? true : void 0),
65
+ require: requirePath,
66
+ link
67
+ });
19
68
  if (packageOptions.length === 0) {
20
69
  console.log("No packages found to start");
21
70
  return;
@@ -24,7 +73,7 @@ async function command(namesOrPaths, options) {
24
73
  `Starting ${packageOptions.map(({ pkg }) => pkg.packageJson.name).join(", ")}`
25
74
  );
26
75
  await Promise.all(packageOptions.map((entry) => startPackage.startPackage(entry.options)));
27
- }
76
+ };
28
77
  async function findTargetPackages(namesOrPaths, pluginIds) {
29
78
  const targetPackages = new Array();
30
79
  const packages = await cliNode.PackageGraph.listTargetPackages();
@@ -145,6 +194,6 @@ async function resolvePackageOptions(targetPackages, options) {
145
194
  });
146
195
  }
147
196
 
148
- exports.command = command;
197
+ exports.default = start;
149
198
  exports.findTargetPackages = findTargetPackages;
150
199
  //# sourceMappingURL=start.cjs.js.map
@@ -2,158 +2,67 @@
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('../../lib/lazy.cjs.js');
8
- var index = require('../config/index.cjs.js');
9
6
 
10
- function registerPackageCommands(command) {
11
- 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
- "--minify",
13
- "Minify the generated code. Does not apply to app package (app is minified by default)."
14
- ).option(
15
- "--skip-build-dependencies",
16
- "Skip the automatic building of local dependencies. Applies to backend packages only."
17
- ).option(
18
- "--stats",
19
- "If bundle stats are available, write them to the output directory. Applies to app packages only."
20
- ).option(
21
- "--config <path>",
22
- "Config files to load instead of app-config.yaml. Applies to app packages only.",
23
- (opt, opts) => opts ? [...opts, opt] : [opt],
24
- Array()
25
- ).option(
26
- "--module-federation",
27
- "Build a package as a module federation remote. Applies to frontend plugin packages only."
28
- ).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
29
- }
30
7
  const buildPlugin = factory.createCliPlugin({
31
8
  pluginId: "build",
32
9
  init: async (reg) => {
33
10
  reg.addCommand({
34
11
  path: ["package", "build"],
35
12
  description: "Build a package for production deployment or publishing",
36
- execute: async ({ args }) => {
37
- const command = new commander.Command();
38
- const defaultCommand = command.option(
39
- "--role <name>",
40
- "Run the command with an explicit package role"
41
- ).option(
42
- "--minify",
43
- "Minify the generated code. Does not apply to app package (app is minified by default)."
44
- ).option(
45
- "--skip-build-dependencies",
46
- "Skip the automatic building of local dependencies. Applies to backend packages only."
47
- ).option(
48
- "--stats",
49
- "If bundle stats are available, write them to the output directory. Applies to app packages only."
50
- ).option(
51
- "--config <path>",
52
- "Config files to load instead of app-config.yaml. Applies to app packages only.",
53
- (opt, opts) => opts ? [...opts, opt] : [opt],
54
- Array()
55
- ).option(
56
- "--module-federation",
57
- "Build a package as a module federation remote. Applies to frontend plugin packages only."
58
- ).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
59
- await defaultCommand.parseAsync(args, { from: "user" });
60
- }
13
+ execute: { loader: () => import('./commands/package/build/index.cjs.js') }
61
14
  });
62
15
  reg.addCommand({
63
16
  path: ["repo", "build"],
64
17
  description: "Build packages in the project, excluding bundled app and backend packages.",
65
- execute: async ({ args }) => {
66
- const command = new commander.Command();
67
- registerPackageCommands(command.command("package"));
68
- const defaultCommand = command.option(
69
- "--all",
70
- "Build all packages, including bundled app and backend packages."
71
- ).option(
72
- "--since <ref>",
73
- "Only build packages and their dev dependents that changed since the specified ref"
74
- ).option(
75
- "--minify",
76
- "Minify the generated code. Does not apply to app package (app is minified by default)."
77
- ).action(lazy.lazy(() => import('./commands/repo/build.cjs.js'), "command"));
78
- await defaultCommand.parseAsync(args, { from: "user" });
79
- }
18
+ execute: { loader: () => import('./commands/repo/build.cjs.js') }
80
19
  });
81
20
  reg.addCommand({
82
21
  path: ["package", "start"],
83
22
  description: "Start a package for local development",
84
- execute: async ({ args }) => {
85
- const command = new commander.Command();
86
- const defaultCommand = command.option(...index.configOption).option(
87
- "--role <name>",
88
- "Run the command with an explicit package role"
89
- ).option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
90
- "--inspect-brk [host]",
91
- "Enable debugger in Node.js environments, breaking before code starts"
92
- ).option(
93
- "--require <path...>",
94
- "Add a --require argument to the node process"
95
- ).option(
96
- "--link <path>",
97
- "Link an external workspace for module resolution"
98
- ).option(
99
- "--entrypoint <path>",
100
- 'The entrypoint to start from, relative to the package root. Can point to either a file (without extension) or a directory (in which case the index file in that directory is used). Defaults to "dev"'
101
- ).action(lazy.lazy(() => import('./commands/package/start/index.cjs.js'), "command"));
102
- await defaultCommand.parseAsync(args, { from: "user" });
103
- }
23
+ execute: { loader: () => import('./commands/package/start/index.cjs.js') }
104
24
  });
105
25
  reg.addCommand({
106
26
  path: ["repo", "start"],
107
27
  description: "Starts packages in the repo for local development",
108
- execute: async ({ args }) => {
109
- const command = new commander.Command();
110
- const defaultCommand = command.argument(
111
- "[packageNameOrPath...]",
112
- "Run the specified package instead of the defaults."
113
- ).option(
114
- "--plugin <pluginId>",
115
- "Start the dev entry-point for any matching plugin package in the repo",
116
- (opt, opts) => opts ? [...opts, opt] : [opt],
117
- Array()
118
- ).option(...index.configOption).option(
119
- "--inspect [host]",
120
- "Enable debugger in Node.js environments. Applies to backend package only"
121
- ).option(
122
- "--inspect-brk [host]",
123
- "Enable debugger in Node.js environments, breaking before code starts. Applies to backend package only"
124
- ).option(
125
- "--require <path...>",
126
- "Add a --require argument to the node process. Applies to backend package only"
127
- ).option(
128
- "--link <path>",
129
- "Link an external workspace for module resolution"
130
- ).action(
131
- lazy.lazy(() => import('./commands/repo/start.cjs.js'), "command")
132
- );
133
- await defaultCommand.parseAsync(args, { from: "user" });
28
+ execute: { loader: () => import('./commands/repo/start.cjs.js') }
29
+ });
30
+ reg.addCommand({
31
+ path: ["package", "clean"],
32
+ description: "Delete cache directories",
33
+ execute: {
34
+ loader: () => import('./commands/package/clean.cjs.js')
35
+ }
36
+ });
37
+ reg.addCommand({
38
+ path: ["package", "prepack"],
39
+ description: "Prepares a package for packaging before publishing",
40
+ execute: {
41
+ loader: () => import('./commands/package/prepack.cjs.js')
42
+ }
43
+ });
44
+ reg.addCommand({
45
+ path: ["package", "postpack"],
46
+ description: "Restores the changes made by the prepack command",
47
+ execute: {
48
+ loader: () => import('./commands/package/postpack.cjs.js')
49
+ }
50
+ });
51
+ reg.addCommand({
52
+ path: ["repo", "clean"],
53
+ description: "Delete cache and output directories",
54
+ execute: {
55
+ loader: () => import('./commands/repo/clean.cjs.js')
134
56
  }
135
57
  });
136
58
  reg.addCommand({
137
59
  path: ["build-workspace"],
138
60
  description: "Builds a temporary dist workspace from the provided packages",
139
- execute: async ({ args }) => {
140
- const command = new commander.Command();
141
- const defaultCommand = command.arguments("<workspace-dir> [packages...]").addOption(
142
- new commander.Option(
143
- "--alwaysYarnPack",
144
- "Alias for --alwaysPack for backwards compatibility."
145
- ).implies({ alwaysPack: true }).hideHelp(true)
146
- ).option(
147
- "--alwaysPack",
148
- "Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
149
- ).action(lazy.lazy(() => import('./commands/buildWorkspace.cjs.js'), "default"));
150
- await defaultCommand.parseAsync(args, { from: "user" });
151
- }
61
+ execute: { loader: () => import('./commands/buildWorkspace.cjs.js') }
152
62
  });
153
63
  }
154
64
  });
155
65
 
156
66
  exports.buildPlugin = buildPlugin;
157
67
  exports.default = buildPlugin;
158
- exports.registerPackageCommands = registerPackageCommands;
159
68
  //# sourceMappingURL=index.cjs.js.map
@@ -9,14 +9,14 @@ require('react-dev-utils/openBrowser');
9
9
  require('@rspack/core');
10
10
  require('@rspack/dev-server');
11
11
  require('@backstage/cli-common');
12
- var config = require('../../config/lib/config.cjs.js');
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('../../../lib/version.cjs.js');
19
+ require('../../../wiring/version.cjs.js');
20
20
  require('yn');
21
21
  require('@manypkg/get-packages');
22
22
  require('./bundler/packageDetection.cjs.js');
@@ -12,7 +12,7 @@ var optimization = require('./optimization.cjs.js');
12
12
  var pickBy = require('lodash/pickBy');
13
13
  var cliCommon = require('@backstage/cli-common');
14
14
  var transforms = require('./transforms.cjs.js');
15
- var version = require('../../../../lib/version.cjs.js');
15
+ var version = require('../../../../wiring/version.cjs.js');
16
16
  var yn = require('yn');
17
17
  var hasReactDomClient = require('./hasReactDomClient.cjs.js');
18
18
  var linkWorkspaces = require('./linkWorkspaces.cjs.js');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var entryPoints = require('../entryPoints.cjs.js');
4
- var typeDistProject = require('../../../../lib/typeDistProject.cjs.js');
4
+ var typeDistProject = require('../typeDistProject.cjs.js');
5
5
  var moduleFederationCommon = require('@backstage/module-federation-common');
6
6
  var path = require('node:path');
7
7
  var fs = require('fs-extra');
@@ -7,7 +7,7 @@ var openBrowser = require('react-dev-utils/openBrowser');
7
7
  var core = require('@rspack/core');
8
8
  var devServer = require('@rspack/dev-server');
9
9
  var cliCommon = require('@backstage/cli-common');
10
- var config = require('../../../config/lib/config.cjs.js');
10
+ var config = require('../config.cjs.js');
11
11
  var config$1 = require('./config.cjs.js');
12
12
  var packageDetection = require('./packageDetection.cjs.js');
13
13
  var paths = require('./paths.cjs.js');