@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.
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs.js +1 -0
- package/dist/modules/auth/commands/list.cjs.js +23 -0
- package/dist/modules/auth/commands/login.cjs.js +316 -0
- package/dist/modules/auth/commands/logout.cjs.js +55 -0
- package/dist/modules/auth/commands/printToken.cjs.js +41 -0
- package/dist/modules/auth/commands/select.cjs.js +32 -0
- package/dist/modules/auth/commands/show.cjs.js +59 -0
- package/dist/modules/auth/index.cjs.js +44 -0
- package/dist/modules/auth/lib/auth.cjs.js +60 -0
- package/dist/modules/auth/lib/http.cjs.js +26 -0
- package/dist/modules/auth/lib/localServer.cjs.js +80 -0
- package/dist/modules/auth/lib/pkce.cjs.js +23 -0
- package/dist/modules/auth/lib/prompt.cjs.js +44 -0
- package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
- package/dist/modules/auth/lib/storage.cjs.js +152 -0
- package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
- package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
- package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
- package/dist/modules/build/commands/package/clean.cjs.js +1 -1
- package/dist/modules/build/commands/package/postpack.cjs.js +1 -1
- package/dist/modules/build/commands/package/prepack.cjs.js +1 -1
- package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
- package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
- package/dist/modules/build/commands/repo/build.cjs.js +45 -10
- package/dist/modules/build/commands/repo/clean.cjs.js +1 -1
- package/dist/modules/build/commands/repo/start.cjs.js +54 -5
- package/dist/modules/build/index.cjs.js +5 -129
- package/dist/modules/build/lib/optionsParser.cjs.js +9 -24
- package/dist/modules/build/lib/role.cjs.js +1 -1
- package/dist/modules/config/commands/docs.cjs.js +1 -0
- package/dist/modules/config/commands/print.cjs.js +3 -2
- package/dist/modules/config/commands/schema.cjs.js +3 -2
- package/dist/modules/config/commands/validate.cjs.js +1 -0
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
- package/dist/modules/create-github-app/index.cjs.js +1 -9
- package/dist/modules/info/commands/info.cjs.js +1 -0
- package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
- package/dist/modules/lint/commands/repo/lint.cjs.js +95 -25
- package/dist/modules/lint/index.cjs.js +2 -60
- package/dist/modules/lint/lib/optionsParser.cjs.js +9 -24
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +31 -5
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
- package/dist/modules/maintenance/index.cjs.js +2 -20
- package/dist/modules/migrate/commands/packageExports.cjs.js +1 -1
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +1 -1
- package/dist/modules/migrate/commands/packageRole.cjs.js +1 -1
- package/dist/modules/migrate/commands/packageScripts.cjs.js +1 -1
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +1 -1
- package/dist/modules/migrate/commands/versions/bump.cjs.js +41 -11
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
- package/dist/modules/migrate/index.cjs.js +2 -25
- package/dist/modules/new/commands/new.cjs.js +70 -15
- package/dist/modules/new/index.cjs.js +1 -29
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +2 -2
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +2 -2
- package/dist/modules/test/commands/package/test.cjs.js +1 -7
- package/dist/modules/test/commands/repo/test.cjs.js +45 -34
- package/dist/modules/test/index.cjs.js +2 -32
- package/dist/modules/translations/commands/export.cjs.js +1 -0
- package/dist/modules/translations/commands/import.cjs.js +1 -0
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/catalog-client/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +7 -4
- package/dist/packages/core-app-api/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
- package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
- package/dist/wiring/CliInitializer.cjs.js +12 -2
- package/package.json +23 -17
- package/dist/wiring/lazy.cjs.js +0 -22
|
@@ -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
|
|
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(
|
|
11
|
-
entrypoint
|
|
67
|
+
role: await role.findRoleFromCommand({ role: role$1 }),
|
|
68
|
+
entrypoint,
|
|
12
69
|
targetDir: cliCommon.targetPaths.dir,
|
|
13
|
-
configPaths:
|
|
14
|
-
checksEnabled: Boolean(
|
|
15
|
-
linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(
|
|
16
|
-
inspectEnabled:
|
|
17
|
-
inspectBrkEnabled:
|
|
18
|
-
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.
|
|
79
|
+
exports.default = command;
|
|
23
80
|
//# sourceMappingURL=command.cjs.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
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');
|
|
@@ -13,13 +16,37 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
16
|
|
|
14
17
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
15
18
|
|
|
16
|
-
async
|
|
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 (
|
|
46
|
+
if (since) {
|
|
20
47
|
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
21
48
|
const changedPackages = await graph.listChangedPackages({
|
|
22
|
-
ref:
|
|
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(
|
|
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:
|
|
99
|
+
minify: minify ?? Boolean(buildOptions.minify)
|
|
66
100
|
};
|
|
67
101
|
});
|
|
68
102
|
console.log("Building packages");
|
|
69
103
|
await packager.buildPackages(options);
|
|
70
|
-
if (
|
|
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:
|
|
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:
|
|
141
|
+
minify: minify ?? Boolean(buildOptions.minify)
|
|
107
142
|
});
|
|
108
143
|
}
|
|
109
144
|
});
|
|
110
145
|
}
|
|
111
|
-
}
|
|
146
|
+
};
|
|
112
147
|
|
|
113
|
-
exports.
|
|
148
|
+
exports.default = build;
|
|
114
149
|
//# sourceMappingURL=build.cjs.js.map
|
|
@@ -13,7 +13,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
14
|
|
|
15
15
|
var clean = async ({ args, info }) => {
|
|
16
|
-
cleye.cli({ help: info }, void 0, args);
|
|
16
|
+
cleye.cli({ help: info, booleanFlagNegation: true }, void 0, args);
|
|
17
17
|
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
18
18
|
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist"));
|
|
19
19
|
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist-types"));
|
|
@@ -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
|
|
17
|
-
const
|
|
18
|
-
|
|
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.
|
|
197
|
+
exports.default = start;
|
|
149
198
|
exports.findTargetPackages = findTargetPackages;
|
|
150
199
|
//# sourceMappingURL=start.cjs.js.map
|
|
@@ -2,141 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var commander = require('commander');
|
|
6
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
7
|
-
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
6
|
|
|
9
|
-
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
|
-
];
|
|
15
|
-
function registerPackageCommands(command) {
|
|
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(
|
|
17
|
-
"--minify",
|
|
18
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
19
|
-
).option(
|
|
20
|
-
"--skip-build-dependencies",
|
|
21
|
-
"Skip the automatic building of local dependencies. Applies to backend packages only."
|
|
22
|
-
).option(
|
|
23
|
-
"--stats",
|
|
24
|
-
"If bundle stats are available, write them to the output directory. Applies to app packages only."
|
|
25
|
-
).option(
|
|
26
|
-
"--config <path>",
|
|
27
|
-
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
28
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
29
|
-
Array()
|
|
30
|
-
).option(
|
|
31
|
-
"--module-federation",
|
|
32
|
-
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
33
|
-
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
34
|
-
}
|
|
35
7
|
const buildPlugin = factory.createCliPlugin({
|
|
36
8
|
pluginId: "build",
|
|
37
9
|
init: async (reg) => {
|
|
38
10
|
reg.addCommand({
|
|
39
11
|
path: ["package", "build"],
|
|
40
12
|
description: "Build a package for production deployment or publishing",
|
|
41
|
-
execute:
|
|
42
|
-
const command = new commander.Command();
|
|
43
|
-
const defaultCommand = command.option(
|
|
44
|
-
"--role <name>",
|
|
45
|
-
"Run the command with an explicit package role"
|
|
46
|
-
).option(
|
|
47
|
-
"--minify",
|
|
48
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
49
|
-
).option(
|
|
50
|
-
"--skip-build-dependencies",
|
|
51
|
-
"Skip the automatic building of local dependencies. Applies to backend packages only."
|
|
52
|
-
).option(
|
|
53
|
-
"--stats",
|
|
54
|
-
"If bundle stats are available, write them to the output directory. Applies to app packages only."
|
|
55
|
-
).option(
|
|
56
|
-
"--config <path>",
|
|
57
|
-
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
58
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
59
|
-
Array()
|
|
60
|
-
).option(
|
|
61
|
-
"--module-federation",
|
|
62
|
-
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
63
|
-
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
64
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
65
|
-
}
|
|
13
|
+
execute: { loader: () => import('./commands/package/build/index.cjs.js') }
|
|
66
14
|
});
|
|
67
15
|
reg.addCommand({
|
|
68
16
|
path: ["repo", "build"],
|
|
69
17
|
description: "Build packages in the project, excluding bundled app and backend packages.",
|
|
70
|
-
execute:
|
|
71
|
-
const command = new commander.Command();
|
|
72
|
-
registerPackageCommands(command.command("package"));
|
|
73
|
-
const defaultCommand = command.option(
|
|
74
|
-
"--all",
|
|
75
|
-
"Build all packages, including bundled app and backend packages."
|
|
76
|
-
).option(
|
|
77
|
-
"--since <ref>",
|
|
78
|
-
"Only build packages and their dev dependents that changed since the specified ref"
|
|
79
|
-
).option(
|
|
80
|
-
"--minify",
|
|
81
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
82
|
-
).action(lazy.lazy(() => import('./commands/repo/build.cjs.js'), "command"));
|
|
83
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
84
|
-
}
|
|
18
|
+
execute: { loader: () => import('./commands/repo/build.cjs.js') }
|
|
85
19
|
});
|
|
86
20
|
reg.addCommand({
|
|
87
21
|
path: ["package", "start"],
|
|
88
22
|
description: "Start a package for local development",
|
|
89
|
-
execute:
|
|
90
|
-
const command = new commander.Command();
|
|
91
|
-
const defaultCommand = command.option(...configOption).option(
|
|
92
|
-
"--role <name>",
|
|
93
|
-
"Run the command with an explicit package role"
|
|
94
|
-
).option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
|
|
95
|
-
"--inspect-brk [host]",
|
|
96
|
-
"Enable debugger in Node.js environments, breaking before code starts"
|
|
97
|
-
).option(
|
|
98
|
-
"--require <path...>",
|
|
99
|
-
"Add a --require argument to the node process"
|
|
100
|
-
).option(
|
|
101
|
-
"--link <path>",
|
|
102
|
-
"Link an external workspace for module resolution"
|
|
103
|
-
).option(
|
|
104
|
-
"--entrypoint <path>",
|
|
105
|
-
'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"'
|
|
106
|
-
).action(lazy.lazy(() => import('./commands/package/start/index.cjs.js'), "command"));
|
|
107
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
108
|
-
}
|
|
23
|
+
execute: { loader: () => import('./commands/package/start/index.cjs.js') }
|
|
109
24
|
});
|
|
110
25
|
reg.addCommand({
|
|
111
26
|
path: ["repo", "start"],
|
|
112
27
|
description: "Starts packages in the repo for local development",
|
|
113
|
-
execute:
|
|
114
|
-
const command = new commander.Command();
|
|
115
|
-
const defaultCommand = command.argument(
|
|
116
|
-
"[packageNameOrPath...]",
|
|
117
|
-
"Run the specified package instead of the defaults."
|
|
118
|
-
).option(
|
|
119
|
-
"--plugin <pluginId>",
|
|
120
|
-
"Start the dev entry-point for any matching plugin package in the repo",
|
|
121
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
122
|
-
Array()
|
|
123
|
-
).option(...configOption).option(
|
|
124
|
-
"--inspect [host]",
|
|
125
|
-
"Enable debugger in Node.js environments. Applies to backend package only"
|
|
126
|
-
).option(
|
|
127
|
-
"--inspect-brk [host]",
|
|
128
|
-
"Enable debugger in Node.js environments, breaking before code starts. Applies to backend package only"
|
|
129
|
-
).option(
|
|
130
|
-
"--require <path...>",
|
|
131
|
-
"Add a --require argument to the node process. Applies to backend package only"
|
|
132
|
-
).option(
|
|
133
|
-
"--link <path>",
|
|
134
|
-
"Link an external workspace for module resolution"
|
|
135
|
-
).action(
|
|
136
|
-
lazy.lazy(() => import('./commands/repo/start.cjs.js'), "command")
|
|
137
|
-
);
|
|
138
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
139
|
-
}
|
|
28
|
+
execute: { loader: () => import('./commands/repo/start.cjs.js') }
|
|
140
29
|
});
|
|
141
30
|
reg.addCommand({
|
|
142
31
|
path: ["package", "clean"],
|
|
@@ -169,24 +58,11 @@ const buildPlugin = factory.createCliPlugin({
|
|
|
169
58
|
reg.addCommand({
|
|
170
59
|
path: ["build-workspace"],
|
|
171
60
|
description: "Builds a temporary dist workspace from the provided packages",
|
|
172
|
-
execute:
|
|
173
|
-
const command = new commander.Command();
|
|
174
|
-
const defaultCommand = command.arguments("<workspace-dir> [packages...]").addOption(
|
|
175
|
-
new commander.Option(
|
|
176
|
-
"--alwaysYarnPack",
|
|
177
|
-
"Alias for --alwaysPack for backwards compatibility."
|
|
178
|
-
).implies({ alwaysPack: true }).hideHelp(true)
|
|
179
|
-
).option(
|
|
180
|
-
"--alwaysPack",
|
|
181
|
-
"Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
|
|
182
|
-
).action(lazy.lazy(() => import('./commands/buildWorkspace.cjs.js'), "default"));
|
|
183
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
184
|
-
}
|
|
61
|
+
execute: { loader: () => import('./commands/buildWorkspace.cjs.js') }
|
|
185
62
|
});
|
|
186
63
|
}
|
|
187
64
|
});
|
|
188
65
|
|
|
189
66
|
exports.buildPlugin = buildPlugin;
|
|
190
67
|
exports.default = buildPlugin;
|
|
191
|
-
exports.registerPackageCommands = registerPackageCommands;
|
|
192
68
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
let targetCmd = rootCmd;
|
|
9
|
-
for (const name of commandPath) {
|
|
10
|
-
targetCmd = targetCmd?.commands.find((c) => c.name() === name);
|
|
11
|
-
}
|
|
12
|
-
if (!targetCmd) {
|
|
13
|
-
throw new Error(
|
|
14
|
-
`Could not find package command '${commandPath.join(" ")}'`
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
const cmd = targetCmd;
|
|
3
|
+
var node_util = require('node:util');
|
|
4
|
+
var shellQuote = require('shell-quote');
|
|
5
|
+
|
|
6
|
+
function createScriptOptionsParser(commandPath, options) {
|
|
18
7
|
const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
|
|
19
8
|
return (scriptStr) => {
|
|
20
9
|
if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
|
|
21
10
|
return void 0;
|
|
22
11
|
}
|
|
23
12
|
const argsStr = scriptStr.slice(expectedScript.length).trim();
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cmd.parseOptions(argsStr.split(" "));
|
|
30
|
-
cmd._optionValues = currentOpts;
|
|
31
|
-
cmd._storeOptionsAsProperties = currentStore;
|
|
32
|
-
return result;
|
|
13
|
+
const args = argsStr ? shellQuote.parse(argsStr).filter(
|
|
14
|
+
(e) => typeof e === "string"
|
|
15
|
+
) : [];
|
|
16
|
+
const { values } = node_util.parseArgs({ args, strict: false, options });
|
|
17
|
+
return values;
|
|
33
18
|
};
|
|
34
19
|
}
|
|
35
20
|
|
|
@@ -10,7 +10,7 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
|
10
10
|
|
|
11
11
|
async function findRoleFromCommand(opts) {
|
|
12
12
|
if (opts.role) {
|
|
13
|
-
return cliNode.PackageRoles.getRoleInfo(opts.role)
|
|
13
|
+
return cliNode.PackageRoles.getRoleInfo(opts.role).role;
|
|
14
14
|
}
|
|
15
15
|
const pkg = await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"));
|
|
16
16
|
const info = cliNode.PackageRoles.getRoleFromPackage(pkg);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var cleye = require('cleye');
|
|
6
|
-
var
|
|
6
|
+
var YAML = require('yaml');
|
|
7
7
|
var config$1 = require('@backstage/config');
|
|
8
8
|
var config = require('../lib/config.cjs.js');
|
|
9
9
|
|
|
@@ -13,6 +13,7 @@ var print = async ({ args, info }) => {
|
|
|
13
13
|
} = cleye.cli(
|
|
14
14
|
{
|
|
15
15
|
help: info,
|
|
16
|
+
booleanFlagNegation: true,
|
|
16
17
|
flags: {
|
|
17
18
|
package: { type: String, description: "Package to print config for" },
|
|
18
19
|
lax: {
|
|
@@ -46,7 +47,7 @@ var print = async ({ args, info }) => {
|
|
|
46
47
|
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
47
48
|
`);
|
|
48
49
|
} else {
|
|
49
|
-
process.stdout.write(`${
|
|
50
|
+
process.stdout.write(`${YAML.stringify(data)}
|
|
50
51
|
`);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var cleye = require('cleye');
|
|
6
|
-
var
|
|
6
|
+
var YAML = require('yaml');
|
|
7
7
|
var config = require('../lib/config.cjs.js');
|
|
8
8
|
var configLoader = require('@backstage/config-loader');
|
|
9
9
|
|
|
@@ -13,6 +13,7 @@ var schema = async ({ args, info }) => {
|
|
|
13
13
|
} = cleye.cli(
|
|
14
14
|
{
|
|
15
15
|
help: info,
|
|
16
|
+
booleanFlagNegation: true,
|
|
16
17
|
flags: {
|
|
17
18
|
package: { type: String, description: "Package to print schema for" },
|
|
18
19
|
format: { type: String, description: "Output format (yaml or json)" },
|
|
@@ -46,7 +47,7 @@ var schema = async ({ args, info }) => {
|
|
|
46
47
|
process.stdout.write(`${JSON.stringify(configSchema, null, 2)}
|
|
47
48
|
`);
|
|
48
49
|
} else {
|
|
49
|
-
process.stdout.write(`${
|
|
50
|
+
process.stdout.write(`${YAML.stringify(configSchema)}
|
|
50
51
|
`);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var fs = require('fs-extra');
|
|
6
6
|
var chalk = require('chalk');
|
|
7
|
-
var
|
|
7
|
+
var YAML = require('yaml');
|
|
8
8
|
var inquirer = require('inquirer');
|
|
9
9
|
var cliCommon = require('@backstage/cli-common');
|
|
10
|
+
var cleye = require('cleye');
|
|
10
11
|
var GithubCreateAppServer = require('./GithubCreateAppServer.cjs.js');
|
|
11
12
|
var openBrowser = require('react-dev-utils/openBrowser');
|
|
12
13
|
|
|
@@ -17,7 +18,17 @@ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
|
17
18
|
var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
|
|
18
19
|
var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
19
20
|
|
|
20
|
-
var index = async (
|
|
21
|
+
var index = async ({ args, info }) => {
|
|
22
|
+
const { _: positionals } = cleye.cli(
|
|
23
|
+
{
|
|
24
|
+
help: { ...info, usage: `${info.usage} <github-org>` },
|
|
25
|
+
booleanFlagNegation: true,
|
|
26
|
+
parameters: ["<github-org>"]
|
|
27
|
+
},
|
|
28
|
+
void 0,
|
|
29
|
+
args
|
|
30
|
+
);
|
|
31
|
+
const org = positionals[0];
|
|
21
32
|
const answers = await inquirer__default.default.prompt({
|
|
22
33
|
name: "appType",
|
|
23
34
|
type: "checkbox",
|
|
@@ -50,7 +61,7 @@ var index = async (org) => {
|
|
|
50
61
|
});
|
|
51
62
|
const fileName = `github-app-${slug}-credentials.yaml`;
|
|
52
63
|
const content = `# Name: ${name}
|
|
53
|
-
${
|
|
64
|
+
${YAML.stringify(config)}`;
|
|
54
65
|
await fs__default.default.writeFile(cliCommon.targetPaths.resolveRoot(fileName), content);
|
|
55
66
|
console.log(`GitHub App configuration written to ${chalk__default.default.cyan(fileName)}`);
|
|
56
67
|
console.log(
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
var commander = require('commander');
|
|
7
|
-
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
6
|
|
|
9
7
|
var index = factory.createCliPlugin({
|
|
10
8
|
pluginId: "new",
|
|
@@ -12,13 +10,7 @@ var index = factory.createCliPlugin({
|
|
|
12
10
|
reg.addCommand({
|
|
13
11
|
path: ["create-github-app"],
|
|
14
12
|
description: "Create new GitHub App in your organization.",
|
|
15
|
-
execute:
|
|
16
|
-
const command = new commander.Command();
|
|
17
|
-
const defaultCommand = command.argument("<github-org>").action(
|
|
18
|
-
lazy.lazy(() => import('./commands/create-github-app/index.cjs.js'), "default")
|
|
19
|
-
);
|
|
20
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
21
|
-
}
|
|
13
|
+
execute: { loader: () => import('./commands/create-github-app/index.cjs.js') }
|
|
22
14
|
});
|
|
23
15
|
}
|
|
24
16
|
});
|