@backstage/cli 0.35.5-next.0 → 0.36.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 +27 -0
- package/config/jest.js +2 -2
- 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/startFrontend.cjs.js +1 -1
- package/dist/modules/build/commands/repo/build.cjs.js +1 -1
- package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
- package/dist/modules/build/index.cjs.js +37 -4
- 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/{lib → modules/build/lib}/optionsParser.cjs.js +2 -2
- 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/config/commands/docs.cjs.js +18 -2
- package/dist/modules/config/commands/print.cjs.js +38 -11
- package/dist/modules/config/commands/schema.cjs.js +22 -4
- package/dist/modules/config/commands/validate.cjs.js +37 -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/index.cjs.js +1 -1
- package/dist/modules/info/commands/info.cjs.js +25 -6
- package/dist/modules/info/index.cjs.js +1 -23
- package/dist/modules/lint/commands/repo/lint.cjs.js +5 -3
- package/dist/modules/lint/index.cjs.js +1 -1
- package/dist/modules/lint/lib/optionsParser.cjs.js +37 -0
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +1 -4
- package/dist/modules/maintenance/index.cjs.js +1 -45
- 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 +7 -9
- package/dist/modules/migrate/index.cjs.js +11 -31
- package/dist/modules/new/index.cjs.js +1 -1
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +6 -6
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +16 -16
- package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
- package/dist/modules/test/commands/package/test.cjs.js +0 -3
- package/dist/modules/test/commands/repo/test.cjs.js +6 -5
- package/dist/modules/test/index.cjs.js +1 -1
- package/dist/modules/translations/commands/export.cjs.js +24 -1
- package/dist/modules/translations/commands/import.cjs.js +24 -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-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 +2 -4
- package/dist/packages/dev-utils/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/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 -5
- package/dist/wiring/version.cjs.js +20 -0
- package/package.json +13 -15
- package/dist/lib/cache/SuccessCache.cjs.js +0 -79
- 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
- /package/dist/{lib → wiring}/lazy.cjs.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/cli
|
|
2
2
|
|
|
3
|
+
## 0.36.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b36a60d: **BREAKING**: The `migrate package-exports` command has been removed. Use `repo fix` instead.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 0d2d0f2: Internal refactor of CLI modularization, moving individual commands to be implemented with cleye.
|
|
12
|
+
- 2fcba39: Internal refactor to move shared utilities into their consuming modules, reducing cross-module dependencies.
|
|
13
|
+
- c85ac86: Internal refactor to split `loadCliConfig` into separate implementations for the build and config CLI modules, removing a cross-module dependency.
|
|
14
|
+
- 61cb976: Migrated internal versioning utilities to use `@backstage/cli-node` instead of a local implementation.
|
|
15
|
+
- 825c81d: Internal refactor of CLI command modules.
|
|
16
|
+
- a9d23c4: Properly support `package.json` `workspaces` field
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @backstage/cli-common@0.2.0-next.1
|
|
19
|
+
- @backstage/cli-node@0.2.19-next.1
|
|
20
|
+
- @backstage/module-federation-common@0.1.2-next.0
|
|
21
|
+
- @backstage/integration@2.0.0-next.1
|
|
22
|
+
- @backstage/catalog-model@1.7.6
|
|
23
|
+
- @backstage/config@1.3.6
|
|
24
|
+
- @backstage/config-loader@1.10.9-next.0
|
|
25
|
+
- @backstage/errors@1.2.7
|
|
26
|
+
- @backstage/eslint-plugin@0.2.2-next.0
|
|
27
|
+
- @backstage/release-manifests@0.0.13
|
|
28
|
+
- @backstage/types@1.2.2
|
|
29
|
+
|
|
3
30
|
## 0.35.5-next.0
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/config/jest.js
CHANGED
|
@@ -336,8 +336,8 @@ async function getRootConfig() {
|
|
|
336
336
|
rejectFrontendNetworkRequests,
|
|
337
337
|
};
|
|
338
338
|
|
|
339
|
-
const
|
|
340
|
-
|
|
339
|
+
const ws = rootPkgJson.workspaces;
|
|
340
|
+
const workspacePatterns = Array.isArray(ws) ? ws : ws?.packages;
|
|
341
341
|
|
|
342
342
|
// Check if we're running within a specific monorepo package. In that case just get the single project config.
|
|
343
343
|
if (!workspacePatterns || paths.targetRoot !== paths.targetDir) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var fs = require('fs-extra');
|
|
6
7
|
var cliCommon = require('@backstage/cli-common');
|
|
7
8
|
|
|
@@ -9,11 +10,12 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
10
|
|
|
10
11
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
11
12
|
|
|
12
|
-
async
|
|
13
|
+
var clean = async ({ args, info }) => {
|
|
14
|
+
cleye.cli({ help: info }, void 0, args);
|
|
13
15
|
await fs__default.default.remove(cliCommon.targetPaths.resolve("dist"));
|
|
14
16
|
await fs__default.default.remove(cliCommon.targetPaths.resolve("dist-types"));
|
|
15
17
|
await fs__default.default.remove(cliCommon.targetPaths.resolve("coverage"));
|
|
16
|
-
}
|
|
18
|
+
};
|
|
17
19
|
|
|
18
20
|
exports.default = clean;
|
|
19
21
|
//# sourceMappingURL=clean.cjs.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var cleye = require('cleye');
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
|
+
var productionPack = require('../../lib/packager/productionPack.cjs.js');
|
|
8
|
+
|
|
9
|
+
var postpack = async ({ args, info }) => {
|
|
10
|
+
cleye.cli({ help: info }, void 0, args);
|
|
11
|
+
await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.default = postpack;
|
|
15
|
+
//# sourceMappingURL=postpack.cjs.js.map
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var fs = require('fs-extra');
|
|
7
|
+
var cliCommon = require('@backstage/cli-common');
|
|
8
|
+
var productionPack = require('../../lib/packager/productionPack.cjs.js');
|
|
6
9
|
var publishing = require('../../lib/publishing.cjs.js');
|
|
7
|
-
var typeDistProject = require('
|
|
10
|
+
var typeDistProject = require('../../lib/typeDistProject.cjs.js');
|
|
8
11
|
|
|
9
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
13
|
|
|
11
14
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
var prepack = async ({ args, info }) => {
|
|
17
|
+
cleye.cli({ help: info }, void 0, args);
|
|
14
18
|
publishing.publishPreflightCheck({
|
|
15
19
|
dir: cliCommon.targetPaths.dir,
|
|
16
20
|
packageJson: await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"))
|
|
@@ -20,10 +24,6 @@ const pre = async () => {
|
|
|
20
24
|
featureDetectionProject: await typeDistProject.createTypeDistProject()
|
|
21
25
|
});
|
|
22
26
|
};
|
|
23
|
-
const post = async () => {
|
|
24
|
-
await productionPack.revertProductionPack(cliCommon.targetPaths.dir);
|
|
25
|
-
};
|
|
26
27
|
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=pack.cjs.js.map
|
|
28
|
+
exports.default = prepack;
|
|
29
|
+
//# sourceMappingURL=prepack.cjs.js.map
|
|
@@ -13,7 +13,7 @@ require('react-dev-utils/ModuleScopePlugin');
|
|
|
13
13
|
require('@module-federation/enhanced/rspack');
|
|
14
14
|
require('lodash/pickBy');
|
|
15
15
|
var cliCommon = require('@backstage/cli-common');
|
|
16
|
-
require('../../../../../
|
|
16
|
+
require('../../../../../wiring/version.cjs.js');
|
|
17
17
|
var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
|
|
18
18
|
require('@manypkg/get-packages');
|
|
19
19
|
require('chalk');
|
|
@@ -7,7 +7,7 @@ var cliCommon = require('@backstage/cli-common');
|
|
|
7
7
|
var cliNode = require('@backstage/cli-node');
|
|
8
8
|
var buildFrontend = require('../../lib/buildFrontend.cjs.js');
|
|
9
9
|
var buildBackend = require('../../lib/buildBackend.cjs.js');
|
|
10
|
-
var optionsParser = require('
|
|
10
|
+
var optionsParser = require('../../lib/optionsParser.cjs.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
13
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var cleye = require('cleye');
|
|
3
6
|
var fs = require('fs-extra');
|
|
4
7
|
var path = require('node:path');
|
|
5
8
|
var cliNode = require('@backstage/cli-node');
|
|
@@ -9,7 +12,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
12
|
|
|
10
13
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
11
14
|
|
|
12
|
-
async
|
|
15
|
+
var clean = async ({ args, info }) => {
|
|
16
|
+
cleye.cli({ help: info }, void 0, args);
|
|
13
17
|
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
14
18
|
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist"));
|
|
15
19
|
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist-types"));
|
|
@@ -31,7 +35,7 @@ async function command() {
|
|
|
31
35
|
}
|
|
32
36
|
})
|
|
33
37
|
);
|
|
34
|
-
}
|
|
38
|
+
};
|
|
35
39
|
|
|
36
|
-
exports.
|
|
40
|
+
exports.default = clean;
|
|
37
41
|
//# sourceMappingURL=clean.cjs.js.map
|
|
@@ -4,9 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var commander = require('commander');
|
|
6
6
|
var factory = require('../../wiring/factory.cjs.js');
|
|
7
|
-
var lazy = require('../../
|
|
8
|
-
var index = require('../config/index.cjs.js');
|
|
7
|
+
var lazy = require('../../wiring/lazy.cjs.js');
|
|
9
8
|
|
|
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
|
+
];
|
|
10
15
|
function registerPackageCommands(command) {
|
|
11
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(
|
|
12
17
|
"--minify",
|
|
@@ -83,7 +88,7 @@ const buildPlugin = factory.createCliPlugin({
|
|
|
83
88
|
description: "Start a package for local development",
|
|
84
89
|
execute: async ({ args }) => {
|
|
85
90
|
const command = new commander.Command();
|
|
86
|
-
const defaultCommand = command.option(...
|
|
91
|
+
const defaultCommand = command.option(...configOption).option(
|
|
87
92
|
"--role <name>",
|
|
88
93
|
"Run the command with an explicit package role"
|
|
89
94
|
).option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
|
|
@@ -115,7 +120,7 @@ const buildPlugin = factory.createCliPlugin({
|
|
|
115
120
|
"Start the dev entry-point for any matching plugin package in the repo",
|
|
116
121
|
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
117
122
|
Array()
|
|
118
|
-
).option(...
|
|
123
|
+
).option(...configOption).option(
|
|
119
124
|
"--inspect [host]",
|
|
120
125
|
"Enable debugger in Node.js environments. Applies to backend package only"
|
|
121
126
|
).option(
|
|
@@ -133,6 +138,34 @@ const buildPlugin = factory.createCliPlugin({
|
|
|
133
138
|
await defaultCommand.parseAsync(args, { from: "user" });
|
|
134
139
|
}
|
|
135
140
|
});
|
|
141
|
+
reg.addCommand({
|
|
142
|
+
path: ["package", "clean"],
|
|
143
|
+
description: "Delete cache directories",
|
|
144
|
+
execute: {
|
|
145
|
+
loader: () => import('./commands/package/clean.cjs.js')
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
reg.addCommand({
|
|
149
|
+
path: ["package", "prepack"],
|
|
150
|
+
description: "Prepares a package for packaging before publishing",
|
|
151
|
+
execute: {
|
|
152
|
+
loader: () => import('./commands/package/prepack.cjs.js')
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
reg.addCommand({
|
|
156
|
+
path: ["package", "postpack"],
|
|
157
|
+
description: "Restores the changes made by the prepack command",
|
|
158
|
+
execute: {
|
|
159
|
+
loader: () => import('./commands/package/postpack.cjs.js')
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
reg.addCommand({
|
|
163
|
+
path: ["repo", "clean"],
|
|
164
|
+
description: "Delete cache and output directories",
|
|
165
|
+
execute: {
|
|
166
|
+
loader: () => import('./commands/repo/clean.cjs.js')
|
|
167
|
+
}
|
|
168
|
+
});
|
|
136
169
|
reg.addCommand({
|
|
137
170
|
path: ["build-workspace"],
|
|
138
171
|
description: "Builds a temporary dist workspace from the provided packages",
|
|
@@ -9,14 +9,14 @@ require('react-dev-utils/openBrowser');
|
|
|
9
9
|
require('@rspack/core');
|
|
10
10
|
require('@rspack/dev-server');
|
|
11
11
|
require('@backstage/cli-common');
|
|
12
|
-
var config = require('
|
|
12
|
+
var config = require('./config.cjs.js');
|
|
13
13
|
require('eslint-rspack-plugin');
|
|
14
14
|
require('ts-checker-rspack-plugin');
|
|
15
15
|
require('html-webpack-plugin');
|
|
16
16
|
require('react-dev-utils/ModuleScopePlugin');
|
|
17
17
|
require('@module-federation/enhanced/rspack');
|
|
18
18
|
require('lodash/pickBy');
|
|
19
|
-
require('../../../
|
|
19
|
+
require('../../../wiring/version.cjs.js');
|
|
20
20
|
require('yn');
|
|
21
21
|
require('@manypkg/get-packages');
|
|
22
22
|
require('./bundler/packageDetection.cjs.js');
|
|
@@ -12,7 +12,7 @@ var optimization = require('./optimization.cjs.js');
|
|
|
12
12
|
var pickBy = require('lodash/pickBy');
|
|
13
13
|
var cliCommon = require('@backstage/cli-common');
|
|
14
14
|
var transforms = require('./transforms.cjs.js');
|
|
15
|
-
var version = require('../../../../
|
|
15
|
+
var version = require('../../../../wiring/version.cjs.js');
|
|
16
16
|
var yn = require('yn');
|
|
17
17
|
var hasReactDomClient = require('./hasReactDomClient.cjs.js');
|
|
18
18
|
var linkWorkspaces = require('./linkWorkspaces.cjs.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var entryPoints = require('../entryPoints.cjs.js');
|
|
4
|
-
var typeDistProject = require('
|
|
4
|
+
var typeDistProject = require('../typeDistProject.cjs.js');
|
|
5
5
|
var moduleFederationCommon = require('@backstage/module-federation-common');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var fs = require('fs-extra');
|
|
@@ -7,7 +7,7 @@ var openBrowser = require('react-dev-utils/openBrowser');
|
|
|
7
7
|
var core = require('@rspack/core');
|
|
8
8
|
var devServer = require('@rspack/dev-server');
|
|
9
9
|
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
var config = require('
|
|
10
|
+
var config = require('../config.cjs.js');
|
|
11
11
|
var config$1 = require('./config.cjs.js');
|
|
12
12
|
var packageDetection = require('./packageDetection.cjs.js');
|
|
13
13
|
var paths = require('./paths.cjs.js');
|
|
@@ -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
|
|
@@ -27,8 +27,8 @@ function createScriptOptionsParser(anyCmd, commandPath) {
|
|
|
27
27
|
cmd._storeOptionsAsProperties = false;
|
|
28
28
|
cmd._optionValues = result;
|
|
29
29
|
cmd.parseOptions(argsStr.split(" "));
|
|
30
|
-
cmd.
|
|
31
|
-
cmd.
|
|
30
|
+
cmd._optionValues = currentOpts;
|
|
31
|
+
cmd._storeOptionsAsProperties = currentStore;
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -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
|
|
|
@@ -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,25 @@ 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
|
+
flags: {
|
|
24
|
+
package: {
|
|
25
|
+
type: String,
|
|
26
|
+
description: "Only include the schema that applies to the given package"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
void 0,
|
|
31
|
+
args
|
|
32
|
+
);
|
|
17
33
|
const { schema: appSchemas } = await config.loadCliConfig({
|
|
18
34
|
args: [],
|
|
19
|
-
fromPackage:
|
|
35
|
+
fromPackage: pkg,
|
|
20
36
|
mockEnv: true
|
|
21
37
|
});
|
|
22
38
|
const schema = configLoader.mergeConfigSchemas(
|
|
@@ -2,20 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
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
|
+
flags: {
|
|
17
|
+
package: { type: String, description: "Package to print config for" },
|
|
18
|
+
lax: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
description: "Do not require environment variables to be set"
|
|
21
|
+
},
|
|
22
|
+
frontend: { type: Boolean, description: "Only print frontend config" },
|
|
23
|
+
withSecrets: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
description: "Include secrets in the output"
|
|
26
|
+
},
|
|
27
|
+
format: { type: String, description: "Output format (yaml or json)" },
|
|
28
|
+
config: {
|
|
29
|
+
type: [String],
|
|
30
|
+
description: "Config files to load instead of app-config.yaml"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
void 0,
|
|
35
|
+
args
|
|
36
|
+
);
|
|
10
37
|
const { schema, appConfigs } = await config.loadCliConfig({
|
|
11
|
-
args:
|
|
12
|
-
fromPackage:
|
|
13
|
-
mockEnv:
|
|
14
|
-
fullVisibility: !
|
|
38
|
+
args: config$1,
|
|
39
|
+
fromPackage: pkg,
|
|
40
|
+
mockEnv: lax,
|
|
41
|
+
fullVisibility: !frontend
|
|
15
42
|
});
|
|
16
|
-
const visibility = getVisibilityOption(
|
|
43
|
+
const visibility = getVisibilityOption(frontend, withSecrets);
|
|
17
44
|
const data = serializeConfigData(appConfigs, schema, visibility);
|
|
18
|
-
if (
|
|
45
|
+
if (format === "json") {
|
|
19
46
|
process.stdout.write(`${JSON.stringify(data, null, 2)}
|
|
20
47
|
`);
|
|
21
48
|
} else {
|
|
@@ -23,13 +50,13 @@ var print = async (opts) => {
|
|
|
23
50
|
`);
|
|
24
51
|
}
|
|
25
52
|
};
|
|
26
|
-
function getVisibilityOption(
|
|
27
|
-
if (
|
|
53
|
+
function getVisibilityOption(frontend, withSecrets) {
|
|
54
|
+
if (frontend && withSecrets) {
|
|
28
55
|
throw new Error("Not allowed to combine frontend and secret config");
|
|
29
56
|
}
|
|
30
|
-
if (
|
|
57
|
+
if (frontend) {
|
|
31
58
|
return "frontend";
|
|
32
|
-
} else if (
|
|
59
|
+
} else if (withSecrets) {
|
|
33
60
|
return "secret";
|
|
34
61
|
}
|
|
35
62
|
return "backend";
|
|
@@ -2,18 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
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
|
+
flags: {
|
|
17
|
+
package: { type: String, description: "Package to print schema for" },
|
|
18
|
+
format: { type: String, description: "Output format (yaml or json)" },
|
|
19
|
+
merge: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
description: "Merge all schemas into a single schema"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
void 0,
|
|
26
|
+
args
|
|
27
|
+
);
|
|
10
28
|
const { schema } = await config.loadCliConfig({
|
|
11
29
|
args: [],
|
|
12
|
-
fromPackage:
|
|
30
|
+
fromPackage: pkg,
|
|
13
31
|
mockEnv: true
|
|
14
32
|
});
|
|
15
33
|
let configSchema;
|
|
16
|
-
if (
|
|
34
|
+
if (merge) {
|
|
17
35
|
configSchema = configLoader.mergeConfigSchemas(
|
|
18
36
|
schema.serialize().schemas.map(
|
|
19
37
|
(_) => _.value
|
|
@@ -24,7 +42,7 @@ var schema = async (opts) => {
|
|
|
24
42
|
} else {
|
|
25
43
|
configSchema = schema.serialize();
|
|
26
44
|
}
|
|
27
|
-
if (
|
|
45
|
+
if (format === "json") {
|
|
28
46
|
process.stdout.write(`${JSON.stringify(configSchema, null, 2)}
|
|
29
47
|
`);
|
|
30
48
|
} else {
|
|
@@ -2,16 +2,46 @@
|
|
|
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
|
+
flags: {
|
|
15
|
+
package: {
|
|
16
|
+
type: String,
|
|
17
|
+
description: "Package to validate config for"
|
|
18
|
+
},
|
|
19
|
+
lax: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
description: "Do not require environment variables to be set"
|
|
22
|
+
},
|
|
23
|
+
frontend: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
description: "Only validate frontend config"
|
|
26
|
+
},
|
|
27
|
+
deprecated: { type: Boolean, description: "Output deprecated keys" },
|
|
28
|
+
strict: { type: Boolean, description: "Enable strict validation" },
|
|
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
|
+
);
|
|
8
38
|
await config.loadCliConfig({
|
|
9
|
-
args:
|
|
10
|
-
fromPackage:
|
|
11
|
-
mockEnv:
|
|
12
|
-
fullVisibility: !
|
|
13
|
-
withDeprecatedKeys:
|
|
14
|
-
strict
|
|
39
|
+
args: config$1,
|
|
40
|
+
fromPackage: pkg,
|
|
41
|
+
mockEnv: lax,
|
|
42
|
+
fullVisibility: !frontend,
|
|
43
|
+
withDeprecatedKeys: deprecated,
|
|
44
|
+
strict
|
|
15
45
|
});
|
|
16
46
|
};
|
|
17
47
|
|