@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.
Files changed (71) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/config/jest.js +2 -2
  3. package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
  4. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  5. package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
  6. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
  7. package/dist/modules/build/commands/repo/build.cjs.js +1 -1
  8. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
  9. package/dist/modules/build/index.cjs.js +37 -4
  10. package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
  11. package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
  12. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
  13. package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
  14. package/dist/modules/build/lib/config.cjs.js +94 -0
  15. package/dist/{lib → modules/build/lib}/optionsParser.cjs.js +2 -2
  16. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
  17. package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
  18. package/dist/modules/config/commands/docs.cjs.js +18 -2
  19. package/dist/modules/config/commands/print.cjs.js +38 -11
  20. package/dist/modules/config/commands/schema.cjs.js +22 -4
  21. package/dist/modules/config/commands/validate.cjs.js +37 -7
  22. package/dist/modules/config/index.cjs.js +6 -65
  23. package/dist/modules/config/lib/config.cjs.js +6 -22
  24. package/dist/modules/create-github-app/index.cjs.js +1 -1
  25. package/dist/modules/info/commands/info.cjs.js +25 -6
  26. package/dist/modules/info/index.cjs.js +1 -23
  27. package/dist/modules/lint/commands/repo/lint.cjs.js +5 -3
  28. package/dist/modules/lint/index.cjs.js +1 -1
  29. package/dist/modules/lint/lib/optionsParser.cjs.js +37 -0
  30. package/dist/modules/maintenance/commands/repo/fix.cjs.js +1 -4
  31. package/dist/modules/maintenance/index.cjs.js +1 -45
  32. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  33. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  34. package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
  35. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  36. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  37. package/dist/modules/migrate/commands/versions/bump.cjs.js +7 -9
  38. package/dist/modules/migrate/index.cjs.js +11 -31
  39. package/dist/modules/new/index.cjs.js +1 -1
  40. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
  41. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +6 -6
  42. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +16 -16
  43. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
  44. package/dist/modules/test/commands/package/test.cjs.js +0 -3
  45. package/dist/modules/test/commands/repo/test.cjs.js +6 -5
  46. package/dist/modules/test/index.cjs.js +1 -1
  47. package/dist/modules/translations/commands/export.cjs.js +24 -1
  48. package/dist/modules/translations/commands/import.cjs.js +24 -1
  49. package/dist/modules/translations/index.cjs.js +2 -37
  50. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  51. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  52. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  53. package/dist/packages/cli/package.json.cjs.js +2 -4
  54. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  55. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  56. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  57. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  58. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  59. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  60. package/dist/wiring/CliInitializer.cjs.js +12 -5
  61. package/dist/wiring/version.cjs.js +20 -0
  62. package/package.json +13 -15
  63. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  64. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  65. package/dist/lib/yarnPlugin.cjs.js +0 -46
  66. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  67. /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
  68. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  69. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  70. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
  71. /package/dist/{lib → wiring}/lazy.cjs.js +0 -0
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ var cliCommon = require('@backstage/cli-common');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
9
+
10
+ const ownPaths = cliCommon.findOwnPaths(__dirname);
11
+ function findVersion() {
12
+ const pkgContent = fs__default.default.readFileSync(ownPaths.resolve("package.json"), "utf8");
13
+ return JSON.parse(pkgContent).version;
14
+ }
15
+ const version = findVersion();
16
+ fs__default.default.pathExistsSync(ownPaths.resolve("src"));
17
+
18
+ exports.findVersion = findVersion;
19
+ exports.version = version;
20
+ //# sourceMappingURL=version.cjs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli",
3
- "version": "0.35.5-next.0",
3
+ "version": "0.36.0-next.1",
4
4
  "description": "CLI for developing Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@backstage/catalog-model": "1.7.6",
51
- "@backstage/cli-common": "0.2.0-next.0",
52
- "@backstage/cli-node": "0.2.19-next.0",
51
+ "@backstage/cli-common": "0.2.0-next.1",
52
+ "@backstage/cli-node": "0.2.19-next.1",
53
53
  "@backstage/config": "1.3.6",
54
54
  "@backstage/config-loader": "1.10.9-next.0",
55
55
  "@backstage/errors": "1.2.7",
56
56
  "@backstage/eslint-plugin": "0.2.2-next.0",
57
- "@backstage/integration": "1.21.0-next.0",
58
- "@backstage/module-federation-common": "0.1.0",
57
+ "@backstage/integration": "2.0.0-next.1",
58
+ "@backstage/module-federation-common": "0.1.2-next.0",
59
59
  "@backstage/release-manifests": "0.0.13",
60
60
  "@backstage/types": "1.2.2",
61
61
  "@manypkg/get-packages": "^1.1.3",
@@ -77,12 +77,11 @@
77
77
  "@types/webpack-env": "^1.15.2",
78
78
  "@typescript-eslint/eslint-plugin": "^8.17.0",
79
79
  "@typescript-eslint/parser": "^8.16.0",
80
- "@yarnpkg/lockfile": "^1.1.0",
81
- "@yarnpkg/parsers": "^3.0.0",
82
80
  "bfj": "^9.0.2",
