@backstage/cli 0.36.0-next.1 → 0.36.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/index.cjs.js +1 -0
  3. package/dist/modules/auth/commands/list.cjs.js +23 -0
  4. package/dist/modules/auth/commands/login.cjs.js +316 -0
  5. package/dist/modules/auth/commands/logout.cjs.js +55 -0
  6. package/dist/modules/auth/commands/printToken.cjs.js +41 -0
  7. package/dist/modules/auth/commands/select.cjs.js +32 -0
  8. package/dist/modules/auth/commands/show.cjs.js +59 -0
  9. package/dist/modules/auth/index.cjs.js +44 -0
  10. package/dist/modules/auth/lib/auth.cjs.js +60 -0
  11. package/dist/modules/auth/lib/http.cjs.js +26 -0
  12. package/dist/modules/auth/lib/localServer.cjs.js +80 -0
  13. package/dist/modules/auth/lib/pkce.cjs.js +23 -0
  14. package/dist/modules/auth/lib/prompt.cjs.js +44 -0
  15. package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
  16. package/dist/modules/auth/lib/storage.cjs.js +152 -0
  17. package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
  18. package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
  19. package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
  20. package/dist/modules/build/commands/package/clean.cjs.js +1 -1
  21. package/dist/modules/build/commands/package/postpack.cjs.js +1 -1
  22. package/dist/modules/build/commands/package/prepack.cjs.js +1 -1
  23. package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
  24. package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
  25. package/dist/modules/build/commands/repo/build.cjs.js +45 -10
  26. package/dist/modules/build/commands/repo/clean.cjs.js +1 -1
  27. package/dist/modules/build/commands/repo/start.cjs.js +54 -5
  28. package/dist/modules/build/index.cjs.js +5 -129
  29. package/dist/modules/build/lib/optionsParser.cjs.js +9 -24
  30. package/dist/modules/build/lib/role.cjs.js +1 -1
  31. package/dist/modules/config/commands/docs.cjs.js +1 -0
  32. package/dist/modules/config/commands/print.cjs.js +3 -2
  33. package/dist/modules/config/commands/schema.cjs.js +3 -2
  34. package/dist/modules/config/commands/validate.cjs.js +1 -0
  35. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
  36. package/dist/modules/create-github-app/index.cjs.js +1 -9
  37. package/dist/modules/info/commands/info.cjs.js +1 -0
  38. package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
  39. package/dist/modules/lint/commands/repo/lint.cjs.js +95 -25
  40. package/dist/modules/lint/index.cjs.js +2 -60
  41. package/dist/modules/lint/lib/optionsParser.cjs.js +9 -24
  42. package/dist/modules/maintenance/commands/repo/fix.cjs.js +31 -5
  43. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
  44. package/dist/modules/maintenance/index.cjs.js +2 -20
  45. package/dist/modules/migrate/commands/packageExports.cjs.js +1 -1
  46. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +1 -1
  47. package/dist/modules/migrate/commands/packageRole.cjs.js +1 -1
  48. package/dist/modules/migrate/commands/packageScripts.cjs.js +1 -1
  49. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +1 -1
  50. package/dist/modules/migrate/commands/versions/bump.cjs.js +41 -11
  51. package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
  52. package/dist/modules/migrate/index.cjs.js +2 -25
  53. package/dist/modules/new/commands/new.cjs.js +70 -15
  54. package/dist/modules/new/index.cjs.js +1 -29
  55. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +2 -2
  56. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +2 -2
  57. package/dist/modules/test/commands/package/test.cjs.js +1 -7
  58. package/dist/modules/test/commands/repo/test.cjs.js +45 -34
  59. package/dist/modules/test/index.cjs.js +2 -32
  60. package/dist/modules/translations/commands/export.cjs.js +1 -0
  61. package/dist/modules/translations/commands/import.cjs.js +1 -0
  62. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  63. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  64. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  65. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  66. package/dist/packages/cli/package.json.cjs.js +7 -4
  67. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  68. package/dist/packages/core-components/package.json.cjs.js +1 -1
  69. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  70. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  71. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  72. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  73. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  74. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  75. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  76. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  77. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  78. package/dist/wiring/CliInitializer.cjs.js +12 -2
  79. package/package.json +23 -17
  80. package/dist/wiring/lazy.cjs.js +0 -22
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ var http = require('node:http');
4
+ var node_url = require('node:url');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var http__default = /*#__PURE__*/_interopDefaultCompat(http);
9
+
10
+ const CALLBACK_PORT = 8055;
11
+ async function startCallbackServer(options) {
12
+ const server = http__default.default.createServer();
13
+ let resolveResult;
14
+ const resultPromise = new Promise(
15
+ (resolve) => {
16
+ resolveResult = resolve;
17
+ }
18
+ );
19
+ server.on("request", (req, res) => {
20
+ if (!req.url) {
21
+ res.statusCode = 400;
22
+ res.end("Bad Request");
23
+ return;
24
+ }
25
+ const u = new node_url.URL(req.url, "http://127.0.0.1");
26
+ if (u.pathname !== "/callback") {
27
+ res.statusCode = 404;
28
+ res.end("Not Found");
29
+ return;
30
+ }
31
+ const code = u.searchParams.get("code") ?? void 0;
32
+ const state = u.searchParams.get("state") ?? void 0;
33
+ if (!code) {
34
+ res.statusCode = 400;
35
+ res.end("Missing code");
36
+ return;
37
+ }
38
+ if (state !== options.state) {
39
+ res.statusCode = 400;
40
+ res.end("State mismatch");
41
+ return;
42
+ }
43
+ res.statusCode = 200;
44
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
45
+ res.end("You may now close this window.");
46
+ resolveResult?.({ code, state });
47
+ });
48
+ const port = await new Promise((resolve, reject) => {
49
+ server.on("error", (err) => {
50
+ if (err.code === "EADDRINUSE") {
51
+ reject(
52
+ new Error(
53
+ `Port ${CALLBACK_PORT} is already in use. Close the application using it and try again.`
54
+ )
55
+ );
56
+ } else {
57
+ reject(err);
58
+ }
59
+ });
60
+ server.listen(CALLBACK_PORT, "127.0.0.1", () => {
61
+ const address = server.address();
62
+ if (typeof address === "object" && address && "port" in address) {
63
+ resolve(address.port);
64
+ } else {
65
+ reject(new Error("Failed to bind local server"));
66
+ }
67
+ });
68
+ });
69
+ return {
70
+ url: `http://127.0.0.1:${port}/callback`,
71
+ waitForCode: () => resultPromise,
72
+ close: async () => {
73
+ server.closeAllConnections();
74
+ return new Promise((resolve) => server.close(() => resolve()));
75
+ }
76
+ };
77
+ }
78
+
79
+ exports.startCallbackServer = startCallbackServer;
80
+ //# sourceMappingURL=localServer.cjs.js.map
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('node:crypto');
4
+
5
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
6
+
7
+ var crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
8
+
9
+ function base64url(input) {
10
+ return input.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
11
+ }
12
+ function generateVerifier(length = 64) {
13
+ const bytes = crypto__default.default.randomBytes(Math.max(32, Math.min(96, length)));
14
+ return base64url(bytes);
15
+ }
16
+ function challengeFromVerifier(verifier) {
17
+ const hash = crypto__default.default.createHash("sha256").update(verifier).digest();
18
+ return base64url(hash);
19
+ }
20
+
21
+ exports.challengeFromVerifier = challengeFromVerifier;
22
+ exports.generateVerifier = generateVerifier;
23
+ //# sourceMappingURL=pkce.cjs.js.map
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ var inquirer = require('inquirer');
4
+ var storage = require('./storage.cjs.js');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
9
+
10
+ async function pickInstance(name) {
11
+ if (name) {
12
+ return storage.getInstanceByName(name);
13
+ }
14
+ const { instances, selected } = await storage.getAllInstances();
15
+ if (instances.length === 0) {
16
+ throw new Error(
17
+ 'No instances found. Run "auth login" to authenticate first.'
18
+ );
19
+ }
20
+ return await promptForInstance(instances, selected);
21
+ }
22
+ async function promptForInstance(instances, selected) {
23
+ const choices = instances.map((i) => ({
24
+ name: `${i.name === selected?.name ? "* " : " "}${i.name} (${i.baseUrl})`,
25
+ value: i.name
26
+ }));
27
+ const { choice } = await inquirer__default.default.prompt([
28
+ {
29
+ type: "list",
30
+ name: "choice",
31
+ message: "Select instance:",
32
+ choices,
33
+ default: selected?.name
34
+ }
35
+ ]);
36
+ const instance = instances.find((i) => i.name === choice);
37
+ if (!instance) {
38
+ throw new Error(`Instance '${choice}' not found`);
39
+ }
40
+ return instance;
41
+ }
42
+
43
+ exports.pickInstance = pickInstance;
44
+ //# sourceMappingURL=prompt.cjs.js.map
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ var os = require('node:os');
5
+ var path = require('node:path');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
+ var os__default = /*#__PURE__*/_interopDefaultCompat(os);
11
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
12
+
13
+ async function loadKeytar() {
14
+ try {
15
+ const keytar = require("keytar");
16
+ if (keytar && typeof keytar.getPassword === "function") {
17
+ return keytar;
18
+ }
19
+ } catch {
20
+ }
21
+ return void 0;
22
+ }
23
+ class KeytarSecretStore {
24
+ keytar;
25
+ constructor(keytar) {
26
+ this.keytar = keytar;
27
+ }
28
+ async get(service, account) {
29
+ const result = await this.keytar.getPassword(service, account);
30
+ return result ?? void 0;
31
+ }
32
+ async set(service, account, secret) {
33
+ await this.keytar.setPassword(service, account, secret);
34
+ }
35
+ async delete(service, account) {
36
+ await this.keytar.deletePassword(service, account);
37
+ }
38
+ }
39
+ class FileSecretStore {
40
+ baseDir;
41
+ constructor() {
42
+ const root = process.env.XDG_DATA_HOME || (process.platform === "win32" ? process.env.APPDATA || path__default.default.join(os__default.default.homedir(), "AppData", "Roaming") : path__default.default.join(os__default.default.homedir(), ".local", "share"));
43
+ this.baseDir = path__default.default.join(root, "backstage-cli", "auth-secrets");
44
+ }
45
+ filePath(service, account) {
46
+ return path__default.default.join(
47
+ this.baseDir,
48
+ encodeURIComponent(service),
49
+ `${encodeURIComponent(account)}.secret`
50
+ );
51
+ }
52
+ async get(service, account) {
53
+ const file = this.filePath(service, account);
54
+ if (!await fs__default.default.pathExists(file)) return void 0;
55
+ return await fs__default.default.readFile(file, "utf8");
56
+ }
57
+ async set(service, account, secret) {
58
+ const file = this.filePath(service, account);
59
+ await fs__default.default.ensureDir(path__default.default.dirname(file));
60
+ await fs__default.default.writeFile(file, secret, { encoding: "utf8", mode: 384 });
61
+ }
62
+ async delete(service, account) {
63
+ const file = this.filePath(service, account);
64
+ await fs__default.default.remove(file);
65
+ }
66
+ }
67
+ let singleton;
68
+ async function getSecretStore() {
69
+ if (!singleton) {
70
+ const keytar = await loadKeytar();
71
+ if (keytar) {
72
+ singleton = new KeytarSecretStore(keytar);
73
+ } else {
74
+ singleton = new FileSecretStore();
75
+ }
76
+ }
77
+ return singleton;
78
+ }
79
+
80
+ exports.getSecretStore = getSecretStore;
81
+ //# sourceMappingURL=secretStore.cjs.js.map
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+ var fs = require('fs-extra');
5
+ var os = require('node:os');
6
+ var path = require('node:path');
7
+ var lockfile = require('proper-lockfile');
8
+ var YAML = require('yaml');
9
+ var zod = require('zod');
10
+
11
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
+
13
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
+ var os__default = /*#__PURE__*/_interopDefaultCompat(os);
15
+ var path__default = /*#__PURE__*/_interopDefaultCompat(path);
16
+ var lockfile__default = /*#__PURE__*/_interopDefaultCompat(lockfile);
17
+ var YAML__default = /*#__PURE__*/_interopDefaultCompat(YAML);
18
+
19
+ const METADATA_FILE = "auth-instances.yaml";
20
+ const INSTANCE_NAME_PATTERN = /^[a-zA-Z0-9._:@-]+$/;
21
+ const storedInstanceSchema = zod.z.object({
22
+ name: zod.z.string().min(1).regex(INSTANCE_NAME_PATTERN, "Instance name contains invalid characters"),
23
+ baseUrl: zod.z.string().url(),
24
+ clientId: zod.z.string().min(1),
25
+ issuedAt: zod.z.number().int().nonnegative(),
26
+ accessTokenExpiresAt: zod.z.number().int().nonnegative(),
27
+ selected: zod.z.boolean().optional()
28
+ });
29
+ const authYamlSchema = zod.z.object({
30
+ instances: zod.z.array(storedInstanceSchema).default([])
31
+ });
32
+ function getMetadataFilePath() {
33
+ const root = process.env.XDG_CONFIG_HOME || (process.platform === "win32" ? process.env.APPDATA || path__default.default.join(os__default.default.homedir(), "AppData", "Roaming") : path__default.default.join(os__default.default.homedir(), ".config"));
34
+ return path__default.default.join(root, "backstage-cli", METADATA_FILE);
35
+ }
36
+ async function readAll() {
37
+ const file = getMetadataFilePath();
38
+ if (!await fs__default.default.pathExists(file)) {
39
+ return { instances: [] };
40
+ }
41
+ const text = await fs__default.default.readFile(file, "utf8");
42
+ if (!text.trim()) {
43
+ return { instances: [] };
44
+ }
45
+ try {
46
+ const doc = YAML__default.default.parse(text);
47
+ const parsed = authYamlSchema.safeParse(doc);
48
+ if (parsed.success) {
49
+ return parsed.data;
50
+ }
51
+ return { instances: [] };
52
+ } catch {
53
+ return { instances: [] };
54
+ }
55
+ }
56
+ async function writeAll(data) {
57
+ const file = getMetadataFilePath();
58
+ await fs__default.default.ensureDir(path__default.default.dirname(file));
59
+ const yaml = YAML__default.default.stringify(authYamlSchema.parse(data), { indentSeq: false });
60
+ await fs__default.default.writeFile(file, yaml, { encoding: "utf8", mode: 384 });
61
+ }
62
+ async function getAllInstances() {
63
+ const { instances } = await readAll();
64
+ const selected = instances.find((i) => i.selected) ?? instances[0];
65
+ return {
66
+ // Normalize selection prop
67
+ instances: instances.map((i) => ({
68
+ ...i,
69
+ selected: i.name === selected.name
70
+ })),
71
+ selected
72
+ };
73
+ }
74
+ async function getSelectedInstance(instanceName) {
75
+ if (instanceName) {
76
+ return await getInstanceByName(instanceName);
77
+ }
78
+ const { selected } = await getAllInstances();
79
+ if (!selected) {
80
+ throw new Error(
81
+ 'No instances found. Run "auth login" to authenticate first.'
82
+ );
83
+ }
84
+ return selected;
85
+ }
86
+ async function getInstanceByName(name) {
87
+ const { instances } = await readAll();
88
+ const instance = instances.find((i) => i.name === name);
89
+ if (!instance) {
90
+ throw new errors.NotFoundError(`Instance '${name}' not found`);
91
+ }
92
+ return instance;
93
+ }
94
+ async function upsertInstance(instance) {
95
+ const data = await readAll();
96
+ const idx = data.instances.findIndex((i) => i.name === instance.name);
97
+ if (idx === -1) {
98
+ data.instances.push(instance);
99
+ } else {
100
+ data.instances[idx] = instance;
101
+ }
102
+ await writeAll(data);
103
+ }
104
+ async function removeInstance(name) {
105
+ const data = await readAll();
106
+ const next = data.instances.filter((i) => i.name !== name);
107
+ if (next.length !== data.instances.length) {
108
+ await writeAll({ instances: next });
109
+ }
110
+ }
111
+ async function setSelectedInstance(name) {
112
+ return withMetadataLock(async () => {
113
+ const data = await readAll();
114
+ let found = false;
115
+ data.instances = data.instances.map((i) => {
116
+ if (i.name === name) {
117
+ found = true;
118
+ return { ...i, selected: true };
119
+ }
120
+ const { selected, ...rest } = i;
121
+ return { ...rest, selected: false };
122
+ });
123
+ if (!found) {
124
+ throw new Error(`Unknown instance '${name}'`);
125
+ }
126
+ await writeAll(data);
127
+ });
128
+ }
129
+ async function withMetadataLock(fn) {
130
+ const file = getMetadataFilePath();
131
+ await fs__default.default.ensureDir(path__default.default.dirname(file));
132
+ if (!await fs__default.default.pathExists(file)) {
133
+ await fs__default.default.writeFile(file, "", { encoding: "utf8", mode: 384 });
134
+ }
135
+ const release = await lockfile__default.default.lock(file, {
136
+ retries: { retries: 5, factor: 1.5, minTimeout: 100, maxTimeout: 1e3 }
137
+ });
138
+ try {
139
+ return await fn();
140
+ } finally {
141
+ await release();
142
+ }
143
+ }
144
+
145
+ exports.getAllInstances = getAllInstances;
146
+ exports.getInstanceByName = getInstanceByName;
147
+ exports.getSelectedInstance = getSelectedInstance;
148
+ exports.removeInstance = removeInstance;
149
+ exports.setSelectedInstance = setSelectedInstance;
150
+ exports.upsertInstance = upsertInstance;
151
+ exports.withMetadataLock = withMetadataLock;
152
+ //# sourceMappingURL=storage.cjs.js.map
@@ -3,19 +3,48 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var fs = require('fs-extra');
6
+ var cleye = require('cleye');
6
7
  var createDistWorkspace = require('../lib/packager/createDistWorkspace.cjs.js');
