@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.
- package/CHANGELOG.md +42 -0
- package/config/jest.js +2 -2
- 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/{maintenance → build}/commands/package/clean.cjs.js +4 -2
- package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
- package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
- 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/package/start/startFrontend.cjs.js +1 -1
- package/dist/modules/build/commands/repo/build.cjs.js +46 -11
- package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
- package/dist/modules/build/commands/repo/start.cjs.js +54 -5
- package/dist/modules/build/index.cjs.js +32 -123
- package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
- package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
- package/dist/modules/build/lib/config.cjs.js +94 -0
- package/dist/modules/build/lib/optionsParser.cjs.js +22 -0
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
- package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
- package/dist/modules/build/lib/role.cjs.js +1 -1
- package/dist/modules/config/commands/docs.cjs.js +19 -2
- package/dist/modules/config/commands/print.cjs.js +41 -13
- package/dist/modules/config/commands/schema.cjs.js +25 -6
- package/dist/modules/config/commands/validate.cjs.js +38 -7
- package/dist/modules/config/index.cjs.js +6 -65
- package/dist/modules/config/lib/config.cjs.js +6 -22
- 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 +26 -6
- package/dist/modules/info/index.cjs.js +1 -23
- package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
- package/dist/modules/lint/commands/repo/lint.cjs.js +99 -27
- package/dist/modules/lint/index.cjs.js +2 -60
- package/dist/modules/lint/lib/optionsParser.cjs.js +22 -0
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +32 -9
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
- package/dist/modules/maintenance/index.cjs.js +2 -64
- package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
- package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
- package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
- package/dist/modules/migrate/commands/versions/bump.cjs.js +48 -20
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
- package/dist/modules/migrate/index.cjs.js +12 -55
- package/dist/modules/new/commands/new.cjs.js +70 -15
- package/dist/modules/new/index.cjs.js +1 -29
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
- package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
- package/dist/modules/test/commands/package/test.cjs.js +1 -10
- package/dist/modules/test/commands/repo/test.cjs.js +51 -39
- package/dist/modules/test/index.cjs.js +2 -32
- package/dist/modules/translations/commands/export.cjs.js +25 -1
- package/dist/modules/translations/commands/import.cjs.js +25 -1
- package/dist/modules/translations/index.cjs.js +2 -37
- 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 -6
- 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/dev-utils/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 +24 -7
- package/dist/wiring/version.cjs.js +20 -0
- package/package.json +26 -22
- package/dist/lib/cache/SuccessCache.cjs.js +0 -79
- package/dist/lib/lazy.cjs.js +0 -22
- package/dist/lib/optionsParser.cjs.js +0 -37
- package/dist/lib/versioning/Lockfile.cjs.js +0 -89
- package/dist/lib/yarnPlugin.cjs.js +0 -46
- /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
- /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
- /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
- /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
- /package/dist/{lib → wiring}/errors.cjs.js +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var configLoader = require('@backstage/config-loader');
|
|
4
|
+
var config = require('@backstage/config');
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
|
+
var getPackages = require('@manypkg/get-packages');
|
|
7
|
+
var cliNode = require('@backstage/cli-node');
|
|
8
|
+
var path = require('node:path');
|
|
9
|
+
|
|
10
|
+
async function loadCliConfig(options) {
|
|
11
|
+
const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
|
|
12
|
+
const { packages } = await getPackages.getPackages(targetDir);
|
|
13
|
+
let localPackageNames;
|
|
14
|
+
if (options.fromPackage) {
|
|
15
|
+
if (packages.length) {
|
|
16
|
+
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
17
|
+
localPackageNames = Array.from(
|
|
18
|
+
graph.collectPackageNames([options.fromPackage], (node) => {
|
|
19
|
+
if (node.name === "@backstage/cli") {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
return node.localDependencies.keys();
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
} else {
|
|
26
|
+
localPackageNames = [options.fromPackage];
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
localPackageNames = packages.map((p) => p.packageJson.name);
|
|
30
|
+
}
|
|
31
|
+
const schema = await configLoader.loadConfigSchema({
|
|
32
|
+
dependencies: localPackageNames,
|
|
33
|
+
packagePaths: [cliCommon.targetPaths.resolveRoot("package.json")]
|
|
34
|
+
});
|
|
35
|
+
const source = configLoader.ConfigSources.default({
|
|
36
|
+
allowMissingDefaultConfig: true,
|
|
37
|
+
watch: Boolean(options.watch),
|
|
38
|
+
rootDir: cliCommon.targetPaths.rootDir,
|
|
39
|
+
argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
|
|
40
|
+
});
|
|
41
|
+
const appConfigs = await new Promise((resolve, reject) => {
|
|
42
|
+
async function loadConfigReaderLoop() {
|
|
43
|
+
let loaded = false;
|
|
44
|
+
try {
|
|
45
|
+
const abortController = new AbortController();
|
|
46
|
+
for await (const { configs } of source.readConfigData({
|
|
47
|
+
signal: abortController.signal
|
|
48
|
+
})) {
|
|
49
|
+
if (loaded) {
|
|
50
|
+
const newFrontendAppConfigs = schema.process(configs, {
|
|
51
|
+
visibility: ["frontend"],
|
|
52
|
+
withFilteredKeys: options.withFilteredKeys,
|
|
53
|
+
ignoreSchemaErrors: true
|
|
54
|
+
});
|
|
55
|
+
options.watch?.(newFrontendAppConfigs);
|
|
56
|
+
} else {
|
|
57
|
+
resolve(configs);
|
|
58
|
+
loaded = true;
|
|
59
|
+
if (!options.watch) {
|
|
60
|
+
abortController.abort();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (loaded) {
|
|
66
|
+
console.error(`Failed to reload configuration, ${error}`);
|
|
67
|
+
} else {
|
|
68
|
+
reject(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
loadConfigReaderLoop();
|
|
73
|
+
});
|
|
74
|
+
const configurationLoadedMessage = appConfigs.length ? `Loaded config from ${appConfigs.map((c) => c.context).join(", ")}` : `No configuration files found, running without config`;
|
|
75
|
+
process.stderr.write(`${configurationLoadedMessage}
|
|
76
|
+
`);
|
|
77
|
+
const frontendAppConfigs = schema.process(appConfigs, {
|
|
78
|
+
visibility: ["frontend"],
|
|
79
|
+
withFilteredKeys: options.withFilteredKeys,
|
|
80
|
+
ignoreSchemaErrors: true
|
|
81
|
+
});
|
|
82
|
+
const frontendConfig = config.ConfigReader.fromConfigs(frontendAppConfigs);
|
|
83
|
+
const fullConfig = config.ConfigReader.fromConfigs(appConfigs);
|
|
84
|
+
return {
|
|
85
|
+
schema,
|
|
86
|
+
appConfigs,
|
|
87
|
+
frontendConfig,
|
|
88
|
+
frontendAppConfigs,
|
|
89
|
+
fullConfig
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
exports.loadCliConfig = loadCliConfig;
|
|
94
|
+
//# sourceMappingURL=config.cjs.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_util = require('node:util');
|
|
4
|
+
var shellQuote = require('shell-quote');
|
|
5
|
+
|
|
6
|
+
function createScriptOptionsParser(commandPath, options) {
|
|
7
|
+
const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
|
|
8
|
+
return (scriptStr) => {
|
|
9
|
+
if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
const argsStr = scriptStr.slice(expectedScript.length).trim();
|
|
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;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.createScriptOptionsParser = createScriptOptionsParser;
|
|
22
|
+
//# sourceMappingURL=optionsParser.cjs.js.map
|
|
@@ -12,7 +12,7 @@ var packager = require('../builder/packager.cjs.js');
|
|
|
12
12
|
var types = require('../builder/types.cjs.js');
|
|
13
13
|
var productionPack = require('./productionPack.cjs.js');
|
|
14
14
|
var cliNode = require('@backstage/cli-node');
|
|
15
|
-
var typeDistProject = require('
|
|
15
|
+
var typeDistProject = require('../typeDistProject.cjs.js');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
18
|
|
|
@@ -4,7 +4,7 @@ var fs = require('fs-extra');
|
|
|
4
4
|
var npmPackList = require('npm-packlist');
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var entryPoints = require('../entryPoints.cjs.js');
|
|
7
|
-
var typeDistProject = require('
|
|
7
|
+
var typeDistProject = require('../typeDistProject.cjs.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
10
|
|
|
@@ -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);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var configLoader = require('@backstage/config-loader');
|
|
6
7
|
var openBrowser = require('react-dev-utils/openBrowser');
|
|
7
8
|
var chalk = require('chalk');
|
|
@@ -13,10 +14,26 @@ var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
|
|
|
13
14
|
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
14
15
|
|
|
15
16
|
const DOCS_URL = "https://config.backstage.io";
|
|
16
|
-
var docs = async (
|
|
17
|
+
var docs = async ({ args, info }) => {
|
|
18
|
+
const {
|
|
19
|
+
flags: { package: pkg }
|
|
20
|
+
} = cleye.cli(
|
|
21
|
+
{
|
|
22
|
+
help: info,
|
|
23
|
+
booleanFlagNegation: true,
|
|
24
|
+
flags: {
|
|
25
|
+
package: {
|
|
26
|
+
type: String,
|
|
27
|
+
description: "Only include the schema that applies to the given package"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
void 0,
|
|
32
|
+
args
|
|
33
|
+
);
|
|
17
34
|
const { schema: appSchemas } = await config.loadCliConfig({
|
|
18
35
|
args: [],
|
|
19
|
-
fromPackage:
|
|
36
|
+
fromPackage: pkg,
|
|
20
37
|
mockEnv: true
|
|
21
38
|
});
|
|
22
39
|
const schema = configLoader.mergeConfigSchemas(
|
|
@@ -2,34 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var cleye = require('cleye');
|
|
6
|
+
var YAML = require('yaml');
|
|
6
7
|
var config$1 = require('@backstage/config');
|
|
7
8
|
var config = require('../lib/config.cjs.js');
|
|
8
9
|
|
|
9
|
-
var print = async (
|
|
10
|
+
var print = async ({ args, info }) => {
|
|
11
|
+
const {
|
|
12
|
+
flags: { config: config$1, lax, frontend, withSecrets, format, package: pkg }
|
|
13
|
+
} = cleye.cli(
|
|
14
|
+
{
|
|
15
|
+
help: info,
|
|
16
|
+
booleanFlagNegation: true,
|
|
17
|
+
flags: {
|
|
18
|
+
package: { type: String, description: "Package to print config for" },
|
|
19
|
+
lax: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
description: "Do not require environment variables to be set"
|
|
22
|
+
},
|
|
23
|
+
frontend: { type: Boolean, description: "Only print frontend config" },
|
|
24
|
+
withSecrets: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
description: "Include secrets in the output"
|
|
27
|
+
},
|
|
28
|
+
format: { type: String, description: "Output format (yaml or json)" },
|
|
29
|
+
config: {
|
|
30
|
+
type: [String],
|
|
31
|
+
description: "Config files to load instead of app-config.yaml"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
void 0,
|
|
36
|
+
args
|
|
37
|
+
);
|
|
10
38
|
const { schema, appConfigs } = await config.loadCliConfig({
|
|
11
|
-
args:
|
|
12
|
-
fromPackage:
|
|
13
|
-
mockEnv:
|
|
14
|
-
fullVisibility: !
|
|
39
|
+
args: config$1,
|
|
40
|
+
fromPackage: pkg,
|
|
41
|
+
mockEnv: lax,
|
|
42
|
+
fullVisibility: !frontend
|
|
15
43
|
});
|
|
16
|
-
const visibility = getVisibilityOption(
|
|
44
|
+
const visibility = getVisibilityOption(frontend, withSecrets);
|
|
17
45
|
const data = serializeConfigData(appConfigs, schema, visibility);
|
|
18
|
-
if (
|
|
46
|
+
if (format === "json") {
|
|
19
47
|
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
20
48
|
`);
|
|
21
49
|
} else {
|
|
22
|
-
process.stdout.write(`${
|
|
50
|
+
process.stdout.write(`${YAML.stringify(data)}
|
|
23
51
|
`);
|
|
24
52
|
}
|
|
25
53
|
};
|
|
26
|
-
function getVisibilityOption(
|
|
27
|
-
if (
|
|
54
|
+
function getVisibilityOption(frontend, withSecrets) {
|
|
55
|
+
if (frontend && withSecrets) {
|
|
28
56
|
throw new Error("Not allowed to combine frontend and secret config");
|
|
29
57
|
}
|
|
30
|
-
if (
|
|
58
|
+
if (frontend) {
|
|
31
59
|
return "frontend";
|
|
32
|
-
} else if (
|
|
60
|
+
} else if (withSecrets) {
|
|
33
61
|
return "secret";
|
|
34
62
|
}
|
|
35
63
|
return "backend";
|
|
@@ -2,18 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var cleye = require('cleye');
|
|
6
|
+
var YAML = require('yaml');
|
|
6
7
|
var config = require('../lib/config.cjs.js');
|
|
7
8
|
var configLoader = require('@backstage/config-loader');
|
|
8
9
|
|
|
9
|
-
var schema = async (
|
|
10
|
+
var schema = async ({ args, info }) => {
|
|
11
|
+
const {
|
|
12
|
+
flags: { merge, format, package: pkg }
|
|
13
|
+
} = cleye.cli(
|
|
14
|
+
{
|
|
15
|
+
help: info,
|
|
16
|
+
booleanFlagNegation: true,
|
|
17
|
+
flags: {
|
|
18
|
+
package: { type: String, description: "Package to print schema for" },
|
|
19
|
+
format: { type: String, description: "Output format (yaml or json)" },
|
|
20
|
+
merge: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
description: "Merge all schemas into a single schema"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
void 0,
|
|
27
|
+
args
|
|
28
|
+
);
|
|
10
29
|
const { schema } = await config.loadCliConfig({
|
|
11
30
|
args: [],
|
|
12
|
-
fromPackage:
|
|
31
|
+
fromPackage: pkg,
|
|
13
32
|
mockEnv: true
|
|
14
33
|
});
|
|
15
34
|
let configSchema;
|
|
16
|
-
if (
|
|
35
|
+
if (merge) {
|
|
17
36
|
configSchema = configLoader.mergeConfigSchemas(
|
|
18
37
|
schema.serialize().schemas.map(
|
|
19
38
|
(_) => _.value
|
|
@@ -24,11 +43,11 @@ var schema = async (opts) => {
|
|
|
24
43
|
} else {
|
|
25
44
|
configSchema = schema.serialize();
|
|
26
45
|
}
|
|
27
|
-
if (
|
|
46
|
+
if (format === "json") {
|
|
28
47
|
process.stdout.write(`${JSON.stringify(configSchema, null, 2)}
|
|
29
48
|
`);
|
|
30
49
|
} else {
|
|
31
|
-
process.stdout.write(`${
|
|
50
|
+
process.stdout.write(`${YAML.stringify(configSchema)}
|
|
32
51
|
`);
|
|
33
52
|
}
|
|
34
53
|
};
|
|
@@ -2,16 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var config = require('../lib/config.cjs.js');
|
|
6
7
|
|
|
7
|
-
var validate = async (
|
|
8
|
+
var validate = async ({ args, info }) => {
|
|
9
|
+
const {
|
|
10
|
+
flags: { config: config$1, lax, frontend, deprecated, strict, package: pkg }
|
|
11
|
+
} = cleye.cli(
|
|
12
|
+
{
|
|
13
|
+
help: info,
|
|
14
|
+
booleanFlagNegation: true,
|
|
15
|
+
flags: {
|
|
16
|
+
package: {
|
|
17
|
+
type: String,
|
|
18
|
+
description: "Package to validate config for"
|
|
19
|
+
},
|
|
20
|
+
lax: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
description: "Do not require environment variables to be set"
|
|
23
|
+
},
|
|
24
|
+
frontend: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
description: "Only validate frontend config"
|
|
27
|
+
},
|
|
28
|
+
deprecated: { type: Boolean, description: "Output deprecated keys" },
|
|
29
|
+
strict: { type: Boolean, description: "Enable strict validation" },
|
|
30
|
+
config: {
|
|
31
|
+
type: [String],
|
|
32
|
+
description: "Config files to load instead of app-config.yaml"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
void 0,
|
|
37
|
+
args
|
|
38
|
+
);
|
|
8
39
|
await config.loadCliConfig({
|
|
9
|
-
args:
|
|
10
|
-
fromPackage:
|
|
11
|
-
mockEnv:
|
|
12
|
-
fullVisibility: !
|
|
13
|
-
withDeprecatedKeys:
|
|
14
|
-
strict
|
|
40
|
+
args: config$1,
|
|
41
|
+
fromPackage: pkg,
|
|
42
|
+
mockEnv: lax,
|
|
43
|
+
fullVisibility: !frontend,
|
|
44
|
+
withDeprecatedKeys: deprecated,
|
|
45
|
+
strict
|
|
15
46
|
});
|
|
16
47
|
};
|
|
17
48
|
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
var yargs = require('yargs');
|
|
7
|
-
var commander = require('commander');
|
|
8
|
-
var lazy = require('../../lib/lazy.cjs.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
|
|
13
6
|
|
|
14
7
|
const configOption = [
|
|
15
8
|
"--config <path>",
|
|
@@ -23,84 +16,32 @@ var index = factory.createCliPlugin({
|
|
|
23
16
|
reg.addCommand({
|
|
24
17
|
path: ["config:docs"],
|
|
25
18
|
description: "Browse the configuration reference documentation",
|
|
26
|
-
execute:
|
|
27
|
-
const command = new commander.Command();
|
|
28
|
-
const defaultCommand = command.option(
|
|
29
|
-
"--package <name>",
|
|
30
|
-
"Only include the schema that applies to the given package"
|
|
31
|
-
).description("Browse the configuration reference documentation").action(lazy.lazy(() => import('./commands/docs.cjs.js'), "default"));
|
|
32
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
33
|
-
}
|
|
19
|
+
execute: { loader: () => import('./commands/docs.cjs.js') }
|
|
34
20
|
});
|
|
35
21
|
reg.addCommand({
|
|
36
22
|
path: ["config", "docs"],
|
|
37
23
|
description: "Browse the configuration reference documentation",
|
|
38
|
-
execute:
|
|
39
|
-
await new commander.Command(info.usage).option(
|
|
40
|
-
"--package <name>",
|
|
41
|
-
"Only include the schema that applies to the given package"
|
|
42
|
-
).description(info.description).action(lazy.lazy(() => import('./commands/docs.cjs.js'), "default")).parseAsync(args, { from: "user" });
|
|
43
|
-
}
|
|
24
|
+
execute: { loader: () => import('./commands/docs.cjs.js') }
|
|
44
25
|
});
|
|
45
26
|
reg.addCommand({
|
|
46
27
|
path: ["config:print"],
|
|
47
28
|
description: "Print the app configuration for the current package",
|
|
48
|
-
execute:
|
|
49
|
-
const argv = await yargs__default.default().options({
|
|
50
|
-
package: { type: "string" },
|
|
51
|
-
lax: { type: "boolean" },
|
|
52
|
-
frontend: { type: "boolean" },
|
|
53
|
-
"with-secrets": { type: "boolean" },
|
|
54
|
-
format: { type: "string" },
|
|
55
|
-
config: { type: "string", array: true, default: [] }
|
|
56
|
-
}).usage("$0", info.description).help().parse(args);
|
|
57
|
-
await lazy.lazy(() => import('./commands/print.cjs.js'), "default")(argv);
|
|
58
|
-
}
|
|
29
|
+
execute: { loader: () => import('./commands/print.cjs.js') }
|
|
59
30
|
});
|
|
60
31
|
reg.addCommand({
|
|
61
32
|
path: ["config:check"],
|
|
62
33
|
description: "Validate that the given configuration loads and matches schema",
|
|
63
|
-
execute:
|
|
64
|
-
const argv = await yargs__default.default().options({
|
|
65
|
-
package: { type: "string" },
|
|
66
|
-
lax: { type: "boolean" },
|
|
67
|
-
frontend: { type: "boolean" },
|
|
68
|
-
deprecated: { type: "boolean" },
|
|
69
|
-
strict: { type: "boolean" },
|
|
70
|
-
config: {
|
|
71
|
-
type: "string",
|
|
72
|
-
array: true,
|
|
73
|
-
default: []
|
|
74
|
-
}
|
|
75
|
-
}).help().parse(args);
|
|
76
|
-
await lazy.lazy(() => import('./commands/validate.cjs.js'), "default")(argv);
|
|
77
|
-
}
|
|
34
|
+
execute: { loader: () => import('./commands/validate.cjs.js') }
|
|
78
35
|
});
|
|
79
36
|
reg.addCommand({
|
|
80
37
|
path: ["config:schema"],
|
|
81
38
|
description: "Print the JSON schema for the given configuration",
|
|
82
|
-
execute:
|
|
83
|
-
const argv = await yargs__default.default().options({
|
|
84
|
-
package: { type: "string" },
|
|
85
|
-
format: { type: "string" },
|
|
86
|
-
merge: { type: "boolean" },
|
|
87
|
-
"no-merge": { type: "boolean" }
|
|
88
|
-
}).help().parse(args);
|
|
89
|
-
await lazy.lazy(() => import('./commands/schema.cjs.js'), "default")(argv);
|
|
90
|
-
}
|
|
39
|
+
execute: { loader: () => import('./commands/schema.cjs.js') }
|
|
91
40
|
});
|
|
92
41
|
reg.addCommand({
|
|
93
42
|
path: ["config", "schema"],
|
|
94
43
|
description: "Print the JSON schema for the given configuration",
|
|
95
|
-
execute:
|
|
96
|
-
const argv = await yargs__default.default().options({
|
|
97
|
-
package: { type: "string" },
|
|
98
|
-
format: { type: "string" },
|
|
99
|
-
merge: { type: "boolean" },
|
|
100
|
-
"no-merge": { type: "boolean" }
|
|
101
|
-
}).help().parse(args);
|
|
102
|
-
await lazy.lazy(() => import('./commands/schema.cjs.js'), "default")(argv);
|
|
103
|
-
}
|
|
44
|
+
execute: { loader: () => import('./commands/schema.cjs.js') }
|
|
104
45
|
});
|
|
105
46
|
}
|
|
106
47
|
});
|
|
@@ -37,43 +37,28 @@ async function loadCliConfig(options) {
|
|
|
37
37
|
const source = configLoader.ConfigSources.default({
|
|
38
38
|
allowMissingDefaultConfig: true,
|
|
39
39
|
substitutionFunc: options.mockEnv ? async (name) => process.env[name] || "x" : void 0,
|
|
40
|
-
watch: Boolean(options.watch),
|
|
41
40
|
rootDir: cliCommon.targetPaths.rootDir,
|
|
42
41
|
argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
|
|
43
42
|
});
|
|
44
43
|
const appConfigs = await new Promise((resolve, reject) => {
|
|
45
|
-
async function
|
|
44
|
+
async function readConfig() {
|
|
46
45
|
let loaded = false;
|
|
47
46
|
try {
|
|
48
47
|
const abortController = new AbortController();
|
|
49
48
|
for await (const { configs } of source.readConfigData({
|
|
50
49
|
signal: abortController.signal
|
|
51
50
|
})) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
withFilteredKeys: options.withFilteredKeys,
|
|
56
|
-
withDeprecatedKeys: options.withDeprecatedKeys,
|
|
57
|
-
ignoreSchemaErrors: !options.strict
|
|
58
|
-
});
|
|
59
|
-
options.watch?.(newFrontendAppConfigs);
|
|
60
|
-
} else {
|
|
61
|
-
resolve(configs);
|
|
62
|
-
loaded = true;
|
|
63
|
-
if (!options.watch) {
|
|
64
|
-
abortController.abort();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
51
|
+
resolve(configs);
|
|
52
|
+
loaded = true;
|
|
53
|
+
abortController.abort();
|
|
67
54
|
}
|
|
68
55
|
} catch (error) {
|
|
69
|
-
if (loaded) {
|
|
70
|
-
console.error(`Failed to reload configuration, ${error}`);
|
|
71
|
-
} else {
|
|
56
|
+
if (!loaded) {
|
|
72
57
|
reject(error);
|
|
73
58
|
}
|
|
74
59
|
}
|
|
75
60
|
}
|
|
76
|
-
|
|
61
|
+
readConfig();
|
|
77
62
|
});
|
|
78
63
|
const configurationLoadedMessage = appConfigs.length ? `Loaded config from ${appConfigs.map((c) => c.context).join(", ")}` : `No configuration files found, running without config`;
|
|
79
64
|
process.stderr.write(`${configurationLoadedMessage}
|
|
@@ -81,7 +66,6 @@ async function loadCliConfig(options) {
|
|
|
81
66
|
try {
|
|
82
67
|
const frontendAppConfigs = schema.process(appConfigs, {
|
|
83
68
|
visibility: options.fullVisibility ? ["frontend", "backend", "secret"] : ["frontend"],
|
|
84
|
-
withFilteredKeys: options.withFilteredKeys,
|
|
85
69
|
withDeprecatedKeys: options.withDeprecatedKeys,
|
|
86
70
|
ignoreSchemaErrors: !options.strict
|
|
87
71
|
});
|
|
@@ -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('../../lib/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
|
});
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var _package = require('../../../packages/cli/package.json.cjs.js');
|
|
6
7
|
var os = require('node:os');
|
|
7
8
|
var cliCommon = require('@backstage/cli-common');
|
|
8
|
-
var Lockfile = require('../../../lib/versioning/Lockfile.cjs.js');
|
|
9
|
-
var minimatch = require('minimatch');
|
|
10
|
-
require('@manypkg/get-packages');
|
|
11
|
-
require('@backstage/errors');
|
|
12
9
|
var cliNode = require('@backstage/cli-node');
|
|
10
|
+
var minimatch = require('minimatch');
|
|
13
11
|
var fs = require('fs-extra');
|
|
14
12
|
|
|
15
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -30,7 +28,29 @@ function hasBackstageField(packageName, targetPath) {
|
|
|
30
28
|
const pkg = tryReadPackageJson(packageName, targetPath);
|
|
31
29
|
return pkg?.backstage !== void 0;
|
|
32
30
|
}
|
|
33
|
-
var info = async (
|
|
31
|
+
var info = async ({ args, info }) => {
|
|
32
|
+
const {
|
|
33
|
+
flags: { include, format }
|
|
34
|
+
} = cleye.cli(
|
|
35
|
+
{
|
|
36
|
+
help: info,
|
|
37
|
+
booleanFlagNegation: true,
|
|
38
|
+
flags: {
|
|
39
|
+
include: {
|
|
40
|
+
type: [String],
|
|
41
|
+
description: "Glob patterns for additional packages to include (e.g., @spotify/backstage*)"
|
|
42
|
+
},
|
|
43
|
+
format: {
|
|
44
|
+
type: String,
|
|
45
|
+
description: "Output format (text or json)",
|
|
46
|
+
default: "text"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
void 0,
|
|
51
|
+
args
|
|
52
|
+
);
|
|
53
|
+
const options = { include, format };
|
|
34
54
|
await new Promise(async () => {
|
|
35
55
|
const yarnVersion = await cliCommon.runOutput(["yarn", "--version"]);
|
|
36
56
|
const isLocal = fs__default.default.existsSync(cliCommon.findOwnPaths(__dirname).resolve("./src"));
|
|
@@ -57,7 +77,7 @@ var info = async (options) => {
|
|
|
57
77
|
backstage: backstageVersion
|
|
58
78
|
};
|
|
59
79
|
const lockfilePath = cliCommon.targetPaths.resolveRoot("yarn.lock");
|
|
60
|
-
const lockfile = await
|
|
80
|
+
const lockfile = await cliNode.Lockfile.load(lockfilePath);
|
|
61
81
|
const targetPath = cliCommon.targetPaths.rootDir;
|
|
62
82
|
const workspacePackages = /* @__PURE__ */ new Map();
|
|
63
83
|
try {
|