83
81
  "buffer": "^6.0.3",
84
82
  "chalk": "^4.0.0",
85
83
  "chokidar": "^3.3.1",
84
+ "cleye": "^2.2.1",
86
85
  "commander": "^14.0.3",
87
86
  "cross-fetch": "^4.0.0",
88
87
  "cross-spawn": "^7.0.3",
@@ -149,19 +148,19 @@
149
148
  },
150
149
  "devDependencies": {
151
150
  "@backstage/backend-plugin-api": "1.7.1-next.0",
152
- "@backstage/backend-test-utils": "1.11.1-next.0",
153
- "@backstage/catalog-client": "1.13.1-next.0",
151
+ "@backstage/backend-test-utils": "1.11.1-next.1",
152
+ "@backstage/catalog-client": "1.14.0-next.1",
154
153
  "@backstage/config": "1.3.6",
155
154
  "@backstage/core-app-api": "1.19.6-next.0",
156
155
  "@backstage/core-components": "0.18.8-next.0",
157
156
  "@backstage/core-plugin-api": "1.12.4-next.0",
158
- "@backstage/dev-utils": "1.1.21-next.0",
157
+ "@backstage/dev-utils": "1.1.21-next.1",
159
158
  "@backstage/errors": "1.2.7",
160
- "@backstage/plugin-auth-backend": "0.27.1-next.0",
159
+ "@backstage/plugin-auth-backend": "0.27.1-next.1",
161
160
  "@backstage/plugin-auth-backend-module-guest-provider": "0.2.17-next.0",
162
- "@backstage/plugin-catalog-node": "2.1.0-next.0",
163
- "@backstage/plugin-scaffolder-node": "0.12.6-next.0",
164
- "@backstage/plugin-scaffolder-node-test-utils": "0.3.9-next.0",
161
+ "@backstage/plugin-catalog-node": "2.1.0-next.1",
162
+ "@backstage/plugin-scaffolder-node": "0.13.0-next.1",
163
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.9-next.1",
165
164
  "@backstage/test-utils": "1.7.16-next.0",
166
165
  "@backstage/theme": "0.7.2",
167
166
  "@jest/environment-jsdom-abstract": "^30.0.0",
@@ -182,7 +181,6 @@
182
181
  "@types/tar": "^6.1.1",
183
182
  "@types/terser-webpack-plugin": "^5.0.4",
184
183
  "@types/webpack-sources": "^3.2.3",
185
- "@types/yarnpkg__lockfile": "^1.1.4",
186
184
  "del": "^8.0.0",
187
185
  "esbuild-loader": "^4.0.0",
188
186
  "eslint-webpack-plugin": "^4.2.0",
@@ -1,79 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var path = require('node:path');
5
- var cliCommon = require('@backstage/cli-common');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
-
9
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
-
11
- const DEFAULT_CACHE_BASE_PATH = "node_modules/.cache/backstage-cli";
12
- const CACHE_MAX_AGE_MS = 7 * 24 * 36e5;
13
- class SuccessCache {
14
- #path;
15
- /**
16
- * Trim any occurrences of the workspace root path from the input string. This
17
- * is useful to ensure stable hashes that don't vary based on the workspace
18
- * location.
19
- */
20
- static trimPaths(input) {
21
- return input.replaceAll(cliCommon.targetPaths.rootDir, "");
22
- }
23
- constructor(name, basePath) {
24
- this.#path = path.resolve(basePath ?? DEFAULT_CACHE_BASE_PATH, name);
25
- }
26
- async read() {
27
- try {
28
- const stat = await fs__default.default.stat(this.#path);
29
- if (!stat.isDirectory()) {
30
- await fs__default.default.rm(this.#path);
31
- return /* @__PURE__ */ new Set();
32
- }
33
- } catch (error) {
34
- if (error.code === "ENOENT") {
35
- return /* @__PURE__ */ new Set();
36
- }
37
- throw error;
38
- }
39
- const items = await fs__default.default.readdir(this.#path);
40
- const returned = /* @__PURE__ */ new Set();
41
- const removed = /* @__PURE__ */ new Set();
42
- const now = Date.now();
43
- for (const item of items) {
44
- const split = item.split("_");
45
- if (split.length !== 2) {
46
- removed.add(item);
47
- continue;
48
- }
49
- const createdAt = parseInt(split[0], 10);
50
- if (Number.isNaN(createdAt) || now - createdAt > CACHE_MAX_AGE_MS) {
51
- removed.add(item);
52
- } else {
53
- returned.add(split[1]);
54
- }
55
- }
56
- for (const item of removed) {
57
- await fs__default.default.unlink(path.resolve(this.#path, item));
58
- }
59
- return returned;
60
- }
61
- async write(newEntries) {
62
- const now = Date.now();
63
- await fs__default.default.ensureDir(this.#path);
64
- const existingItems = await fs__default.default.readdir(this.#path);
65
- const empty = Buffer.alloc(0);
66
- for (const key of newEntries) {
67
- const trimmedItems = existingItems.filter(
68
- (item) => item.endsWith(`_${key}`)
69
- );
70
- for (const trimmedItem of trimmedItems) {
71
- await fs__default.default.unlink(path.resolve(this.#path, trimmedItem));
72
- }
73
- await fs__default.default.writeFile(path.resolve(this.#path, `${now}_${key}`), empty);
74
- }
75
- }
76
- }
77
-
78
- exports.SuccessCache = SuccessCache;
79
- //# sourceMappingURL=SuccessCache.cjs.js.map
@@ -1,89 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var parsers = require('@yarnpkg/parsers');
5
- var lockfile = require('@yarnpkg/lockfile');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
-
9
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
-
11
- const ENTRY_PATTERN = /^((?:@[^/]+\/)?[^@/]+)@(.+)$/;
12
- const NEW_HEADER = `${[
13
- `# This file is generated by running "yarn install" inside your project.
14
- `,
15
- `# Manual changes might be lost - proceed with caution!
16
- `
17
- ].join(``)}
18
- `;
19
- const LEGACY_REGEX = /^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i;
20
- const SPECIAL_OBJECT_KEYS = [
21
- `__metadata`,
22
- `version`,
23
- `resolution`,
24
- `dependencies`,
25
- `peerDependencies`,
26
- `dependenciesMeta`,
27
- `peerDependenciesMeta`,
28
- `binaries`
29
- ];
30
- class Lockfile {
31
- static async load(path) {
32
- const lockfileContents = await fs__default.default.readFile(path, "utf8");
33
- return Lockfile.parse(lockfileContents);
34
- }
35
- static parse(content) {
36
- const legacy = LEGACY_REGEX.test(content);
37
- let data;
38
- try {
39
- data = parsers.parseSyml(content);
40
- } catch (err) {
41
- throw new Error(`Failed yarn.lock parse, ${err}`);
42
- }
43
- const packages = /* @__PURE__ */ new Map();
44
- for (const [key, value] of Object.entries(data)) {
45
- if (SPECIAL_OBJECT_KEYS.includes(key)) continue;
46
- const [, name, ranges] = ENTRY_PATTERN.exec(key) ?? [];
47
- if (!name) {
48
- throw new Error(`Failed to parse yarn.lock entry '${key}'`);
49
- }
50
- let queries = packages.get(name);
51
- if (!queries) {
52
- queries = [];
53
- packages.set(name, queries);
54
- }
55
- for (let range of ranges.split(/\s*,\s*/)) {
56
- if (range.startsWith(`${name}@`)) {
57
- range = range.slice(`${name}@`.length);
58
- }
59
- if (range.startsWith("npm:")) {
60
- range = range.slice("npm:".length);
61
- }
62
- queries.push({ range, version: value.version, dataKey: key });
63
- }
64
- }
65
- return new Lockfile(packages, data, legacy);
66
- }
67
- packages;
68
- data;
69
- legacy;
70
- constructor(packages, data, legacy = false) {
71
- this.packages = packages;
72
- this.data = data;
73
- this.legacy = legacy;
74
- }
75
- /** Get the entries for a single package in the lockfile */
76
- get(name) {
77
- return this.packages.get(name);
78
- }
79
- /** Returns the name of all packages available in the lockfile */
80
- keys() {
81
- return this.packages.keys();
82
- }
83
- toString() {
84
- return this.legacy ? lockfile.stringify(this.data) : NEW_HEADER + parsers.stringifySyml(this.data);
85
- }
86
- }
87
-
88
- exports.Lockfile = Lockfile;
89
- //# sourceMappingURL=Lockfile.cjs.js.map
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var yaml = require('yaml');
5
- var z = require('zod');
6
- var cliCommon = require('@backstage/cli-common');
7
-
8
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
-
10
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
- var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
12
- var z__default = /*#__PURE__*/_interopDefaultCompat(z);
13
-
14
- const yarnRcSchema = z__default.default.object({
15
- plugins: z__default.default.array(
16
- z__default.default.object({
17
- path: z__default.default.string()
18
- })
19
- ).optional()
20
- });
21
- async function getHasYarnPlugin() {
22
- const yarnRcPath = cliCommon.targetPaths.resolveRoot(".yarnrc.yml");
23
- const yarnRcContent = await fs__default.default.readFile(yarnRcPath, "utf-8").catch((e) => {
24
- if (e.code === "ENOENT") {
25
- return "";
26
- }
27
- throw e;
28
- });
29
- if (!yarnRcContent) {
30
- return false;
31
- }
32
- const parseResult = yarnRcSchema.safeParse(yaml__default.default.parse(yarnRcContent));
33
- if (!parseResult.success) {
34
- throw new Error(
35
- `Unexpected content in .yarnrc.yml: ${parseResult.error.toString()}`
36
- );
37
- }
38
- const yarnRc = parseResult.data;
39
- const backstagePlugin = yarnRc.plugins?.some(
40
- (plugin) => plugin.path === ".yarn/plugins/@yarnpkg/plugin-backstage.cjs"
41
- );
42
- return Boolean(backstagePlugin);
43
- }
44
-
45
- exports.getHasYarnPlugin = getHasYarnPlugin;
46
- //# sourceMappingURL=yarnPlugin.cjs.js.map
File without changes
File without changes