@backstage/cli 0.35.4 → 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 +56 -0
- package/config/jest.js +2 -2
- package/dist/index.cjs.js +1 -0
- package/dist/modules/build/commands/package/build/command.cjs.js +7 -7
- package/dist/modules/build/commands/package/clean.cjs.js +21 -0
- package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
- package/dist/modules/build/commands/package/prepack.cjs.js +29 -0
- package/dist/modules/build/commands/package/start/command.cjs.js +3 -3
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +2 -2
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +4 -5
- package/dist/modules/build/commands/repo/build.cjs.js +7 -8
- package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +10 -7
- package/dist/modules/build/commands/repo/start.cjs.js +3 -3
- package/dist/modules/build/index.cjs.js +37 -4
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -2
- package/dist/modules/build/lib/buildFrontend.cjs.js +3 -6
- package/dist/modules/build/lib/builder/config.cjs.js +5 -5
- package/dist/modules/build/lib/builder/packager.cjs.js +7 -8
- package/dist/modules/build/lib/bundler/config.cjs.js +2 -3
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +3 -3
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/paths.cjs.js +8 -6
- package/dist/modules/build/lib/bundler/server.cjs.js +11 -11
- 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 +10 -10
- package/dist/modules/build/lib/packager/productionPack.cjs.js +2 -2
- package/dist/{lib → modules/build/lib}/role.cjs.js +2 -2
- package/dist/modules/build/lib/runner/runBackend.cjs.js +2 -2
- package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +2 -2
- 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 +10 -26
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +2 -2
- package/dist/modules/create-github-app/index.cjs.js +1 -1
- package/dist/modules/info/commands/info.cjs.js +29 -11
- package/dist/modules/info/index.cjs.js +1 -23
- package/dist/modules/lint/commands/package/lint.cjs.js +4 -4
- package/dist/modules/lint/commands/repo/lint.cjs.js +13 -12
- 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 +8 -11
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +4 -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 +5 -3
- 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 +15 -18
- package/dist/modules/migrate/index.cjs.js +11 -31
- package/dist/modules/new/index.cjs.js +1 -1
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +2 -2
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +6 -11
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +4 -4
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +1 -2
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +2 -2
- 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 -33
- package/dist/modules/test/commands/package/test.cjs.js +1 -5
- package/dist/modules/test/commands/repo/test.cjs.js +9 -9
- package/dist/modules/test/index.cjs.js +4 -2
- package/dist/modules/translations/commands/export.cjs.js +127 -0
- package/dist/modules/translations/commands/import.cjs.js +164 -0
- package/dist/modules/translations/index.cjs.js +24 -0
- package/dist/modules/translations/lib/discoverPackages.cjs.js +121 -0
- package/dist/modules/translations/lib/extractTranslations.cjs.js +71 -0
- package/dist/modules/translations/lib/messageFilePath.cjs.js +43 -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 +6 -8
- 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/packages/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 -5
- package/dist/wiring/version.cjs.js +20 -0
- package/package.json +34 -36
- package/dist/lib/cache/SuccessCache.cjs.js +0 -79
- package/dist/lib/parallel.cjs.js +0 -141
- package/dist/lib/paths.cjs.js +0 -8
- package/dist/lib/versioning/Lockfile.cjs.js +0 -89
- package/dist/lib/yarnPlugin.cjs.js +0 -46
- package/dist/modules/maintenance/commands/package/clean.cjs.js +0 -19
- package/dist/modules/maintenance/commands/package/pack.cjs.js +0 -29
- /package/dist/{lib → modules/build/lib}/entryPoints.cjs.js +0 -0
- /package/dist/modules/{maintenance → build}/lib/publishing.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
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var cleye = require('cleye');
|
|
6
|
+
|
|
7
|
+
var packageExports = async ({ args, info }) => {
|
|
8
|
+
cleye.cli({ help: info }, void 0, args);
|
|
9
|
+
throw new Error(
|
|
10
|
+
"The `migrate package-exports` command has been removed, use `repo fix` instead."
|
|
8
11
|
);
|
|
9
|
-
|
|
10
|
-
for (const pkg of packages) {
|
|
11
|
-
fix.fixPackageExports(pkg);
|
|
12
|
-
}
|
|
13
|
-
await fix.writeFixedPackages(packages);
|
|
14
|
-
}
|
|
12
|
+
};
|
|
15
13
|
|
|
16
|
-
exports.
|
|
14
|
+
exports.default = packageExports;
|
|
17
15
|
//# sourceMappingURL=packageExports.cjs.js.map
|
|
@@ -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');
|
|
@@ -10,7 +13,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
13
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
11
14
|
|
|
12
15
|
const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
|
|
13
|
-
async
|
|
16
|
+
var packageLintConfigs = async ({ args, info }) => {
|
|
17
|
+
cleye.cli({ help: info }, void 0, args);
|
|
14
18
|
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
15
19
|
const oldConfigs = [
|
|
16
20
|
require.resolve("@backstage/cli/config/eslint.js"),
|
|
@@ -67,7 +71,7 @@ async function command() {
|
|
|
67
71
|
if (hasPrettier) {
|
|
68
72
|
await cliCommon.runOutput(["prettier", "--write", ...configPaths]);
|
|
69
73
|
}
|
|
70
|
-
}
|
|
74
|
+
};
|
|
71
75
|
|
|
72
|
-
exports.
|
|
76
|
+
exports.default = packageLintConfigs;
|
|
73
77
|
//# sourceMappingURL=packageLintConfigs.cjs.js.map
|
|
@@ -2,18 +2,20 @@
|
|
|
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 path = require('node:path');
|
|
7
8
|
var getPackages = require('@manypkg/get-packages');
|
|
8
9
|
var cliNode = require('@backstage/cli-node');
|
|
9
|
-
var
|
|
10
|
+
var cliCommon = require('@backstage/cli-common');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
13
|
|
|
13
14
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
15
|
|
|
15
|
-
var packageRole = async () => {
|
|
16
|
-
|
|
16
|
+
var packageRole = async ({ args, info }) => {
|
|
17
|
+
cleye.cli({ help: info }, void 0, args);
|
|
18
|
+
const { packages } = await getPackages.getPackages(cliCommon.targetPaths.dir);
|
|
17
19
|
await Promise.all(
|
|
18
20
|
packages.map(async ({ dir, packageJson: pkg }) => {
|
|
19
21
|
const { name } = pkg;
|
|
@@ -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');
|
|
@@ -10,7 +13,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
|
10
13
|
|
|
11
14
|
const configArgPattern = /--config[=\s][^\s$]+/;
|
|
12
15
|
const noStartRoles = ["cli", "common-library"];
|
|
13
|
-
async
|
|
16
|
+
var packageScripts = async ({ args, info }) => {
|
|
17
|
+
cleye.cli({ help: info }, void 0, args);
|
|
14
18
|
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
15
19
|
await Promise.all(
|
|
16
20
|
packages.map(async ({ dir, packageJson }) => {
|
|
@@ -38,11 +42,11 @@ async function command() {
|
|
|
38
42
|
}
|
|
39
43
|
const testCmd = ["test"];
|
|
40
44
|
if (scripts.test?.startsWith("backstage-cli test")) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
45
|
+
const testArgs = scripts.test.slice("backstage-cli test".length).split(" ").filter(Boolean);
|
|
46
|
+
if (testArgs.includes("--passWithNoTests")) {
|
|
47
|
+
testArgs.splice(testArgs.indexOf("--passWithNoTests"), 1);
|
|
44
48
|
}
|
|
45
|
-
testCmd.push(...
|
|
49
|
+
testCmd.push(...testArgs);
|
|
46
50
|
}
|
|
47
51
|
const expectedScripts = {
|
|
48
52
|
...hasStart && {
|
|
@@ -77,7 +81,7 @@ async function command() {
|
|
|
77
81
|
}
|
|
78
82
|
})
|
|
79
83
|
);
|
|
80
|
-
}
|
|
84
|
+
};
|
|
81
85
|
|
|
82
|
-
exports.
|
|
86
|
+
exports.default = packageScripts;
|
|
83
87
|
//# sourceMappingURL=packageScripts.cjs.js.map
|
|
@@ -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');
|
|
@@ -10,7 +13,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
|
10
13
|
|
|
11
14
|
const REACT_ROUTER_DEPS = ["react-router", "react-router-dom"];
|
|
12
15
|
const REACT_ROUTER_RANGE = "6.0.0-beta.0 || ^6.3.0";
|
|
13
|
-
async
|
|
16
|
+
var reactRouterDeps = async ({ args, info }) => {
|
|
17
|
+
cleye.cli({ help: info }, void 0, args);
|
|
14
18
|
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
15
19
|
await Promise.all(
|
|
16
20
|
packages.map(async ({ dir, packageJson }) => {
|
|
@@ -41,7 +45,7 @@ async function command() {
|
|
|
41
45
|
}
|
|
42
46
|
})
|
|
43
47
|
);
|
|
44
|
-
}
|
|
48
|
+
};
|
|
45
49
|
|
|
46
|
-
exports.
|
|
50
|
+
exports.default = reactRouterDeps;
|
|
47
51
|
//# sourceMappingURL=reactRouterDeps.cjs.js.map
|
|
@@ -10,11 +10,8 @@ var minimatch = require('minimatch');
|
|
|
10
10
|
var semver = require('semver');
|
|
11
11
|
var errors = require('@backstage/errors');
|
|
12
12
|
var path = require('node:path');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var Lockfile = require('../../../../lib/versioning/Lockfile.cjs.js');
|
|
16
|
-
var packages = require('../../../../lib/versioning/packages.cjs.js');
|
|
17
|
-
var parallel = require('../../../../lib/parallel.cjs.js');
|
|
13
|
+
var cliNode = require('@backstage/cli-node');
|
|
14
|
+
var packages = require('../../lib/versioning/packages.cjs.js');
|
|
18
15
|
var releaseManifests = require('@backstage/release-manifests');
|
|
19
16
|
var migrate = require('./migrate.cjs.js');
|
|
20
17
|
var utils = require('../../lib/utils.cjs.js');
|
|
@@ -40,9 +37,9 @@ function extendsDefaultPattern(pattern) {
|
|
|
40
37
|
return minimatch.minimatch("@backstage/", pattern.slice(0, -1));
|
|
41
38
|
}
|
|
42
39
|
var bump = async (opts) => {
|
|
43
|
-
const lockfilePath =
|
|
44
|
-
const lockfile = await
|
|
45
|
-
const
|
|
40
|
+
const lockfilePath = cliCommon.targetPaths.resolveRoot("yarn.lock");
|
|
41
|
+
const lockfile = await cliNode.Lockfile.load(lockfilePath);
|
|
42
|
+
const yarnPluginEnabled = await cliNode.hasBackstageYarnPlugin();
|
|
46
43
|
let pattern = opts.pattern;
|
|
47
44
|
if (!pattern) {
|
|
48
45
|
console.log(`Using default pattern glob ${DEFAULT_PATTERN_GLOB}`);
|
|
@@ -86,7 +83,7 @@ var bump = async (opts) => {
|
|
|
86
83
|
releaseManifest
|
|
87
84
|
});
|
|
88
85
|
}
|
|
89
|
-
if (
|
|
86
|
+
if (yarnPluginEnabled) {
|
|
90
87
|
console.log();
|
|
91
88
|
console.log(
|
|
92
89
|
`Updating yarn plugin to v${releaseManifest.releaseVersion}...`
|
|
@@ -96,10 +93,10 @@ var bump = async (opts) => {
|
|
|
96
93
|
await cliCommon.run(["yarn", "plugin", "import", yarnPluginUrl]).waitForExit();
|
|
97
94
|
console.log();
|
|
98
95
|
}
|
|
99
|
-
const dependencyMap = await packages.mapDependencies(
|
|
96
|
+
const dependencyMap = await packages.mapDependencies(cliCommon.targetPaths.dir, pattern);
|
|
100
97
|
const versionBumps = /* @__PURE__ */ new Map();
|
|
101
|
-
await
|
|
102
|
-
|
|
98
|
+
await cliNode.runConcurrentTasks({
|
|
99
|
+
concurrencyFactor: 4,
|
|
103
100
|
items: dependencyMap.entries(),
|
|
104
101
|
async worker([name, pkgs]) {
|
|
105
102
|
let target;
|
|
@@ -132,8 +129,8 @@ var bump = async (opts) => {
|
|
|
132
129
|
console.log(chalk__default.default.yellow("Some packages are outdated, updating"));
|
|
133
130
|
console.log();
|
|
134
131
|
const breakingUpdates = /* @__PURE__ */ new Map();
|
|
135
|
-
await
|
|
136
|
-
|
|
132
|
+
await cliNode.runConcurrentTasks({
|
|
133
|
+
concurrencyFactor: 4,
|
|
137
134
|
items: versionBumps.entries(),
|
|
138
135
|
async worker([name, deps]) {
|
|
139
136
|
const pkgPath = path.resolve(deps[0].location, "package.json");
|
|
@@ -148,7 +145,7 @@ var bump = async (opts) => {
|
|
|
148
145
|
if (depType in pkgJson && dep.name in pkgJson[depType]) {
|
|
149
146
|
const oldRange = pkgJson[depType][dep.name];
|
|
150
147
|
const oldLockfileRange = await asLockfileVersion(oldRange);
|
|
151
|
-
const useBackstageRange =
|
|
148
|
+
const useBackstageRange = yarnPluginEnabled && // Only use backstage:^ versions if the package is present in
|
|
152
149
|
// the manifest for the release we're bumping to.
|
|
153
150
|
releaseManifest.packages.find(
|
|
154
151
|
({ name: manifestPackageName }) => dep.name === manifestPackageName
|
|
@@ -175,7 +172,7 @@ var bump = async (opts) => {
|
|
|
175
172
|
if (extendsDefaultPattern(pattern)) {
|
|
176
173
|
await bumpBackstageJsonVersion(
|
|
177
174
|
releaseManifest.releaseVersion,
|
|
178
|
-
|
|
175
|
+
yarnPluginEnabled
|
|
179
176
|
);
|
|
180
177
|
} else {
|
|
181
178
|
console.log(
|
|
@@ -229,7 +226,7 @@ var bump = async (opts) => {
|
|
|
229
226
|
} else {
|
|
230
227
|
console.log();
|
|
231
228
|
}
|
|
232
|
-
if (
|
|
229
|
+
if (yarnPluginEnabled) {
|
|
233
230
|
console.log();
|
|
234
231
|
console.log(
|
|
235
232
|
chalk__default.default.blue(
|
|
@@ -311,7 +308,7 @@ function createVersionFinder(options) {
|
|
|
311
308
|
};
|
|
312
309
|
}
|
|
313
310
|
function getBackstageJsonPath() {
|
|
314
|
-
return
|
|
311
|
+
return cliCommon.targetPaths.resolveRoot(cliCommon.BACKSTAGE_JSON);
|
|
315
312
|
}
|
|
316
313
|
async function getBackstageJson() {
|
|
317
314
|
const backstageJsonPath = getBackstageJsonPath();
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
6
6
|
var commander = require('commander');
|
|
7
|
-
var lazy = require('../../
|
|
7
|
+
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
8
|
|
|
9
9
|
var index = factory.createCliPlugin({
|
|
10
10
|
pluginId: "migrate",
|
|
@@ -43,56 +43,36 @@ var index = factory.createCliPlugin({
|
|
|
43
43
|
reg.addCommand({
|
|
44
44
|
path: ["migrate", "package-roles"],
|
|
45
45
|
description: `Add package role field to packages that don't have it`,
|
|
46
|
-
execute:
|
|
47
|
-
|
|
48
|
-
const defaultCommand = command.action(
|
|
49
|
-
lazy.lazy(() => import('./commands/packageRole.cjs.js'), "default")
|
|
50
|
-
);
|
|
51
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
46
|
+
execute: {
|
|
47
|
+
loader: () => import('./commands/packageRole.cjs.js')
|
|
52
48
|
}
|
|
53
49
|
});
|
|
54
50
|
reg.addCommand({
|
|
55
51
|
path: ["migrate", "package-scripts"],
|
|
56
52
|
description: "Set package scripts according to each package role",
|
|
57
|
-
execute:
|
|
58
|
-
|
|
59
|
-
const defaultCommand = command.action(
|
|
60
|
-
lazy.lazy(() => import('./commands/packageScripts.cjs.js'), "command")
|
|
61
|
-
);
|
|
62
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
53
|
+
execute: {
|
|
54
|
+
loader: () => import('./commands/packageScripts.cjs.js')
|
|
63
55
|
}
|
|
64
56
|
});
|
|
65
57
|
reg.addCommand({
|
|
66
58
|
path: ["migrate", "package-exports"],
|
|
67
59
|
description: "Synchronize package subpath export definitions",
|
|
68
|
-
execute:
|
|
69
|
-
|
|
70
|
-
const defaultCommand = command.action(
|
|
71
|
-
lazy.lazy(() => import('./commands/packageExports.cjs.js'), "command")
|
|
72
|
-
);
|
|
73
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
60
|
+
execute: {
|
|
61
|
+
loader: () => import('./commands/packageExports.cjs.js')
|
|
74
62
|
}
|
|
75
63
|
});
|
|
76
64
|
reg.addCommand({
|
|
77
65
|
path: ["migrate", "package-lint-configs"],
|
|
78
66
|
description: "Migrates all packages to use @backstage/cli/config/eslint-factory",
|
|
79
|
-
execute:
|
|
80
|
-
|
|
81
|
-
const defaultCommand = command.action(
|
|
82
|
-
lazy.lazy(() => import('./commands/packageLintConfigs.cjs.js'), "command")
|
|
83
|
-
);
|
|
84
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
67
|
+
execute: {
|
|
68
|
+
loader: () => import('./commands/packageLintConfigs.cjs.js')
|
|
85
69
|
}
|
|
86
70
|
});
|
|
87
71
|
reg.addCommand({
|
|
88
72
|
path: ["migrate", "react-router-deps"],
|
|
89
73
|
description: "Migrates the react-router dependencies for all packages to be peer dependencies",
|
|
90
|
-
execute:
|
|
91
|
-
|
|
92
|
-
const defaultCommand = command.action(
|
|
93
|
-
lazy.lazy(() => import('./commands/reactRouterDeps.cjs.js'), "command")
|
|
94
|
-
);
|
|
95
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
74
|
+
execute: {
|
|
75
|
+
loader: () => import('./commands/reactRouterDeps.cjs.js')
|
|
96
76
|
}
|
|
97
77
|
});
|
|
98
78
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
6
6
|
var commander = require('commander');
|
|
7
|
-
var lazy = require('../../
|
|
7
|
+
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
8
|
var errors = require('@backstage/errors');
|
|
9
9
|
|
|
10
10
|
var index = factory.createCliPlugin({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -50,7 +50,7 @@ async function addCodeownersEntry(ownedPath, ownerStr, codeownersFilePath) {
|
|
|
50
50
|
}
|
|
51
51
|
let filePath = codeownersFilePath;
|
|
52
52
|
if (!filePath) {
|
|
53
|
-
filePath = await getCodeownersFilePath(
|
|
53
|
+
filePath = await getCodeownersFilePath(cliCommon.targetPaths.rootDir);
|
|
54
54
|
if (!filePath) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
@@ -9,14 +9,9 @@ var startCase = require('lodash/startCase');
|
|
|
9
9
|
var upperCase = require('lodash/upperCase');
|
|
10
10
|
var upperFirst = require('lodash/upperFirst');
|
|
11
11
|
var lowerFirst = require('lodash/lowerFirst');
|
|
12
|
-
var
|
|
13
|
-
require('
|
|
14
|
-
require('
|
|
15
|
-
require('@backstage/errors');
|
|
16
|
-
require('@backstage/cli-common');
|
|
17
|
-
var paths = require('../../../../lib/paths.cjs.js');
|
|
18
|
-
var version = require('../../../../lib/version.cjs.js');
|
|
19
|
-
var yarnPlugin = require('../../../../lib/yarnPlugin.cjs.js');
|
|
12
|
+
var cliNode = require('@backstage/cli-node');
|
|
13
|
+
var cliCommon = require('@backstage/cli-common');
|
|
14
|
+
var version = require('../version.cjs.js');
|
|
20
15
|
|
|
21
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
22
17
|
|
|
@@ -44,12 +39,12 @@ class PortableTemplater {
|
|
|
44
39
|
static async create(options = {}) {
|
|
45
40
|
let lockfile;
|
|
46
41
|
try {
|
|
47
|
-
lockfile = await
|
|
42
|
+
lockfile = await cliNode.Lockfile.load(cliCommon.targetPaths.resolveRoot("yarn.lock"));
|
|
48
43
|
} catch {
|
|
49
44
|
}
|
|
50
|
-
const
|
|
45
|
+
const yarnPluginEnabled = await cliNode.hasBackstageYarnPlugin();
|
|
51
46
|
const versionProvider = version.createPackageVersionProvider(lockfile, {
|
|
52
|
-
preferBackstageProtocol:
|
|
47
|
+
preferBackstageProtocol: yarnPluginEnabled
|
|
53
48
|
});
|
|
54
49
|
const templater = new PortableTemplater(
|
|
55
50
|
{
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var upperFirst = require('lodash/upperFirst');
|
|
5
5
|
var camelCase = require('lodash/camelCase');
|
|
6
|
-
var
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
7
|
var tasks = require('../tasks.cjs.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -44,7 +44,7 @@ async function installNewPackage(input) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
async function addDependency(input, path) {
|
|
47
|
-
const pkgJsonPath =
|
|
47
|
+
const pkgJsonPath = cliCommon.targetPaths.resolveRoot(path);
|
|
48
48
|
const pkgJson = await fs__default.default.readJson(pkgJsonPath).catch((error) => {
|
|
49
49
|
if (error.code === "ENOENT") {
|
|
50
50
|
return void 0;
|
|
@@ -71,7 +71,7 @@ async function tryAddFrontendLegacy(input) {
|
|
|
71
71
|
"add-frontend-legacy can only be used for frontend plugins"
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
const appDefinitionPath =
|
|
74
|
+
const appDefinitionPath = cliCommon.targetPaths.resolveRoot("packages/app/src/App.tsx");
|
|
75
75
|
if (!await fs__default.default.pathExists(appDefinitionPath)) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -101,7 +101,7 @@ async function tryAddFrontendLegacy(input) {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
async function tryAddBackend(input) {
|
|
104
|
-
const backendIndexPath =
|
|
104
|
+
const backendIndexPath = cliCommon.targetPaths.resolveRoot(
|
|
105
105
|
"packages/backend/src/index.ts"
|
|
106
106
|
);
|
|
107
107
|
if (!await fs__default.default.pathExists(backendIndexPath)) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var paths = require('../../../../lib/paths.cjs.js');
|
|
6
5
|
var errors = require('@backstage/errors');
|
|
7
6
|
var cliNode = require('@backstage/cli-node');
|
|
8
7
|
var PortableTemplater = require('./PortableTemplater.cjs.js');
|
|
@@ -13,7 +12,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
12
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
13
|
|
|
15
14
|
async function writeTemplateContents(template, input) {
|
|
16
|
-
const targetDir =
|
|
15
|
+
const targetDir = cliCommon.targetPaths.resolveRoot(input.packagePath);
|
|
17
16
|
if (await fs__default.default.pathExists(targetDir)) {
|
|
18
17
|
throw new errors.InputError(`Package '${input.packagePath}' already exists`);
|
|
19
18
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var inquirer = require('inquirer');
|
|
4
4
|
var codeowners = require('../codeowners/codeowners.cjs.js');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var resolvePackageParams = require('./resolvePackageParams.cjs.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -11,7 +11,7 @@ var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
|
|
|
11
11
|
|
|
12
12
|
async function collectPortableTemplateInput(options) {
|
|
13
13
|
const { config, template, prefilledParams } = options;
|
|
14
|
-
const codeOwnersFilePath = await codeowners.getCodeownersFilePath(
|
|
14
|
+
const codeOwnersFilePath = await codeowners.getCodeownersFilePath(cliCommon.targetPaths.rootDir);
|
|
15
15
|
const prompts = getPromptsForRole(template.role);
|
|
16
16
|
if (codeOwnersFilePath) {
|
|
17
17
|
prompts.push(ownerPrompt());
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var zod = require('zod');
|
|
4
4
|
var fs = require('fs-extra');
|
|
5
5
|
var recursiveReaddir = require('recursive-readdir');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var yaml = require('yaml');
|
|
8
|
-
var
|
|
8
|
+
var cliCommon = require('@backstage/cli-common');
|
|
9
9
|
var types = require('../types.cjs.js');
|
|
10
10
|
var errors = require('@backstage/errors');
|
|
11
11
|
var v3 = require('zod-validation-error/v3');
|
|
@@ -15,17 +15,17 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
16
|
var recursiveReaddir__default = /*#__PURE__*/_interopDefaultCompat(recursiveReaddir);
|
|
17
17
|
|
|
18
|
-
const templateDefinitionSchema =
|
|
19
|
-
name:
|
|
20
|
-
role:
|
|
21
|
-
description:
|
|
22
|
-
values:
|
|
18
|
+
const templateDefinitionSchema = zod.z.object({
|
|
19
|
+
name: zod.z.string(),
|
|
20
|
+
role: zod.z.enum(types.TEMPLATE_ROLES),
|
|
21
|
+
description: zod.z.string().optional(),
|
|
22
|
+
values: zod.z.record(zod.z.string()).optional()
|
|
23
23
|
}).strict();
|
|
24
24
|
async function loadPortableTemplate(pointer) {
|
|
25
25
|
if (pointer.target.match(/https?:\/\//)) {
|
|
26
26
|
throw new Error("Remote templates are not supported yet");
|
|
27
27
|
}
|
|
28
|
-
const templateContent = await fs__default.default.readFile(
|
|
28
|
+
const templateContent = await fs__default.default.readFile(cliCommon.targetPaths.resolveRoot(pointer.target), "utf-8").catch((error) => {
|
|
29
29
|
throw new errors.ForwardedError(
|
|
30
30
|
`Failed to load template definition from '${pointer.target}'`,
|
|
31
31
|
error
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var defaultTemplates = require('../defaultTemplates.cjs.js');
|
|
7
7
|
var types = require('../types.cjs.js');
|
|
8
8
|
var yaml = require('yaml');
|
|
9
|
-
var
|
|
9
|
+
var zod = require('zod');
|
|
10
10
|
var v3 = require('zod-validation-error/v3');
|
|
11
11
|
var errors = require('@backstage/errors');
|
|
12
12
|
|
|
@@ -22,20 +22,20 @@ const defaults = {
|
|
|
22
22
|
packageNamePrefix: "@internal/",
|
|
23
23
|
packageNamePluginInfix: "plugin-"
|
|
24
24
|
};
|
|
25
|
-
const newConfigSchema =
|
|
26
|
-
templates:
|
|
27
|
-
globals:
|
|
28
|
-
license:
|
|
29
|
-
version:
|
|
30
|
-
private:
|
|
31
|
-
publishRegistry:
|
|
32
|
-
namePrefix:
|
|
33
|
-
namePluginInfix:
|
|
25
|
+
const newConfigSchema = zod.z.object({
|
|
26
|
+
templates: zod.z.array(zod.z.string()).optional(),
|
|
27
|
+
globals: zod.z.object({
|
|
28
|
+
license: zod.z.string().optional(),
|
|
29
|
+
version: zod.z.string().optional(),
|
|
30
|
+
private: zod.z.boolean().optional(),
|
|
31
|
+
publishRegistry: zod.z.string().optional(),
|
|
32
|
+
namePrefix: zod.z.string().optional(),
|
|
33
|
+
namePluginInfix: zod.z.string().optional()
|
|
34
34
|
}).optional()
|
|
35
35
|
}).strict();
|
|
36
|
-
const pkgJsonWithNewConfigSchema =
|
|
37
|
-
backstage:
|
|
38
|
-
cli:
|
|
36
|
+
const pkgJsonWithNewConfigSchema = zod.z.object({
|
|
37
|
+
backstage: zod.z.object({
|
|
38
|
+
cli: zod.z.object({
|
|
39
39
|
new: newConfigSchema.optional()
|
|
40
40
|
}).optional()
|
|
41
41
|
}).optional()
|
|
@@ -48,7 +48,7 @@ function computePackageNamePluginInfix(packageNamePrefix, namePluginInfix) {
|
|
|
48
48
|
}
|
|
49
49
|
async function loadPortableTemplateConfig(options = {}) {
|
|
50
50
|
const { overrides = {} } = options;
|
|
51
|
-
const pkgPath = options.packagePath ??
|
|
51
|
+
const pkgPath = options.packagePath ?? cliCommon.targetPaths.resolveRoot("package.json");
|
|
52
52
|
const pkgJson = await fs__default.default.readJson(pkgPath);
|
|
53
53
|
const parsed = pkgJsonWithNewConfigSchema.safeParse(pkgJson);
|
|
54
54
|
if (!parsed.success) {
|
|
@@ -110,9 +110,9 @@ function resolveLocalTemplatePath(pointer, basePath) {
|
|
|
110
110
|
paths: [basePath]
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
const partialTemplateDefinitionSchema =
|
|
114
|
-
name:
|
|
115
|
-
description:
|
|
113
|
+
const partialTemplateDefinitionSchema = zod.z.object({
|
|
114
|
+
name: zod.z.string(),
|
|
115
|
+
description: zod.z.string().optional()
|
|
116
116
|
});
|
|
117
117
|
async function peekLocalTemplateDefinition(target) {
|
|
118
118
|
const content = await fs__default.default.readFile(target, "utf8");
|