@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.
Files changed (106) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/config/jest.js +2 -2
  3. package/dist/index.cjs.js +1 -0
  4. package/dist/modules/auth/commands/list.cjs.js +23 -0
  5. package/dist/modules/auth/commands/login.cjs.js +316 -0
  6. package/dist/modules/auth/commands/logout.cjs.js +55 -0
  7. package/dist/modules/auth/commands/printToken.cjs.js +41 -0
  8. package/dist/modules/auth/commands/select.cjs.js +32 -0
  9. package/dist/modules/auth/commands/show.cjs.js +59 -0
  10. package/dist/modules/auth/index.cjs.js +44 -0
  11. package/dist/modules/auth/lib/auth.cjs.js +60 -0
  12. package/dist/modules/auth/lib/http.cjs.js +26 -0
  13. package/dist/modules/auth/lib/localServer.cjs.js +80 -0
  14. package/dist/modules/auth/lib/pkce.cjs.js +23 -0
  15. package/dist/modules/auth/lib/prompt.cjs.js +44 -0
  16. package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
  17. package/dist/modules/auth/lib/storage.cjs.js +152 -0
  18. package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
  19. package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
  20. package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
  21. package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
  22. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  23. package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
  24. package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
  25. package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
  26. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
  27. package/dist/modules/build/commands/repo/build.cjs.js +46 -11
  28. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
  29. package/dist/modules/build/commands/repo/start.cjs.js +54 -5
  30. package/dist/modules/build/index.cjs.js +32 -123
  31. package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
  32. package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
  33. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
  34. package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
  35. package/dist/modules/build/lib/config.cjs.js +94 -0
  36. package/dist/modules/build/lib/optionsParser.cjs.js +22 -0
  37. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
  38. package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
  39. package/dist/modules/build/lib/role.cjs.js +1 -1
  40. package/dist/modules/config/commands/docs.cjs.js +19 -2
  41. package/dist/modules/config/commands/print.cjs.js +41 -13
  42. package/dist/modules/config/commands/schema.cjs.js +25 -6
  43. package/dist/modules/config/commands/validate.cjs.js +38 -7
  44. package/dist/modules/config/index.cjs.js +6 -65
  45. package/dist/modules/config/lib/config.cjs.js +6 -22
  46. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
  47. package/dist/modules/create-github-app/index.cjs.js +1 -9
  48. package/dist/modules/info/commands/info.cjs.js +26 -6
  49. package/dist/modules/info/index.cjs.js +1 -23
  50. package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
  51. package/dist/modules/lint/commands/repo/lint.cjs.js +99 -27
  52. package/dist/modules/lint/index.cjs.js +2 -60
  53. package/dist/modules/lint/lib/optionsParser.cjs.js +22 -0
  54. package/dist/modules/maintenance/commands/repo/fix.cjs.js +32 -9
  55. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
  56. package/dist/modules/maintenance/index.cjs.js +2 -64
  57. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  58. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  59. package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
  60. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  61. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  62. package/dist/modules/migrate/commands/versions/bump.cjs.js +48 -20
  63. package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
  64. package/dist/modules/migrate/index.cjs.js +12 -55
  65. package/dist/modules/new/commands/new.cjs.js +70 -15
  66. package/dist/modules/new/index.cjs.js +1 -29
  67. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
  68. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
  69. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
  70. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
  71. package/dist/modules/test/commands/package/test.cjs.js +1 -10
  72. package/dist/modules/test/commands/repo/test.cjs.js +51 -39
  73. package/dist/modules/test/index.cjs.js +2 -32
  74. package/dist/modules/translations/commands/export.cjs.js +25 -1
  75. package/dist/modules/translations/commands/import.cjs.js +25 -1
  76. package/dist/modules/translations/index.cjs.js +2 -37
  77. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  78. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  79. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  80. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  81. package/dist/packages/cli/package.json.cjs.js +7 -6
  82. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  83. package/dist/packages/core-components/package.json.cjs.js +1 -1
  84. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  85. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  86. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  87. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  88. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  89. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  90. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  91. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  92. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  93. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  94. package/dist/wiring/CliInitializer.cjs.js +24 -7
  95. package/dist/wiring/version.cjs.js +20 -0
  96. package/package.json +26 -22
  97. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  98. package/dist/lib/lazy.cjs.js +0 -22
  99. package/dist/lib/optionsParser.cjs.js +0 -37
  100. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  101. package/dist/lib/yarnPlugin.cjs.js +0 -46
  102. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  103. /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
  104. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  105. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  106. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.35.5-next.0";