7
8
 
8
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
10
 
10
11
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
12
 
12
- var buildWorkspace = async (dir, packages, options) => {
13
+ var buildWorkspace = async ({ args, info }) => {
14
+ const normalizedArgs = args.map((a) => {
15
+ if (a === "--alwaysYarnPack") {
16
+ return "--always-pack";
17
+ }
18
+ if (a.startsWith("--alwaysYarnPack=")) {
19
+ return `--always-pack${a.substring("--alwaysYarnPack".length)}`;
20
+ }
21
+ return a;
22
+ });
23
+ const {
24
+ flags: { alwaysPack },
25
+ _: positionals
26
+ } = cleye.cli(
27
+ {
28
+ help: { ...info, usage: `${info.usage} <workspace-dir> [packages...]` },
29
+ booleanFlagNegation: true,
30
+ parameters: ["<workspace-dir>", "[packages...]"],
31
+ flags: {
32
+ alwaysPack: {
33
+ type: Boolean,
34
+ description: "Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
35
+ }
36
+ }
37
+ },
38
+ void 0,
39
+ normalizedArgs
40
+ );
41
+ const [dir, ...packages] = positionals;
13
42
  if (!await fs__default.default.pathExists(dir)) {
14
43
  throw new Error(`Target workspace directory doesn't exist, '${dir}'`);
15
44
  }
16
45
  await createDistWorkspace.createDistWorkspace(packages, {
17
46
  targetDir: dir,
18
- alwaysPack: options.alwaysPack,
47
+ alwaysPack,
19
48
  enableFeatureDetection: true
20
49
  });
21
50
  };
@@ -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 packager = require('../../../lib/builder/packager.cjs.js');
5
8
  var types = require('../../../lib/builder/types.cjs.js');
@@ -16,33 +19,77 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
16
19
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
17
20
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
18
21
 
19
- async function command(opts) {
22
+ var command = async ({ args, info }) => {
23
+ const {
24
+ flags: {
25
+ role: role$1,
26
+ minify,
27
+ skipBuildDependencies,
28
+ stats,
29
+ config,
30
+ moduleFederation
31
+ }
32
+ } = cleye.cli(
33
+ {
34
+ help: info,
35
+ booleanFlagNegation: true,
36
+ flags: {
37
+ role: {
38
+ type: String,
39
+ description: "Run the command with an explicit package role"
40
+ },
41
+ minify: {
42
+ type: Boolean,
43
+ description: "Minify the generated code. Does not apply to app package (app is minified by default)."
44
+ },
45
+ skipBuildDependencies: {
46
+ type: Boolean,
47
+ description: "Skip the automatic building of local dependencies. Applies to backend packages only."
48
+ },
49
+ stats: {
50
+ type: Boolean,
51
+ description: "If bundle stats are available, write them to the output directory. Applies to app packages only."
52
+ },
53
+ config: {
54
+ type: [String],
55
+ description: "Config files to load instead of app-config.yaml. Applies to app packages only.",
56
+ default: []
57
+ },
58
+ moduleFederation: {
59
+ type: Boolean,
60
+ description: "Build a package as a module federation remote. Applies to frontend plugin packages only."
61
+ }
62
+ }
63
+ },
64
+ void 0,
65
+ args
66
+ );
20
67
  const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
21
- const role$1 = await role.findRoleFromCommand(opts);
22
- if (role$1 === "frontend" || role$1 === "backend") {
23
- const configPaths = opts.config.map((arg) => {
68
+ const resolvedRole = await role.findRoleFromCommand({ role: role$1 });
69
+ if (resolvedRole === "frontend" || resolvedRole === "backend") {
70
+ const configPaths = config.map((arg) => {
24
71
  if (urls.isValidUrl(arg)) {
25
72
  return arg;
26
73
  }
27
74
  return cliCommon.targetPaths.resolve(arg);
28
75
  });
29
- if (role$1 === "frontend") {
76
+ if (resolvedRole === "frontend") {
30
77
  return buildFrontend.buildFrontend({
31
78
  targetDir: cliCommon.targetPaths.dir,
32
79
  configPaths,
33
- writeStats: Boolean(opts.stats),
80
+ writeStats: Boolean(stats),
34
81
  webpack
35
82
  });
36
83
  }
37
84
  return buildBackend.buildBackend({
38
85
  targetDir: cliCommon.targetPaths.dir,
39
86
  configPaths,
40
- skipBuildDependencies: Boolean(opts.skipBuildDependencies),
41
- minify: Boolean(opts.minify)
87
+ skipBuildDependencies: Boolean(skipBuildDependencies),
88
+ minify: Boolean(minify)
42
89
  });
43
90
  }
44
91
  let isModuleFederationRemote = void 0;
45
- if (role$1 === "frontend-dynamic-container") {
92
+ if (resolvedRole === "frontend-dynamic-container") {
46
93
  console.log(
47
94
  chalk__default.default.yellow(
48
95
  `\u26A0\uFE0F WARNING: The 'frontend-dynamic-container' package role is experimental and will receive immediate breaking changes in the future.`
@@ -50,7 +97,7 @@ async function command(opts) {
50
97
  );
51
98
  isModuleFederationRemote = true;
52
99
  }
53
- if (opts.moduleFederation) {
100
+ if (moduleFederation) {
54
101
  isModuleFederationRemote = true;
55
102
  }
56
103
  if (isModuleFederationRemote) {
@@ -58,12 +105,12 @@ async function command(opts) {
58
105
  return buildFrontend.buildFrontend({
59
106
  targetDir: cliCommon.targetPaths.dir,
60
107
  configPaths: [],
61
- writeStats: Boolean(opts.stats),
108
+ writeStats: Boolean(stats),
62
109
  isModuleFederationRemote,
63
110
  webpack
64
111
  });
65
112
  }
66
- const roleInfo = cliNode.PackageRoles.getRoleInfo(role$1);
113
+ const roleInfo = cliNode.PackageRoles.getRoleInfo(resolvedRole);
67
114
  const outputs = /* @__PURE__ */ new Set();
68
115
  if (roleInfo.output.includes("cjs")) {
69
116
  outputs.add(types.Output.cjs);
@@ -80,10 +127,10 @@ async function command(opts) {
80
127
  return packager.buildPackage({
81
128
  outputs,
82
129
  packageJson,
83
- minify: Boolean(opts.minify),
130
+ minify: Boolean(minify),
84
131
  workspacePackages: await cliNode.PackageGraph.listTargetPackages()
85
132
  });
86
- }
133
+ };
87
134
 
88
- exports.command = command;
135
+ exports.default = command;
89
136
  //# 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
@@ -11,7 +11,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
11
11
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
12
12
 
13
13
  var clean = async ({ args, info }) => {
14
- cleye.cli({ help: info }, void 0, args);
14
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
15
15
  await fs__default.default.remove(cliCommon.targetPaths.resolve("dist"));
16
16
  await fs__default.default.remove(cliCommon.targetPaths.resolve("dist-types"));
17
17
  await fs__default.default.remove(cliCommon.targetPaths.resolve("coverage"));
@@ -7,7 +7,7 @@ var cliCommon = require('@backstage/cli-common');
7
7
  var productionPack = require('../../lib/packager/productionPack.cjs.js');
8
8
 
9
9
  var postpack = async ({ args, info }) => {
10
- cleye.cli({ help: info }, void 0, args);
10
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
11
11
  await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
12
12
  };
13
13
 
@@ -14,7 +14,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
14
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
15
 
16
16
  var prepack = async ({ args, info }) => {
17
- cleye.cli({ help: info }, void 0, args);
17
+ cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
18
18
  publishing.publishPreflightCheck({
19
19
  dir: cliCommon.targetPaths.dir,
20
20
  packageJson: await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"))