@backstage/cli 0.32.2-next.0 → 0.33.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.
- package/CHANGELOG.md +23 -0
- package/bin/backstage-cli-alpha +0 -0
- package/dist/index.cjs.js +14 -29
- package/dist/lib/removed.cjs.js +1 -1
- package/dist/lib/run.cjs.js +7 -7
- package/dist/modules/build/index.cjs.js +124 -52
- package/dist/modules/config/commands/docs.cjs.js +18 -1
- package/dist/modules/config/index.cjs.js +101 -30
- package/dist/modules/create-github-app/index.cjs.js +21 -9
- package/dist/modules/info/index.cjs.js +23 -5
- package/dist/modules/lint/index.cjs.js +68 -29
- package/dist/modules/maintenance/index.cjs.js +80 -18
- package/dist/modules/migrate/index.cjs.js +96 -30
- package/dist/modules/new/index.cjs.js +57 -28
- package/dist/modules/test/index.cjs.js +46 -20
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +26 -0
- package/dist/packages/opaque-internal/src/OpaqueType.cjs.js +105 -0
- 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 +124 -0
- package/dist/wiring/CommandGraph.cjs.js +71 -0
- package/dist/wiring/CommandRegistry.cjs.js +14 -0
- package/dist/wiring/factory.cjs.js +15 -0
- package/dist/wiring/types.cjs.js +11 -0
- package/package.json +7 -8
- package/templates/backend-plugin/package.json.hbs +2 -1
- package/templates/backend-plugin-module/package.json.hbs +2 -1
- package/templates/frontend-plugin/package.json.hbs +2 -1
- package/templates/plugin-common-library/package.json.hbs +2 -1
- package/templates/plugin-node-library/package.json.hbs +2 -1
- package/templates/plugin-web-library/package.json.hbs +2 -1
- package/templates/scaffolder-backend-module/package.json.hbs +2 -1
- package/templates/scaffolder-backend-module/src/actions/example.ts +6 -12
- package/dist/commands/index.cjs.js +0 -52
- package/dist/modules/config/commands/print.cjs.js +0 -53
- package/dist/modules/config/commands/validate.cjs.js +0 -19
- package/dist/modules/info/commands/info.cjs.js +0 -55
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class OpaqueType {
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new opaque type.
|
|
6
|
+
*
|
|
7
|
+
* @param options.type The type identifier of the opaque type
|
|
8
|
+
* @param options.versions The available versions of the opaque type
|
|
9
|
+
* @returns A new opaque type helper
|
|
10
|
+
*/
|
|
11
|
+
static create(options) {
|
|
12
|
+
return new OpaqueType(options.type, new Set(options.versions));
|
|
13
|
+
}
|
|
14
|
+
#type;
|
|
15
|
+
#versions;
|
|
16
|
+
constructor(type, versions) {
|
|
17
|
+
this.#type = type;
|
|
18
|
+
this.#versions = versions;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The internal version of the opaque type, used like this: `typeof MyOpaqueType.TPublic`
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
*
|
|
25
|
+
* This property is only useful for type checking, its runtime value is `undefined`.
|
|
26
|
+
*/
|
|
27
|
+
TPublic = void 0;
|
|
28
|
+
/**
|
|
29
|
+
* The internal version of the opaque type, used like this: `typeof MyOpaqueType.TInternal`
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
*
|
|
33
|
+
* This property is only useful for type checking, its runtime value is `undefined`.
|
|
34
|
+
*/
|
|
35
|
+
TInternal = void 0;
|
|
36
|
+
/**
|
|
37
|
+
* @param value Input value expected to be an instance of this opaque type
|
|
38
|
+
* @returns True if the value matches this opaque type
|
|
39
|
+
*/
|
|
40
|
+
isType = (value) => {
|
|
41
|
+
return this.#isThisInternalType(value);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @param value Input value expected to be an instance of this opaque type
|
|
45
|
+
* @throws If the value is not an instance of this opaque type or is of an unsupported version
|
|
46
|
+
* @returns The internal version of the opaque type
|
|
47
|
+
*/
|
|
48
|
+
toInternal = (value) => {
|
|
49
|
+
if (!this.#isThisInternalType(value)) {
|
|
50
|
+
throw new TypeError(
|
|
51
|
+
`Invalid opaque type, expected '${this.#type}', but got '${this.#stringifyUnknown(value)}'`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
if (!this.#versions.has(value.version)) {
|
|
55
|
+
const versions = Array.from(this.#versions).map(this.#stringifyVersion);
|
|
56
|
+
if (versions.length > 1) {
|
|
57
|
+
versions[versions.length - 1] = `or ${versions[versions.length - 1]}`;
|
|
58
|
+
}
|
|
59
|
+
const expected = versions.length > 2 ? versions.join(", ") : versions.join(" ");
|
|
60
|
+
throw new TypeError(
|
|
61
|
+
`Invalid opaque type instance, got version ${this.#stringifyVersion(
|
|
62
|
+
value.version
|
|
63
|
+
)}, expected ${expected}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Creates an instance of the opaque type, returning the public type.
|
|
70
|
+
*
|
|
71
|
+
* @param version The version of the instance to create
|
|
72
|
+
* @param value The remaining public and internal properties of the instance
|
|
73
|
+
* @returns An instance of the opaque type
|
|
74
|
+
*/
|
|
75
|
+
createInstance(version, props) {
|
|
76
|
+
return Object.assign(props, {
|
|
77
|
+
$$type: this.#type,
|
|
78
|
+
...version && { version }
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
#isThisInternalType(value) {
|
|
82
|
+
if (value === null || typeof value !== "object") {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return value.$$type === this.#type;
|
|
86
|
+
}
|
|
87
|
+
#stringifyUnknown(value) {
|
|
88
|
+
if (typeof value !== "object") {
|
|
89
|
+
return `<${typeof value}>`;
|
|
90
|
+
}
|
|
91
|
+
if (value === null) {
|
|
92
|
+
return "<null>";
|
|
93
|
+
}
|
|
94
|
+
if ("$$type" in value) {
|
|
95
|
+
return String(value.$$type);
|
|
96
|
+
}
|
|
97
|
+
return String(value);
|
|
98
|
+
}
|
|
99
|
+
#stringifyVersion = (version) => {
|
|
100
|
+
return version ? `'${version}'` : "undefined";
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
exports.OpaqueType = OpaqueType;
|
|
105
|
+
//# sourceMappingURL=OpaqueType.cjs.js.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var CommandGraph = require('./CommandGraph.cjs.js');
|
|
4
|
+
var types$1 = require('./types.cjs.js');
|
|
5
|
+
var CommandRegistry = require('./CommandRegistry.cjs.js');
|
|
6
|
+
var commander = require('commander');
|
|
7
|
+
var version = require('../lib/version.cjs.js');
|
|
8
|
+
var chalk = require('chalk');
|
|
9
|
+
var errors$1 = require('../lib/errors.cjs.js');
|
|
10
|
+
var errors = require('@backstage/errors');
|
|
11
|
+
var types = require('util/types');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
16
|
+
|
|
17
|
+
class CliInitializer {
|
|
18
|
+
graph = new CommandGraph.CommandGraph();
|
|
19
|
+
commandRegistry = new CommandRegistry.CommandRegistry(this.graph);
|
|
20
|
+
#uninitiazedFeatures = [];
|
|
21
|
+
add(feature) {
|
|
22
|
+
if (types.isPromise(feature)) {
|
|
23
|
+
this.#uninitiazedFeatures.push(
|
|
24
|
+
feature.then((f) => unwrapFeature(f.default))
|
|
25
|
+
);
|
|
26
|
+
} else {
|
|
27
|
+
this.#uninitiazedFeatures.push(Promise.resolve(feature));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async #register(feature) {
|
|
31
|
+
if (types$1.OpaqueCliPlugin.isType(feature)) {
|
|
32
|
+
const internal = types$1.OpaqueCliPlugin.toInternal(feature);
|
|
33
|
+
await internal.init(this.commandRegistry);
|
|
34
|
+
} else {
|
|
35
|
+
throw new Error(`Unsupported feature type: ${feature.$$type}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async #doInit() {
|
|
39
|
+
const features = await Promise.all(this.#uninitiazedFeatures);
|
|
40
|
+
for (const feature of features) {
|
|
41
|
+
await this.#register(feature);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Actually parse argv and pass it to the command.
|
|
46
|
+
*/
|
|
47
|
+
async run() {
|
|
48
|
+
await this.#doInit();
|
|
49
|
+
const programName = "backstage-cli";
|
|
50
|
+
const program = new commander.Command();
|
|
51
|
+
program.name(programName).version(version.version).allowUnknownOption(true).allowExcessArguments(true);
|
|
52
|
+
const queue = this.graph.atDepth(0).map((node) => ({
|
|
53
|
+
node,
|
|
54
|
+
argParser: program
|
|
55
|
+
}));
|
|
56
|
+
while (queue.length) {
|
|
57
|
+
const { node, argParser } = queue.shift();
|
|
58
|
+
if (node.$$type === "@tree/root") {
|
|
59
|
+
const treeParser = argParser.command(`${node.name} [command]`).description(node.name);
|
|
60
|
+
queue.push(
|
|
61
|
+
...node.children.map((child) => ({
|
|
62
|
+
node: child,
|
|
63
|
+
argParser: treeParser
|
|
64
|
+
}))
|
|
65
|
+
);
|
|
66
|
+
} else {
|
|
67
|
+
argParser.command(node.name, { hidden: !!node.command.deprecated }).description(node.command.description).helpOption(false).allowUnknownOption(true).allowExcessArguments(true).action(async () => {
|
|
68
|
+
try {
|
|
69
|
+
const args = program.parseOptions(process.argv);
|
|
70
|
+
const nonProcessArgs = args.operands.slice(2);
|
|
71
|
+
const positionalArgs = [];
|
|
72
|
+
let index = 0;
|
|
73
|
+
for (let argIndex = 0; argIndex < nonProcessArgs.length; argIndex++) {
|
|
74
|
+
if (argIndex === index && node.command.path[argIndex] === nonProcessArgs[argIndex]) {
|
|
75
|
+
index += 1;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
positionalArgs.push(nonProcessArgs[argIndex]);
|
|
79
|
+
}
|
|
80
|
+
await node.command.execute({
|
|
81
|
+
args: [...positionalArgs, ...args.unknown],
|
|
82
|
+
info: {
|
|
83
|
+
usage: [programName, ...node.command.path].join(" "),
|
|
84
|
+
description: node.command.description
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
process.exit(0);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
errors.assertError(error);
|
|
90
|
+
errors$1.exitWithError(error);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
program.on("command:*", () => {
|
|
96
|
+
console.log();
|
|
97
|
+
console.log(chalk__default.default.red(`Invalid command: ${program.args.join(" ")}`));
|
|
98
|
+
console.log();
|
|
99
|
+
program.outputHelp();
|
|
100
|
+
process.exit(1);
|
|
101
|
+
});
|
|
102
|
+
process.on("unhandledRejection", (rejection) => {
|
|
103
|
+
if (rejection instanceof Error) {
|
|
104
|
+
errors$1.exitWithError(rejection);
|
|
105
|
+
} else {
|
|
106
|
+
errors$1.exitWithError(new Error(`Unknown rejection: '${rejection}'`));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
program.parse(process.argv);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function unwrapFeature(feature) {
|
|
113
|
+
if ("$$type" in feature) {
|
|
114
|
+
return feature;
|
|
115
|
+
}
|
|
116
|
+
if ("default" in feature) {
|
|
117
|
+
return feature.default;
|
|
118
|
+
}
|
|
119
|
+
return feature;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exports.CliInitializer = CliInitializer;
|
|
123
|
+
exports.unwrapFeature = unwrapFeature;
|
|
124
|
+
//# sourceMappingURL=CliInitializer.cjs.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class CommandGraph {
|
|
4
|
+
graph = [];
|
|
5
|
+
/**
|
|
6
|
+
* Adds a command to the graph. The graph is sparse, so we use the path to determine the nodes
|
|
7
|
+
* to traverse. Only leaf nodes should have a command/action.
|
|
8
|
+
*/
|
|
9
|
+
add(command) {
|
|
10
|
+
const path = command.path;
|
|
11
|
+
let current = this.graph;
|
|
12
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
13
|
+
const name = path[i];
|
|
14
|
+
let next = current.find((n) => n.name === name);
|
|
15
|
+
if (!next) {
|
|
16
|
+
next = { $$type: "@tree/root", name, children: [] };
|
|
17
|
+
current.push(next);
|
|
18
|
+
} else if (next.$$type === "@tree/leaf") {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Command already exists at path: "${path.slice(0, i).join(" ")}"`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
current = next.children;
|
|
24
|
+
}
|
|
25
|
+
const last = current.find((n) => n.name === path[path.length - 1]);
|
|
26
|
+
if (last && last.$$type === "@tree/leaf") {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Command already exists at path: "${path.slice(0, -1).join(" ")}"`
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
current.push({
|
|
32
|
+
$$type: "@tree/leaf",
|
|
33
|
+
name: path[path.length - 1],
|
|
34
|
+
command
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Given a path, try to find a command that matches it.
|
|
40
|
+
*/
|
|
41
|
+
find(path) {
|
|
42
|
+
let current = this.graph;
|
|
43
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
44
|
+
const name = path[i];
|
|
45
|
+
const next = current.find((n) => n.name === name);
|
|
46
|
+
if (!next) {
|
|
47
|
+
return void 0;
|
|
48
|
+
} else if (next.$$type === "@tree/leaf") {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
current = next.children;
|
|
52
|
+
}
|
|
53
|
+
const last = current.find((n) => n.name === path[path.length - 1]);
|
|
54
|
+
if (!last || last.$$type === "@tree/root") {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
return last?.command;
|
|
58
|
+
}
|
|
59
|
+
atDepth(depth) {
|
|
60
|
+
let current = this.graph;
|
|
61
|
+
for (let i = 0; i < depth; i++) {
|
|
62
|
+
current = current.flatMap(
|
|
63
|
+
(n) => n.$$type === "@tree/root" ? n.children : []
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return current;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.CommandGraph = CommandGraph;
|
|
71
|
+
//# sourceMappingURL=CommandGraph.cjs.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class CommandRegistry {
|
|
4
|
+
graph;
|
|
5
|
+
constructor(graph) {
|
|
6
|
+
this.graph = graph;
|
|
7
|
+
}
|
|
8
|
+
addCommand(command) {
|
|
9
|
+
this.graph.add(command);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.CommandRegistry = CommandRegistry;
|
|
14
|
+
//# sourceMappingURL=CommandRegistry.cjs.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var describeParentCallSite = require('../packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js');
|
|
4
|
+
var types = require('./types.cjs.js');
|
|
5
|
+
|
|
6
|
+
function createCliPlugin(options) {
|
|
7
|
+
return types.OpaqueCliPlugin.createInstance("v1", {
|
|
8
|
+
pluginId: options.pluginId,
|
|
9
|
+
init: options.init,
|
|
10
|
+
description: `created at '${describeParentCallSite.describeParentCallSite()}'`
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.createCliPlugin = createCliPlugin;
|
|
15
|
+
//# sourceMappingURL=factory.cjs.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var OpaqueType = require('../packages/opaque-internal/src/OpaqueType.cjs.js');
|
|
4
|
+
|
|
5
|
+
const OpaqueCliPlugin = OpaqueType.OpaqueType.create({
|
|
6
|
+
type: "@backstage/CliPlugin",
|
|
7
|
+
versions: ["v1"]
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
exports.OpaqueCliPlugin = OpaqueCliPlugin;
|
|
11
|
+
//# sourceMappingURL=types.cjs.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0-next.1",
|
|
4
4
|
"description": "CLI for developing Backstage plugins and apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"main": "dist/index.cjs.js",
|
|
22
22
|
"bin": {
|
|
23
|
-
"backstage-cli": "bin/backstage-cli"
|
|
24
|
-
"backstage-cli-alpha": "bin/backstage-cli-alpha"
|
|
23
|
+
"backstage-cli": "bin/backstage-cli"
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"asset-types",
|
|
@@ -165,19 +164,19 @@
|
|
|
165
164
|
},
|
|
166
165
|
"devDependencies": {
|
|
167
166
|
"@backstage/backend-plugin-api": "1.4.0-next.1",
|
|
168
|
-
"@backstage/backend-test-utils": "1.6.0-next.
|
|
167
|
+
"@backstage/backend-test-utils": "1.6.0-next.2",
|
|
169
168
|
"@backstage/catalog-client": "1.10.1-next.0",
|
|
170
169
|
"@backstage/config": "1.3.2",
|
|
171
170
|
"@backstage/core-app-api": "1.17.0",
|
|
172
|
-
"@backstage/core-components": "0.17.
|
|
171
|
+
"@backstage/core-components": "0.17.3-next.0",
|
|
173
172
|
"@backstage/core-plugin-api": "1.10.7",
|
|
174
|
-
"@backstage/dev-utils": "1.1.11-next.
|
|
173
|
+
"@backstage/dev-utils": "1.1.11-next.2",
|
|
175
174
|
"@backstage/errors": "1.2.7",
|
|
176
175
|
"@backstage/plugin-auth-backend": "0.25.1-next.1",
|
|
177
176
|
"@backstage/plugin-auth-backend-module-guest-provider": "0.2.9-next.1",
|
|
178
177
|
"@backstage/plugin-catalog-node": "1.17.1-next.1",
|
|
179
|
-
"@backstage/plugin-scaffolder-node": "0.
|
|
180
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.
|
|
178
|
+
"@backstage/plugin-scaffolder-node": "0.9.0-next.2",
|
|
179
|
+
"@backstage/plugin-scaffolder-node-test-utils": "0.3.0-next.2",
|
|
181
180
|
"@backstage/test-utils": "1.7.8",
|
|
182
181
|
"@backstage/theme": "0.6.6",
|
|
183
182
|
"@rspack/core": "^1.3.9",
|
|
@@ -12,22 +12,16 @@ import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
|
|
|
12
12
|
export function createExampleAction() {
|
|
13
13
|
// For more information on how to define custom actions, see
|
|
14
14
|
// https://backstage.io/docs/features/software-templates/writing-custom-actions
|
|
15
|
-
return createTemplateAction
|
|
16
|
-
myParameter: string;
|
|
17
|
-
}>({
|
|
15
|
+
return createTemplateAction({
|
|
18
16
|
id: 'acme:example',
|
|
19
17
|
description: 'Runs an example action',
|
|
20
18
|
schema: {
|
|
21
19
|
input: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
description: "This is an example parameter, don't set it to foo",
|
|
28
|
-
type: 'string',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
20
|
+
myParameter: z =>
|
|
21
|
+
z.string({
|
|
22
|
+
description:
|
|
23
|
+
"This is an example parameter, don't set it to foo",
|
|
24
|
+
}),
|
|
31
25
|
},
|
|
32
26
|
},
|
|
33
27
|
async handler(ctx) {
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('../modules/config/index.cjs.js');
|
|
4
|
-
var index$2 = require('../modules/build/index.cjs.js');
|
|
5
|
-
var index$3 = require('../modules/info/index.cjs.js');
|
|
6
|
-
var index$1 = require('../modules/migrate/index.cjs.js');
|
|
7
|
-
var index$6 = require('../modules/test/index.cjs.js');
|
|
8
|
-
var index$7 = require('../modules/lint/index.cjs.js');
|
|
9
|
-
var index$8 = require('../modules/maintenance/index.cjs.js');
|
|
10
|
-
var removed = require('../lib/removed.cjs.js');
|
|
11
|
-
var index$4 = require('../modules/new/index.cjs.js');
|
|
12
|
-
var index$5 = require('../modules/create-github-app/index.cjs.js');
|
|
13
|
-
|
|
14
|
-
function registerRepoCommand(program) {
|
|
15
|
-
const command = program.command("repo [command]").description("Command that run across an entire Backstage project");
|
|
16
|
-
index$2.registerRepoCommands(command);
|
|
17
|
-
index$6.registerRepoCommands(command);
|
|
18
|
-
index$7.registerRepoCommands(command);
|
|
19
|
-
index$8.registerRepoCommands(command);
|
|
20
|
-
}
|
|
21
|
-
function registerScriptCommand(program) {
|
|
22
|
-
const command = program.command("package [command]").description("Lifecycle scripts for individual packages");
|
|
23
|
-
index$2.registerPackageCommands(command);
|
|
24
|
-
index$6.registerPackageCommands(command);
|
|
25
|
-
index$8.registerPackageCommands(command);
|
|
26
|
-
index$7.registerPackageCommands(command);
|
|
27
|
-
}
|
|
28
|
-
function registerCommands(program) {
|
|
29
|
-
index.registerCommands(program);
|
|
30
|
-
registerRepoCommand(program);
|
|
31
|
-
registerScriptCommand(program);
|
|
32
|
-
index$1.registerCommands(program);
|
|
33
|
-
index$2.registerCommands(program);
|
|
34
|
-
index$3.registerCommands(program);
|
|
35
|
-
index$4.registerCommands(program);
|
|
36
|
-
index$5.registerCommands(program);
|
|
37
|
-
program.command("plugin:diff").allowUnknownOption(true).action(removed.removed("use 'backstage-cli fix' instead"));
|
|
38
|
-
program.command("test").allowUnknownOption(true).action(
|
|
39
|
-
removed.removed(
|
|
40
|
-
"use 'backstage-cli repo test' or 'backstage-cli package test' instead"
|
|
41
|
-
)
|
|
42
|
-
);
|
|
43
|
-
program.command("clean").allowUnknownOption(true).action(removed.removed("use 'backstage-cli package clean' instead"));
|
|
44
|
-
program.command("versions:check").allowUnknownOption(true).action(removed.removed("use 'yarn dedupe' or 'yarn-deduplicate' instead"));
|
|
45
|
-
program.command("install").allowUnknownOption(true).action(removed.removed());
|
|
46
|
-
program.command("onboard").allowUnknownOption(true).action(removed.removed());
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.registerCommands = registerCommands;
|
|
50
|
-
exports.registerRepoCommand = registerRepoCommand;
|
|
51
|
-
exports.registerScriptCommand = registerScriptCommand;
|
|
52
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var yaml = require('yaml');
|
|
6
|
-
var config$1 = require('@backstage/config');
|
|
7
|
-
var config = require('../lib/config.cjs.js');
|
|
8
|
-
|
|
9
|
-
var print = async (opts) => {
|
|
10
|
-
const { schema, appConfigs } = await config.loadCliConfig({
|
|
11
|
-
args: opts.config,
|
|
12
|
-
fromPackage: opts.package,
|
|
13
|
-
mockEnv: opts.lax,
|
|
14
|
-
fullVisibility: !opts.frontend
|
|
15
|
-
});
|
|
16
|
-
const visibility = getVisibilityOption(opts);
|
|
17
|
-
const data = serializeConfigData(appConfigs, schema, visibility);
|
|
18
|
-
if (opts.format === "json") {
|
|
19
|
-
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
20
|
-
`);
|
|
21
|
-
} else {
|
|
22
|
-
process.stdout.write(`${yaml.stringify(data)}
|
|
23
|
-
`);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
function getVisibilityOption(opts) {
|
|
27
|
-
if (opts.frontend && opts.withSecrets) {
|
|
28
|
-
throw new Error("Not allowed to combine frontend and secret config");
|
|
29
|
-
}
|
|
30
|
-
if (opts.frontend) {
|
|
31
|
-
return "frontend";
|
|
32
|
-
} else if (opts.withSecrets) {
|
|
33
|
-
return "secret";
|
|
34
|
-
}
|
|
35
|
-
return "backend";
|
|
36
|
-
}
|
|
37
|
-
function serializeConfigData(appConfigs, schema, visibility) {
|
|
38
|
-
if (visibility === "frontend") {
|
|
39
|
-
const frontendConfigs = schema.process(appConfigs, {
|
|
40
|
-
visibility: ["frontend"]
|
|
41
|
-
});
|
|
42
|
-
return config$1.ConfigReader.fromConfigs(frontendConfigs).get();
|
|
43
|
-
} else if (visibility === "secret") {
|
|
44
|
-
return config$1.ConfigReader.fromConfigs(appConfigs).get();
|
|
45
|
-
}
|
|
46
|
-
const sanitizedConfigs = schema.process(appConfigs, {
|
|
47
|
-
valueTransform: (value, context) => context.visibility === "secret" ? "<secret>" : value
|
|
48
|
-
});
|
|
49
|
-
return config$1.ConfigReader.fromConfigs(sanitizedConfigs).get();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.default = print;
|
|
53
|
-
//# sourceMappingURL=print.cjs.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var config = require('../lib/config.cjs.js');
|
|
6
|
-
|
|
7
|
-
var validate = async (opts) => {
|
|
8
|
-
await config.loadCliConfig({
|
|
9
|
-
args: opts.config,
|
|
10
|
-
fromPackage: opts.package,
|
|
11
|
-
mockEnv: opts.lax,
|
|
12
|
-
fullVisibility: !opts.frontend,
|
|
13
|
-
withDeprecatedKeys: opts.deprecated,
|
|
14
|
-
strict: opts.strict
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.default = validate;
|
|
19
|
-
//# sourceMappingURL=validate.cjs.js.map
|