3
+ var version = "0.36.0-next.2";
4
4
  var dependencies = {
5
5
  "@backstage/catalog-model": "workspace:^",
6
6
  "@backstage/cli-common": "workspace:^",
@@ -32,12 +32,11 @@ var dependencies = {
32
32
  "@types/webpack-env": "^1.15.2",
33
33
  "@typescript-eslint/eslint-plugin": "^8.17.0",
34
34
  "@typescript-eslint/parser": "^8.16.0",
35
- "@yarnpkg/lockfile": "^1.1.0",
36
- "@yarnpkg/parsers": "^3.0.0",
37
35
  bfj: "^9.0.2",
38
36
  buffer: "^6.0.3",
39
37
  chalk: "^4.0.0",
40
38
  chokidar: "^3.3.1",
39
+ cleye: "^2.3.0",
41
40
  commander: "^14.0.3",
42
41
  "cross-fetch": "^4.0.0",
43
42
  "cross-spawn": "^7.0.3",
@@ -76,9 +75,10 @@ var dependencies = {
76
75
  postcss: "^8.1.0",
77
76
  "postcss-import": "^16.1.0",
78
77
  process: "^0.11.10",
78
+ "proper-lockfile": "^4.1.2",
79
79
  "raw-loader": "^4.0.2",
80
80
  "react-dev-utils": "^12.0.0-next.60",
81
- "react-refresh": "^0.17.0",
81
+ "react-refresh": "^0.18.0",
82
82
  "recursive-readdir": "^2.2.2",
83
83
  "replace-in-file": "^7.1.0",
84
84
  rollup: "^4.27.3",
@@ -87,6 +87,7 @@ var dependencies = {
87
87
  "rollup-plugin-postcss": "^4.0.0",
88
88
  "rollup-pluginutils": "^2.8.2",
89
89
  semver: "^7.5.3",
90
+ "shell-quote": "^1.8.1",
90
91
  "style-loader": "^3.3.1",
91
92
  sucrase: "^3.20.2",
92
93
  "swc-loader": "^0.2.3",
@@ -130,14 +131,14 @@ var devDependencies = {
130
131
  "@types/jest": "^30.0.0",
131
132
  "@types/node": "^22.13.14",
132
133
  "@types/npm-packlist": "^3.0.0",
134
+ "@types/proper-lockfile": "^4",
133
135
  "@types/recursive-readdir": "^2.2.0",
134
136
  "@types/rollup-plugin-peer-deps-external": "^2.2.0",
135
137
  "@types/rollup-plugin-postcss": "^3.1.4",
138
+ "@types/shell-quote": "^1.7.5",
136
139
  "@types/svgo": "^2.6.2",
137
- "@types/tar": "^6.1.1",
138
140
  "@types/terser-webpack-plugin": "^5.0.4",
139
141
  "@types/webpack-sources": "^3.2.3",
140
- "@types/yarnpkg__lockfile": "^1.1.4",
141
142
  del: "^8.0.0",
142
143
  "esbuild-loader": "^4.0.0",
143
144
  "eslint-webpack-plugin": "^4.2.0",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.19.6-next.0";
3
+ var version = "1.19.6-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.18.8-next.0";
3
+ var version = "0.18.8-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.12.4-next.0";
3
+ var version = "1.12.4-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.1.21-next.0";
3
+ var version = "1.1.21-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.4.1-next.0";
3
+ var version = "0.5.0-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.14.2-next.0";
3
+ var version = "0.15.0-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.5.1-next.0";
3
+ var version = "0.5.1-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.27.1-next.0";
3
+ var version = "0.27.1-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.2.17-next.0";
3
+ var version = "0.2.17-next.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "2.1.0-next.0";
3
+ var version = "2.1.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.12.6-next.0";
3
+ var version = "0.13.0-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.3.9-next.0";
3
+ var version = "0.3.9-next.2";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -4,9 +4,9 @@ var CommandGraph = require('./CommandGraph.cjs.js');
4
4
  var types$1 = require('./types.cjs.js');
5
5
  var CommandRegistry = require('./CommandRegistry.cjs.js');
6
6
  var commander = require('commander');
7
- var version = require('../lib/version.cjs.js');
7
+ var version = require('./version.cjs.js');
8
8
  var chalk = require('chalk');
9
- var errors = require('../lib/errors.cjs.js');
9
+ var errors = require('./errors.cjs.js');
10
10
  var errors$1 = require('@backstage/errors');
11
11
  var types = require('node:util/types');
12
12
 
@@ -14,6 +14,12 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
14
 
15
15
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
16
16
 
17
+ function isNodeHidden(node) {
18
+ if (node.$$type === "@tree/leaf") {
19
+ return !!node.command.deprecated || !!node.command.experimental;
20
+ }
21
+ return node.children.every((child) => isNodeHidden(child));
22
+ }
17
23
  class CliInitializer {
18
24
  graph = new CommandGraph.CommandGraph();
19
25
  commandRegistry = new CommandRegistry.CommandRegistry(this.graph);
@@ -56,7 +62,9 @@ class CliInitializer {
56
62
  while (queue.length) {
57
63
  const { node, argParser } = queue.shift();
58
64
  if (node.$$type === "@tree/root") {
59
- const treeParser = argParser.command(`${node.name} [command]`).description(node.name);
65
+ const treeParser = argParser.command(`${node.name} [command]`, {
66
+ hidden: isNodeHidden(node)
67
+ }).description(node.name);
60
68
  queue.push(
61
69
  ...node.children.map((child) => ({
62
70
  node: child,
@@ -64,7 +72,9 @@ class CliInitializer {
64
72
  }))
65
73
  );
66
74
  } else {
67
- argParser.command(node.name, { hidden: !!node.command.deprecated }).description(node.command.description).helpOption(false).allowUnknownOption(true).allowExcessArguments(true).action(async () => {
75
+ argParser.command(node.name, {
76
+ hidden: !!node.command.deprecated || !!node.command.experimental
77
+ }).description(node.command.description).helpOption(false).allowUnknownOption(true).allowExcessArguments(true).action(async () => {
68
78
  try {
69
79
  const args = program.parseOptions(process.argv);
70
80
  const nonProcessArgs = args.operands.slice(2);
@@ -77,13 +87,20 @@ class CliInitializer {
77
87
  }
78
88
  positionalArgs.push(nonProcessArgs[argIndex]);
79
89
  }
80
- await node.command.execute({
90
+ const context = {
81
91
  args: [...positionalArgs, ...args.unknown],
82
92
  info: {
83
93
  usage: [programName, ...node.command.path].join(" "),
84
94
  description: node.command.description
85
95
  }
86
- });
96
+ };
97
+ if (typeof node.command.execute === "function") {
98
+ await node.command.execute(context);
99
+ } else {
100
+ const mod = await node.command.execute.loader();
101
+ const fn = typeof mod.default === "function" ? mod.default : mod.default.default;
102
+ await fn(context);
103
+ }
87
104
  process.exit(0);
88
105
  } catch (error) {
89
106
  errors.exitWithError(error);
@@ -101,7 +118,7 @@ class CliInitializer {
101
118
  process.on("unhandledRejection", (rejection) => {
102
119
  errors.exitWithError(new errors$1.ForwardedError("Unhandled rejection", rejection));
103
120
  });
104
- program.parse(process.argv);
121
+ await program.parseAsync(process.argv);
105
122
  }
106
123
  }
107
124
  function unwrapFeature(feature) {
@@ -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.2",
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.2",
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.2",
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.3.0",
86
85
  "commander": "^14.0.3",
87
86
  "cross-fetch": "^4.0.0",
88
87
  "cross-spawn": "^7.0.3",
@@ -121,9 +120,10 @@
121
120
  "postcss": "^8.1.0",
122
121
  "postcss-import": "^16.1.0",
123
122
  "process": "^0.11.10",
123
+ "proper-lockfile": "^4.1.2",
124
124
  "raw-loader": "^4.0.2",
125
125
  "react-dev-utils": "^12.0.0-next.60",
126
- "react-refresh": "^0.17.0",
126
+ "react-refresh": "^0.18.0",
127
127
  "recursive-readdir": "^2.2.2",
128
128
  "replace-in-file": "^7.1.0",
129
129
  "rollup": "^4.27.3",
@@ -132,6 +132,7 @@
132
132
  "rollup-plugin-postcss": "^4.0.0",
133
133
  "rollup-pluginutils": "^2.8.2",
134
134
  "semver": "^7.5.3",
135
+ "shell-quote": "^1.8.1",
135
136
  "style-loader": "^3.3.1",
136
137
  "sucrase": "^3.20.2",
137
138
  "swc-loader": "^0.2.3",
@@ -148,20 +149,20 @@
148
149
  "zod-validation-error": "^4.0.2"
149
150
  },
150
151
  "devDependencies": {
151
- "@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",
152
+ "@backstage/backend-plugin-api": "1.8.0-next.1",
153
+ "@backstage/backend-test-utils": "1.11.1-next.2",
154
+ "@backstage/catalog-client": "1.14.0-next.2",
154
155
  "@backstage/config": "1.3.6",
155
- "@backstage/core-app-api": "1.19.6-next.0",
156
- "@backstage/core-components": "0.18.8-next.0",
157
- "@backstage/core-plugin-api": "1.12.4-next.0",
158
- "@backstage/dev-utils": "1.1.21-next.0",
156
+ "@backstage/core-app-api": "1.19.6-next.1",
157
+ "@backstage/core-components": "0.18.8-next.1",
158
+ "@backstage/core-plugin-api": "1.12.4-next.1",
159
+ "@backstage/dev-utils": "1.1.21-next.1",
159
160
  "@backstage/errors": "1.2.7",
160
- "@backstage/plugin-auth-backend": "0.27.1-next.0",
161
- "@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-auth-backend": "0.27.1-next.2",
162
+ "@backstage/plugin-auth-backend-module-guest-provider": "0.2.17-next.1",
163
+ "@backstage/plugin-catalog-node": "2.1.0-next.2",
164
+ "@backstage/plugin-scaffolder-node": "0.13.0-next.2",
165
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.9-next.2",
165
166
  "@backstage/test-utils": "1.7.16-next.0",
166
167
  "@backstage/theme": "0.7.2",
167
168
  "@jest/environment-jsdom-abstract": "^30.0.0",
@@ -175,14 +176,14 @@
175
176
  "@types/jest": "^30.0.0",
176
177
  "@types/node": "^22.13.14",
177
178
  "@types/npm-packlist": "^3.0.0",
179
+ "@types/proper-lockfile": "^4",
178
180
  "@types/recursive-readdir": "^2.2.0",
179
181
  "@types/rollup-plugin-peer-deps-external": "^2.2.0",
180
182
  "@types/rollup-plugin-postcss": "^3.1.4",
183
+ "@types/shell-quote": "^1.7.5",
181
184
  "@types/svgo": "^2.6.2",
182
- "@types/tar": "^6.1.1",
183
185
  "@types/terser-webpack-plugin": "^5.0.4",
184
186
  "@types/webpack-sources": "^3.2.3",
185
- "@types/yarnpkg__lockfile": "^1.1.4",
186
187
  "del": "^8.0.0",
187
188
  "esbuild-loader": "^4.0.0",
188
189
  "eslint-webpack-plugin": "^4.2.0",
@@ -196,6 +197,9 @@
196
197
  "webpack": "~5.105.0",
197
198
  "webpack-dev-server": "^5.0.0"
198
199
  },
200
+ "optionalDependencies": {
201
+ "keytar": "^7.9.0"
202
+ },
199
203
  "peerDependencies": {
200
204
  "@jest/environment-jsdom-abstract": "^30.0.0",
201
205
  "@module-federation/enhanced": "^0.21.6",
@@ -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,22 +0,0 @@
1
- 'use strict';
2
-
3
- var errors = require('@backstage/errors');
4
- var errors$1 = require('./errors.cjs.js');
5
-
6
- function lazy(moduleLoader, exportName) {
7
- return async (...args) => {
8
- try {
9
- const mod = await moduleLoader();
10
- const actualModule = mod.default;
11
- const actionFunc = actualModule[exportName];
12
- await actionFunc(...args);
13
- process.exit(0);
14
- } catch (error) {
15
- errors.assertError(error);
16
- errors$1.exitWithError(error);
17
- }
18
- };
19
- }
20
-
21
- exports.lazy = lazy;
22
- //# sourceMappingURL=lazy.cjs.js.map
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- function createScriptOptionsParser(anyCmd, commandPath) {
4
- let rootCmd = anyCmd;
5
- while (rootCmd.parent) {
6
- rootCmd = rootCmd.parent;
7
- }
8
- let targetCmd = rootCmd;
9
- for (const name of commandPath) {
10
- targetCmd = targetCmd?.commands.find((c) => c.name() === name);
11
- }
12
- if (!targetCmd) {
13
- throw new Error(
14
- `Could not find package command '${commandPath.join(" ")}'`
15
- );
16
- }
17
- const cmd = targetCmd;
18
- const expectedScript = `backstage-cli ${commandPath.join(" ")}`;
19
- return (scriptStr) => {
20
- if (!scriptStr || !scriptStr.startsWith(expectedScript)) {
21
- return void 0;
22
- }
23
- const argsStr = scriptStr.slice(expectedScript.length).trim();
24
- const currentOpts = cmd._optionValues;
25
- const currentStore = cmd._storeOptionsAsProperties;
26
- const result = {};
27
- cmd._storeOptionsAsProperties = false;
28
- cmd._optionValues = result;
29
- cmd.parseOptions(argsStr.split(" "));
30
- cmd._storeOptionsAsProperties = currentOpts;
31
- cmd._optionValues = currentStore;
32
- return result;
33
- };
34
- }
35
-
36
- exports.createScriptOptionsParser = createScriptOptionsParser;
37
- //# sourceMappingURL=optionsParser.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