@backstage/cli 0.9.1 → 0.10.3

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 (43) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/config/jest.js +5 -3
  3. package/dist/cjs/{Lockfile-80f0eec4.cjs.js → Lockfile-35661afa.cjs.js} +18 -18
  4. package/dist/cjs/{build-33ad5323.cjs.js → build-aa750983.cjs.js} +8 -7
  5. package/dist/cjs/{build-7302d21d.cjs.js → build-b73c146e.cjs.js} +8 -7
  6. package/dist/cjs/{build-75ee78ab.cjs.js → build-be0f943d.cjs.js} +25 -22
  7. package/dist/cjs/{build-e21fe681.cjs.js → build-e5c1f9cd.cjs.js} +9 -9
  8. package/dist/cjs/{buildWorkspace-fa590fad.cjs.js → buildWorkspace-8c1d5134.cjs.js} +6 -6
  9. package/dist/cjs/{bump-5e4ffccb.cjs.js → bump-d6b32625.cjs.js} +36 -36
  10. package/dist/cjs/{bundle-4390c300.cjs.js → bundle-a35469cc.cjs.js} +15 -15
  11. package/dist/cjs/{clean-9279505e.cjs.js → clean-2294315a.cjs.js} +6 -6
  12. package/dist/cjs/{config-6ab0fc63.cjs.js → config-956d86a6.cjs.js} +7 -8
  13. package/dist/cjs/{create-4ffadaca.cjs.js → create-cf52e54d.cjs.js} +41 -41
  14. package/dist/cjs/{createPlugin-eb7251ea.cjs.js → createPlugin-b87a78f0.cjs.js} +31 -31
  15. package/dist/cjs/{dev-02640e59.cjs.js → dev-0a2ead14.cjs.js} +8 -8
  16. package/dist/cjs/{diff-56188f93.cjs.js → diff-4789ad9c.cjs.js} +39 -32
  17. package/dist/cjs/{docs-8039cb55.cjs.js → docs-12b2616e.cjs.js} +6 -6
  18. package/dist/cjs/{index-e84c4ef7.cjs.js → index-451d4133.cjs.js} +14 -14
  19. package/dist/cjs/{index-a18a4cd9.cjs.js → index-a18da53d.cjs.js} +15 -15
  20. package/dist/cjs/{index-994e77d9.cjs.js → index-dc8e5d2a.cjs.js} +68 -72
  21. package/dist/cjs/{info-2a0746e3.cjs.js → info-c8361946.cjs.js} +6 -6
  22. package/dist/cjs/{install-807a9039.cjs.js → install-68bbffa5.cjs.js} +60 -33
  23. package/dist/cjs/{lint-03faccc3.cjs.js → lint-4ec38c59.cjs.js} +5 -5
  24. package/dist/cjs/{lint-50ae8c8b.cjs.js → lint-a525caa3.cjs.js} +7 -7
  25. package/dist/cjs/{pack-7d39c708.cjs.js → pack-5af390ec.cjs.js} +6 -6
  26. package/dist/cjs/{packager-d328c8db.cjs.js → packager-47e5dbe2.cjs.js} +37 -35
  27. package/dist/cjs/{packages-24e76f27.cjs.js → packages-5bd09b6a.cjs.js} +5 -5
  28. package/dist/cjs/{paths-eecbbe83.cjs.js → paths-136b374a.cjs.js} +62 -46
  29. package/dist/cjs/{print-fec91280.cjs.js → print-8d26381a.cjs.js} +5 -5
  30. package/dist/cjs/{removePlugin-595ea65d.cjs.js → removePlugin-272a3d37.cjs.js} +30 -29
  31. package/dist/cjs/{run-40072d67.cjs.js → run-330d1527.cjs.js} +5 -5
  32. package/dist/cjs/{schema-00648d3a.cjs.js → schema-ea8ebcbf.cjs.js} +5 -5
  33. package/dist/cjs/{serve-e57a7acf.cjs.js → serve-50b65188.cjs.js} +10 -10
  34. package/dist/cjs/{serve-199d043b.cjs.js → serve-9b01661e.cjs.js} +15 -15
  35. package/dist/cjs/{server-c7c24602.cjs.js → server-15a54ef2.cjs.js} +6 -6
  36. package/dist/cjs/{svgrTemplate-2d0d15cf.cjs.js → svgrTemplate-f19e974c.cjs.js} +3 -3
  37. package/dist/cjs/{tasks-0f3092d3.cjs.js → tasks-6e261e37.cjs.js} +29 -29
  38. package/dist/cjs/{testCommand-a5c5fec6.cjs.js → testCommand-a9f0692f.cjs.js} +4 -4
  39. package/dist/cjs/{validate-011c509c.cjs.js → validate-0a0893b6.cjs.js} +4 -4
  40. package/dist/index.cjs.js +1 -1
  41. package/package.json +20 -23
  42. package/templates/default-plugin/package.json.hbs +3 -2
  43. package/dist/cjs/buildImage-477aa186.cjs.js +0 -77
@@ -29,13 +29,13 @@ class ExitCodeError extends CustomError {
29
29
  function exitWithError(error) {
30
30
  if (error instanceof ExitCodeError) {
31
31
  process.stderr.write(`
32
- ${chalk__default['default'].red(error.message)}
32
+ ${chalk__default["default"].red(error.message)}
33
33
 
34
34
  `);
35
35
  process.exit(error.code);
36
36
  } else {
37
37
  process.stderr.write(`
38
- ${chalk__default['default'].red(`${error}`)}
38
+ ${chalk__default["default"].red(`${error}`)}
39
39
 
40
40
  `);
41
41
  process.exit(1);
@@ -46,13 +46,13 @@ class NotFoundError extends CustomError {
46
46
 
47
47
  const paths = cliCommon.findPaths(__dirname);
48
48
 
49
- var version$9 = "0.9.11";
49
+ var version$9 = "0.10.0";
50
50
 
51
- var version$8 = "0.9.1";
51
+ var version$8 = "0.10.3";
52
52
  var dependencies = {
53
53
  "@backstage/cli-common": "^0.1.6",
54
54
  "@backstage/config": "^0.1.11",
55
- "@backstage/config-loader": "^0.8.0",
55
+ "@backstage/config-loader": "^0.9.0",
56
56
  "@backstage/errors": "^0.1.5",
57
57
  "@backstage/types": "^0.1.1",
58
58
  "@hot-loader/react-dom": "^16.13.0",
@@ -60,9 +60,9 @@ var dependencies = {
60
60
  "@lerna/project": "^4.0.0",
61
61
  "@octokit/request": "^5.4.12",
62
62
  "@rollup/plugin-commonjs": "^21.0.1",
63
- "@rollup/plugin-json": "^4.0.2",
63
+ "@rollup/plugin-json": "^4.1.0",
64
64
  "@rollup/plugin-node-resolve": "^13.0.0",
65
- "@rollup/plugin-yaml": "^3.0.0",
65
+ "@rollup/plugin-yaml": "^3.1.0",
66
66
  "@spotify/eslint-config-base": "^12.0.0",
67
67
  "@spotify/eslint-config-react": "^12.0.0",
68
68
  "@spotify/eslint-config-typescript": "^12.0.0",
@@ -82,9 +82,8 @@ var dependencies = {
82
82
  chokidar: "^3.3.1",
83
83
  commander: "^6.1.0",
84
84
  "css-loader": "^5.2.6",
85
- dashify: "^2.0.0",
86
85
  diff: "^5.0.0",
87
- esbuild: "^0.8.56",
86
+ esbuild: "^0.14.1",
88
87
  eslint: "^7.30.0",
89
88
  "eslint-config-prettier": "^8.3.0",
90
89
  "eslint-formatter-friendly": "^7.0.0",
@@ -111,24 +110,22 @@ var dependencies = {
111
110
  ora: "^5.3.0",
112
111
  postcss: "^8.1.0",
113
112
  process: "^0.11.10",
114
- react: "^16.0.0",
115
- "react-dev-utils": "^11.0.4",
113
+ "react-dev-utils": "^12.0.0-next.47",
116
114
  "react-hot-loader": "^4.12.21",
117
115
  "recursive-readdir": "^2.2.2",
118
116
  "replace-in-file": "^6.0.0",
119
- rollup: "2.44.x",
120
- "rollup-plugin-dts": "^3.0.1",
121
- "rollup-plugin-esbuild": "2.6.x",
117
+ rollup: "^2.60.2",
118
+ "rollup-plugin-dts": "^4.0.1",
119
+ "rollup-plugin-esbuild": "^4.7.2",
122
120
  "rollup-plugin-peer-deps-external": "^2.2.2",
123
121
  "rollup-plugin-postcss": "^4.0.0",
124
122
  "rollup-pluginutils": "^2.8.2",
125
123
  "run-script-webpack-plugin": "^0.0.11",
126
124
  semver: "^7.3.2",
127
- "style-loader": "^1.2.1",
125
+ "style-loader": "^3.3.1",
128
126
  sucrase: "^3.20.2",
129
127
  tar: "^6.1.2",
130
128
  "terser-webpack-plugin": "^5.1.3",
131
- "ts-loader": "^8.0.17",
132
129
  typescript: "^4.0.3",
133
130
  util: "^0.12.3",
134
131
  webpack: "^5.48.0",
@@ -139,25 +136,25 @@ var dependencies = {
139
136
  yn: "^4.0.0"
140
137
  };
141
138
  var devDependencies = {
142
- "@backstage/backend-common": "^0.9.11",
139
+ "@backstage/backend-common": "^0.10.0",
143
140
  "@backstage/config": "^0.1.11",
144
- "@backstage/core-components": "^0.7.5",
145
- "@backstage/core-plugin-api": "^0.2.1",
146
- "@backstage/core-app-api": "^0.1.23",
147
- "@backstage/dev-utils": "^0.2.13",
148
- "@backstage/test-utils": "^0.1.23",
149
- "@backstage/theme": "^0.2.13",
141
+ "@backstage/core-components": "^0.8.2",
142
+ "@backstage/core-plugin-api": "^0.4.0",
143
+ "@backstage/core-app-api": "^0.3.0",
144
+ "@backstage/dev-utils": "^0.2.15",
145
+ "@backstage/test-utils": "^0.2.0",
146
+ "@backstage/theme": "^0.2.14",
150
147
  "@types/diff": "^5.0.0",
151
148
  "@types/express": "^4.17.6",
152
149
  "@types/fs-extra": "^9.0.1",
153
150
  "@types/http-proxy": "^1.17.4",
154
- "@types/inquirer": "^7.3.1",
151
+ "@types/inquirer": "^8.1.3",
155
152
  "@types/mock-fs": "^4.13.0",
156
153
  "@types/node": "^14.14.32",
157
154
  "@types/recursive-readdir": "^2.2.0",
158
155
  "@types/rollup-plugin-peer-deps-external": "^2.2.0",
159
156
  "@types/rollup-plugin-postcss": "^2.0.0",
160
- "@types/tar": "^4.0.3",
157
+ "@types/tar": "^6.1.1",
161
158
  "@types/terser-webpack-plugin": "^5.0.4",
162
159
  "@types/webpack": "^5.28.0",
163
160
  "@types/webpack-dev-server": "^3.11.5",
@@ -168,19 +165,19 @@ var devDependencies = {
168
165
  "ts-node": "^10.0.0"
169
166
  };
170
167
 
171
- var version$7 = "0.1.23";
168
+ var version$7 = "0.3.0";
172
169
 
173
- var version$6 = "0.7.5";
170
+ var version$6 = "0.8.2";
174
171
 
175
- var version$5 = "0.2.1";
172
+ var version$5 = "0.4.0";
176
173
 
177
- var version$4 = "0.2.13";
174
+ var version$4 = "0.2.15";
178
175
 
179
- var version$3 = "0.1.23";
176
+ var version$3 = "0.2.0";
180
177
 
181
- var version$2 = "0.2.13";
178
+ var version$2 = "0.2.14";
182
179
 
183
- var version$1 = "0.15.14";
180
+ var version$1 = "0.15.18";
184
181
 
185
182
  const packageVersions = {
186
183
  "@backstage/backend-common": version$9,
@@ -195,11 +192,11 @@ const packageVersions = {
195
192
  "@backstage/plugin-scaffolder-backend": version$1
196
193
  };
197
194
  function findVersion() {
198
- const pkgContent = fs__default['default'].readFileSync(paths.resolveOwn("package.json"), "utf8");
195
+ const pkgContent = fs__default["default"].readFileSync(paths.resolveOwn("package.json"), "utf8");
199
196
  return JSON.parse(pkgContent).version;
200
197
  }
201
198
  const version = findVersion();
202
- fs__default['default'].pathExistsSync(paths.resolveOwn("src"));
199
+ fs__default["default"].pathExistsSync(paths.resolveOwn("src"));
203
200
  function createPackageVersionProvider(lockfile) {
204
201
  return (name, versionHint) => {
205
202
  var _a;
@@ -212,7 +209,7 @@ function createPackageVersionProvider(lockfile) {
212
209
  if (name.startsWith("@types/") && (lockfileEntries == null ? void 0 : lockfileEntries.some((entry) => entry.range === "*"))) {
213
210
  return "*";
214
211
  }
215
- const validRanges = lockfileEntries == null ? void 0 : lockfileEntries.filter((entry) => semver__default['default'].satisfies(targetVersion, entry.range));
212
+ const validRanges = lockfileEntries == null ? void 0 : lockfileEntries.filter((entry) => semver__default["default"].satisfies(targetVersion, entry.range));
216
213
  const highestRange = validRanges == null ? void 0 : validRanges.slice(-1)[0];
217
214
  if (highestRange == null ? void 0 : highestRange.range) {
218
215
  return highestRange == null ? void 0 : highestRange.range;
@@ -220,10 +217,10 @@ function createPackageVersionProvider(lockfile) {
220
217
  if (packageVersion) {
221
218
  return `^${packageVersion}`;
222
219
  }
223
- if ((_a = semver__default['default'].parse(versionHint)) == null ? void 0 : _a.prerelease.length) {
220
+ if ((_a = semver__default["default"].parse(versionHint)) == null ? void 0 : _a.prerelease.length) {
224
221
  return versionHint;
225
222
  }
226
- return `^${versionHint}`;
223
+ return (versionHint == null ? void 0 : versionHint.match(/^[\d\.]+$/)) ? `^${versionHint}` : versionHint;
227
224
  };
228
225
  }
229
226
 
@@ -234,34 +231,33 @@ function registerCommands(program) {
234
231
  (opt, opts) => [...opts, opt],
235
232
  Array()
236
233
  ];
237
- program.command("app:build").description("Build an app for a production release").option("--stats", "Write bundle stats to output directory").option("--lax", "Do not require environment variables to be set").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./build-75ee78ab.cjs.js'); }).then((m) => m.default)));
238
- program.command("app:serve").description("Serve an app for local development").option("--check", "Enable type checking and linting").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./serve-199d043b.cjs.js'); }).then((m) => m.default)));
239
- program.command("backend:build").description("Build a backend plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-7302d21d.cjs.js'); }).then((m) => m.default)));
240
- program.command("backend:bundle").description("Bundle the backend into a deployment archive").option("--build-dependencies", "Build all local package dependencies before bundling the backend").action(lazy(() => Promise.resolve().then(function () { return require('./bundle-4390c300.cjs.js'); }).then((m) => m.default)));
241
- program.command("backend:build-image").allowUnknownOption(true).helpOption(", --backstage-cli-help").option("--build", "Build packages before packing them into the image").description("Bundles the package into a docker image. This command is deprecated and will be removed.").action(lazy(() => Promise.resolve().then(function () { return require('./buildImage-477aa186.cjs.js'); }).then((m) => m.default)));
242
- program.command("backend:dev").description("Start local development server with HMR for the backend").option("--check", "Enable type checking and linting").option("--inspect", "Enable debugger").option("--inspect-brk", "Enable debugger with await to attach debugger").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./dev-02640e59.cjs.js'); }).then((m) => m.default)));
243
- program.command("create").storeOptionsAsProperties(false).description("Open up an interactive guide to creating new things in your app").option("--select <name>", "Select the thing you want to be creating upfront").option("--option <name>=<value>", "Pre-fill options for the creation process", (opt, arr) => [...arr, opt], []).option("--scope <scope>", "The scope to use for new packages").option("--npm-registry <URL>", "The package registry to use for new packages").option("--no-private", "Do not mark new packages as private").action(lazy(() => Promise.resolve().then(function () { return require('./create-4ffadaca.cjs.js'); }).then((m) => m.default)));
244
- program.command("create-plugin").option("--backend", "Create plugin with the backend dependencies as default").description("Creates a new plugin in the current repository").option("--scope <scope>", "npm scope").option("--npm-registry <URL>", "npm registry URL").option("--no-private", "Public npm package").action(lazy(() => Promise.resolve().then(function () { return require('./createPlugin-eb7251ea.cjs.js'); }).then((m) => m.default)));
245
- program.command("remove-plugin").description("Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-595ea65d.cjs.js'); }).then((m) => m.default)));
246
- program.command("plugin:build").description("Build a plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-33ad5323.cjs.js'); }).then((m) => m.default)));
247
- program.command("plugin:serve").description("Serves the dev/ folder of a plugin").option("--check", "Enable type checking and linting").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./serve-e57a7acf.cjs.js'); }).then((m) => m.default)));
248
- program.command("plugin:diff").option("--check", "Fail if changes are required").option("--yes", "Apply all changes").description("Diff an existing plugin with the creation template").action(lazy(() => Promise.resolve().then(function () { return require('./diff-56188f93.cjs.js'); }).then((m) => m.default)));
249
- program.command("build").description("Build a package for publishing").option("--outputs <formats>", "List of formats to output [types,cjs,esm]").action(lazy(() => Promise.resolve().then(function () { return require('./build-e21fe681.cjs.js'); }).then((m) => m.default)));
250
- program.command("lint").option("--format <format>", "Lint report output format", "eslint-formatter-friendly").option("--fix", "Attempt to automatically fix violations").description("Lint a package").action(lazy(() => Promise.resolve().then(function () { return require('./lint-03faccc3.cjs.js'); }).then((m) => m.default)));
251
- program.command("test").allowUnknownOption(true).helpOption(", --backstage-cli-help").description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy(() => Promise.resolve().then(function () { return require('./testCommand-a5c5fec6.cjs.js'); }).then((m) => m.default)));
252
- program.command("config:docs").option("--package <name>", "Only include the schema that applies to the given package").description("Browse the configuration reference documentation").action(lazy(() => Promise.resolve().then(function () { return require('./docs-8039cb55.cjs.js'); }).then((m) => m.default)));
253
- program.command("config:print").option("--package <name>", "Only load config schema that applies to the given package").option("--lax", "Do not require environment variables to be set").option("--frontend", "Print only the frontend configuration").option("--with-secrets", "Include secrets in the printed configuration").option("--format <format>", "Format to print the configuration in, either json or yaml [yaml]").option(...configOption).description("Print the app configuration for the current package").action(lazy(() => Promise.resolve().then(function () { return require('./print-fec91280.cjs.js'); }).then((m) => m.default)));
254
- program.command("config:check").option("--package <name>", "Only load config schema that applies to the given package").option("--lax", "Do not require environment variables to be set").option("--frontend", "Only validate the frontend configuration").option(...configOption).description("Validate that the given configuration loads and matches schema").action(lazy(() => Promise.resolve().then(function () { return require('./validate-011c509c.cjs.js'); }).then((m) => m.default)));
255
- program.command("config:schema").option("--package <name>", "Only output config schema that applies to the given package").option("--format <format>", "Format to print the schema in, either json or yaml [yaml]").description("Print configuration schema").action(lazy(() => Promise.resolve().then(function () { return require('./schema-00648d3a.cjs.js'); }).then((m) => m.default)));
256
- program.command("versions:bump").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-5e4ffccb.cjs.js'); }).then((m) => m.default)));
257
- program.command("versions:check").option("--fix", "Fix any auto-fixable versioning problems").description("Check Backstage package versioning").action(lazy(() => Promise.resolve().then(function () { return require('./lint-50ae8c8b.cjs.js'); }).then((m) => m.default)));
258
- program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-7d39c708.cjs.js'); }).then((m) => m.pre)));
259
- program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-7d39c708.cjs.js'); }).then((m) => m.post)));
260
- program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-9279505e.cjs.js'); }).then((m) => m.default)));
261
- program.command("build-workspace <workspace-dir> ...<packages>").description("Builds a temporary dist workspace from the provided packages").action(lazy(() => Promise.resolve().then(function () { return require('./buildWorkspace-fa590fad.cjs.js'); }).then((m) => m.default)));
262
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-e84c4ef7.cjs.js'); }).then((m) => m.default)));
263
- program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-2a0746e3.cjs.js'); }).then((m) => m.default)));
264
- program.command("install [plugin-id]", {hidden: true}).option("--from <packageJsonFilePath>", "Install from a local package.json containing the installation recipe").description("Install a Backstage plugin [EXPERIMENTAL]").action(lazy(() => Promise.resolve().then(function () { return require('./install-807a9039.cjs.js'); }).then((m) => m.default)));
234
+ program.command("app:build").description("Build an app for a production release").option("--stats", "Write bundle stats to output directory").option("--lax", "[DEPRECATED] - Do not require environment variables to be set").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./build-be0f943d.cjs.js'); }).then((m) => m.default)));
235
+ program.command("app:serve").description("Serve an app for local development").option("--check", "Enable type checking and linting").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./serve-9b01661e.cjs.js'); }).then((m) => m.default)));
236
+ program.command("backend:build").description("Build a backend plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-aa750983.cjs.js'); }).then((m) => m.default)));
237
+ program.command("backend:bundle").description("Bundle the backend into a deployment archive").option("--build-dependencies", "Build all local package dependencies before bundling the backend").action(lazy(() => Promise.resolve().then(function () { return require('./bundle-a35469cc.cjs.js'); }).then((m) => m.default)));
238
+ program.command("backend:dev").description("Start local development server with HMR for the backend").option("--check", "Enable type checking and linting").option("--inspect", "Enable debugger").option("--inspect-brk", "Enable debugger with await to attach debugger").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./dev-0a2ead14.cjs.js'); }).then((m) => m.default)));
239
+ program.command("create").storeOptionsAsProperties(false).description("Open up an interactive guide to creating new things in your app").option("--select <name>", "Select the thing you want to be creating upfront").option("--option <name>=<value>", "Pre-fill options for the creation process", (opt, arr) => [...arr, opt], []).option("--scope <scope>", "The scope to use for new packages").option("--npm-registry <URL>", "The package registry to use for new packages").option("--no-private", "Do not mark new packages as private").action(lazy(() => Promise.resolve().then(function () { return require('./create-cf52e54d.cjs.js'); }).then((m) => m.default)));
240
+ program.command("create-plugin").option("--backend", "Create plugin with the backend dependencies as default").description("Creates a new plugin in the current repository").option("--scope <scope>", "npm scope").option("--npm-registry <URL>", "npm registry URL").option("--no-private", "Public npm package").action(lazy(() => Promise.resolve().then(function () { return require('./createPlugin-b87a78f0.cjs.js'); }).then((m) => m.default)));
241
+ program.command("remove-plugin").description("[DEPRECATED] - Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-272a3d37.cjs.js'); }).then((m) => m.default)));
242
+ program.command("plugin:build").description("Build a plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-b73c146e.cjs.js'); }).then((m) => m.default)));
243
+ program.command("plugin:serve").description("Serves the dev/ folder of a plugin").option("--check", "Enable type checking and linting").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./serve-50b65188.cjs.js'); }).then((m) => m.default)));
244
+ program.command("plugin:diff").option("--check", "Fail if changes are required").option("--yes", "Apply all changes").description("Diff an existing plugin with the creation template").action(lazy(() => Promise.resolve().then(function () { return require('./diff-4789ad9c.cjs.js'); }).then((m) => m.default)));
245
+ program.command("build").description("Build a package for publishing").option("--outputs <formats>", "List of formats to output [types,cjs,esm]").action(lazy(() => Promise.resolve().then(function () { return require('./build-e5c1f9cd.cjs.js'); }).then((m) => m.default)));
246
+ program.command("lint").option("--format <format>", "Lint report output format", "eslint-formatter-friendly").option("--fix", "Attempt to automatically fix violations").description("Lint a package").action(lazy(() => Promise.resolve().then(function () { return require('./lint-4ec38c59.cjs.js'); }).then((m) => m.default)));
247
+ program.command("test").allowUnknownOption(true).helpOption(", --backstage-cli-help").description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy(() => Promise.resolve().then(function () { return require('./testCommand-a9f0692f.cjs.js'); }).then((m) => m.default)));
248
+ program.command("config:docs").option("--package <name>", "Only include the schema that applies to the given package").description("Browse the configuration reference documentation").action(lazy(() => Promise.resolve().then(function () { return require('./docs-12b2616e.cjs.js'); }).then((m) => m.default)));
249
+ program.command("config:print").option("--package <name>", "Only load config schema that applies to the given package").option("--lax", "Do not require environment variables to be set").option("--frontend", "Print only the frontend configuration").option("--with-secrets", "Include secrets in the printed configuration").option("--format <format>", "Format to print the configuration in, either json or yaml [yaml]").option(...configOption).description("Print the app configuration for the current package").action(lazy(() => Promise.resolve().then(function () { return require('./print-8d26381a.cjs.js'); }).then((m) => m.default)));
250
+ program.command("config:check").option("--package <name>", "Only load config schema that applies to the given package").option("--lax", "Do not require environment variables to be set").option("--frontend", "Only validate the frontend configuration").option(...configOption).description("Validate that the given configuration loads and matches schema").action(lazy(() => Promise.resolve().then(function () { return require('./validate-0a0893b6.cjs.js'); }).then((m) => m.default)));
251
+ program.command("config:schema").option("--package <name>", "Only output config schema that applies to the given package").option("--format <format>", "Format to print the schema in, either json or yaml [yaml]").description("Print configuration schema").action(lazy(() => Promise.resolve().then(function () { return require('./schema-ea8ebcbf.cjs.js'); }).then((m) => m.default)));
252
+ program.command("versions:bump").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-d6b32625.cjs.js'); }).then((m) => m.default)));
253
+ program.command("versions:check").option("--fix", "Fix any auto-fixable versioning problems").description("Check Backstage package versioning").action(lazy(() => Promise.resolve().then(function () { return require('./lint-a525caa3.cjs.js'); }).then((m) => m.default)));
254
+ program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-5af390ec.cjs.js'); }).then((m) => m.pre)));
255
+ program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-5af390ec.cjs.js'); }).then((m) => m.post)));
256
+ program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-2294315a.cjs.js'); }).then((m) => m.default)));
257
+ program.command("build-workspace <workspace-dir> ...<packages>").description("Builds a temporary dist workspace from the provided packages").action(lazy(() => Promise.resolve().then(function () { return require('./buildWorkspace-8c1d5134.cjs.js'); }).then((m) => m.default)));
258
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-451d4133.cjs.js'); }).then((m) => m.default)));
259
+ program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-c8361946.cjs.js'); }).then((m) => m.default)));
260
+ program.command("install [plugin-id]", { hidden: true }).option("--from <packageJsonFilePath>", "Install from a local package.json containing the installation recipe").description("Install a Backstage plugin [EXPERIMENTAL]").action(lazy(() => Promise.resolve().then(function () { return require('./install-68bbffa5.cjs.js'); }).then((m) => m.default)));
265
261
  }
266
262
  function lazy(getActionFunc) {
267
263
  return async (...args) => {
@@ -277,16 +273,16 @@ function lazy(getActionFunc) {
277
273
  }
278
274
 
279
275
  const main = (argv) => {
280
- program__default['default'].name("backstage-cli").version(version);
281
- registerCommands(program__default['default']);
282
- program__default['default'].on("command:*", () => {
276
+ program__default["default"].name("backstage-cli").version(version);
277
+ registerCommands(program__default["default"]);
278
+ program__default["default"].on("command:*", () => {
283
279
  console.log();
284
- console.log(chalk__default['default'].red(`Invalid command: ${program__default['default'].args.join(" ")}`));
280
+ console.log(chalk__default["default"].red(`Invalid command: ${program__default["default"].args.join(" ")}`));
285
281
  console.log();
286
- program__default['default'].outputHelp();
282
+ program__default["default"].outputHelp();
287
283
  process.exit(1);
288
284
  });
289
- program__default['default'].parse(argv);
285
+ program__default["default"].parse(argv);
290
286
  };
291
287
  process.on("unhandledRejection", (rejection) => {
292
288
  if (rejection instanceof Error) {
@@ -305,4 +301,4 @@ exports.devDependencies = devDependencies;
305
301
  exports.paths = paths;
306
302
  exports.version = version;
307
303
  exports.version$1 = version$8;
308
- //# sourceMappingURL=index-994e77d9.cjs.js.map
304
+ //# sourceMappingURL=index-dc8e5d2a.cjs.js.map
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-994e77d9.cjs.js');
3
+ var index = require('./index-dc8e5d2a.cjs.js');
4
4
  var os = require('os');
5
- var run = require('./run-40072d67.cjs.js');
6
- var Lockfile = require('./Lockfile-80f0eec4.cjs.js');
5
+ var run = require('./run-330d1527.cjs.js');
6
+ var Lockfile = require('./Lockfile-35661afa.cjs.js');
7
7
  require('chalk');
8
8
  require('commander');
9
9
  require('fs-extra');
@@ -23,7 +23,7 @@ var info = async () => {
23
23
  await new Promise(async () => {
24
24
  const yarnVersion = await run.runPlain("yarn --version");
25
25
  const isLocal = require("fs").existsSync(index.paths.resolveOwn("./src"));
26
- console.log(`OS: ${os__default['default'].type} ${os__default['default'].release} - ${os__default['default'].platform}/${os__default['default'].arch}`);
26
+ console.log(`OS: ${os__default["default"].type} ${os__default["default"].release} - ${os__default["default"].platform}/${os__default["default"].arch}`);
27
27
  console.log(`node: ${process.version}`);
28
28
  console.log(`yarn: ${yarnVersion}`);
29
29
  console.log(`cli: ${index.version$1} (${isLocal ? "local" : "installed"})`);
@@ -40,5 +40,5 @@ var info = async () => {
40
40
  });
41
41
  };
42
42
 
43
- exports.default = info;
44
- //# sourceMappingURL=info-2a0746e3.cjs.js.map
43
+ exports["default"] = info;
44
+ //# sourceMappingURL=info-c8361946.cjs.js.map
@@ -3,12 +3,12 @@
3
3
  var fs = require('fs-extra');
4
4
  require('semver');
5
5
  require('@yarnpkg/lockfile');
6
- var packages = require('./packages-24e76f27.cjs.js');
7
- var index = require('./index-994e77d9.cjs.js');
6
+ var packages = require('./packages-5bd09b6a.cjs.js');
7
+ var index = require('./index-dc8e5d2a.cjs.js');
8
8
  var chalk = require('chalk');
9
9
  var sortBy = require('lodash/sortBy');
10
10
  var groupBy = require('lodash/groupBy');
11
- var run = require('./run-40072d67.cjs.js');
11
+ var run = require('./run-330d1527.cjs.js');
12
12
  require('commander');
13
13
  require('@backstage/cli-common');
14
14
  require('@backstage/config/package.json');
@@ -33,9 +33,9 @@ class AppRouteStep {
33
33
  }
34
34
  async run() {
35
35
  var _a;
36
- const {path, element, packageName} = this.data;
36
+ const { path, element, packageName } = this.data;
37
37
  const appTsxPath = index.paths.resolveTargetRoot("packages/app/src/App.tsx");
38
- const contents = await fs__default['default'].readFile(appTsxPath, "utf-8");
38
+ const contents = await fs__default["default"].readFile(appTsxPath, "utf-8");
39
39
  let failed = false;
40
40
  const contentsWithRoute = contents.replace(/(\s*)<\/FlatRoutes>/, `$1 <Route path="${path}" element={${element}} />$1</FlatRoutes>`);
41
41
  if (contentsWithRoute === contents) {
@@ -56,21 +56,21 @@ import `);
56
56
  console.log(`1. import { ${componentName} } from '${packageName}';`);
57
57
  console.log(`2. <Route path="${path}" element={${element}} />`);
58
58
  } else {
59
- await fs__default['default'].writeFile(appTsxPath, contentsWithImport);
59
+ await fs__default["default"].writeFile(appTsxPath, contentsWithImport);
60
60
  }
61
61
  }
62
62
  }
63
63
  const appRoute = createStepDefinition({
64
64
  type: "app-route",
65
65
  deserialize(obj, pkg) {
66
- const {path, element} = obj;
66
+ const { path, element } = obj;
67
67
  if (!path || typeof path !== "string") {
68
68
  throw new Error("Invalid install step, 'path' must be a string");
69
69
  }
70
70
  if (!element || typeof element !== "string") {
71
71
  throw new Error("Invalid install step, 'element' must be a string");
72
72
  }
73
- return new AppRouteStep({path, element, packageName: pkg.name});
73
+ return new AppRouteStep({ path, element, packageName: pkg.name });
74
74
  },
75
75
  create(data) {
76
76
  return new AppRouteStep(data);
@@ -82,23 +82,23 @@ class DependenciesStep {
82
82
  this.data = data;
83
83
  }
84
84
  async run() {
85
- const {dependencies: dependencies2} = this.data;
86
- const byTarget = groupBy__default['default'](dependencies2, "target");
85
+ const { dependencies: dependencies2 } = this.data;
86
+ const byTarget = groupBy__default["default"](dependencies2, "target");
87
87
  for (const [target, deps] of Object.entries(byTarget)) {
88
88
  const pkgPath = index.paths.resolveTargetRoot(target, "package.json");
89
- const pkgJson = await fs__default['default'].readJson(pkgPath);
90
- const depTypes = new Set();
89
+ const pkgJson = await fs__default["default"].readJson(pkgPath);
90
+ const depTypes = /* @__PURE__ */ new Set();
91
91
  for (const dep of deps) {
92
92
  depTypes.add(dep.type);
93
93
  pkgJson[dep.type][dep.name] = dep.query;
94
94
  }
95
95
  for (const depType of depTypes) {
96
- pkgJson[depType] = Object.fromEntries(sortBy__default['default'](Object.entries(pkgJson[depType]), ([key]) => key));
96
+ pkgJson[depType] = Object.fromEntries(sortBy__default["default"](Object.entries(pkgJson[depType]), ([key]) => key));
97
97
  }
98
- await fs__default['default'].writeJson(pkgPath, pkgJson, {spaces: 2});
98
+ await fs__default["default"].writeJson(pkgPath, pkgJson, { spaces: 2 });
99
99
  }
100
100
  console.log();
101
- console.log(`Running ${chalk__default['default'].blue("yarn install")} to install new versions`);
101
+ console.log(`Running ${chalk__default["default"].blue("yarn install")} to install new versions`);
102
102
  console.log();
103
103
  await run.run("yarn", ["install"]);
104
104
  }
@@ -124,11 +124,11 @@ class MessageStep {
124
124
  const message = createStepDefinition({
125
125
  type: "message",
126
126
  deserialize(obj) {
127
- const {message: msg} = obj;
127
+ const { message: msg } = obj;
128
128
  if (!msg || typeof msg !== "string" && !Array.isArray(msg)) {
129
129
  throw new Error("Invalid install step, 'message' must be a string or array");
130
130
  }
131
- return new MessageStep({message: [msg].flat().join("")});
131
+ return new MessageStep({ message: [msg].flat().join("") });
132
132
  },
133
133
  create(data) {
134
134
  return new MessageStep(data);
@@ -161,7 +161,7 @@ class PluginInstaller {
161
161
  constructor(steps) {
162
162
  this.steps = steps;
163
163
  }
164
- static async resolveSteps(pkg) {
164
+ static async resolveSteps(pkg, versionToInstall) {
165
165
  var _a, _b;
166
166
  const steps = [];
167
167
  const dependencies$1 = [];
@@ -169,14 +169,14 @@ class PluginInstaller {
169
169
  target: "packages/app",
170
170
  type: "dependencies",
171
171
  name: pkg.name,
172
- query: `^${pkg.version}`
172
+ query: versionToInstall || `^${pkg.version}`
173
173
  });
174
174
  steps.push({
175
175
  type: "dependencies",
176
- step: dependencies.create({dependencies: dependencies$1})
176
+ step: dependencies.create({ dependencies: dependencies$1 })
177
177
  });
178
178
  for (const step of (_b = (_a = pkg.experimentalInstallationRecipe) == null ? void 0 : _a.steps) != null ? _b : []) {
179
- const {type} = step;
179
+ const { type } = step;
180
180
  const definition = stepDefinitions.find((d) => d.type === type);
181
181
  if (definition) {
182
182
  steps.push({
@@ -190,25 +190,52 @@ class PluginInstaller {
190
190
  return steps;
191
191
  }
192
192
  async run() {
193
- for (const {type, step} of this.steps) {
193
+ for (const { type, step } of this.steps) {
194
194
  console.log(`Running step ${type}`);
195
195
  await step.run();
196
196
  }
197
197
  }
198
198
  }
199
+ async function installPluginAndPeerPlugins(pkg) {
200
+ const pluginDeps = /* @__PURE__ */ new Map();
201
+ pluginDeps.set(pkg.name, { pkg });
202
+ await loadPeerPluginDeps(pkg, pluginDeps);
203
+ console.log(`Installing ${pkg.name} AND any peer plugin dependencies.`);
204
+ for (const [_pluginDepName, pluginDep] of pluginDeps.entries()) {
205
+ const { pkg: pluginDepPkg, versionToInstall } = pluginDep;
206
+ console.log(`Installing plugin: ${pluginDepPkg.name}: ${versionToInstall || pluginDepPkg.version}`);
207
+ const steps = await PluginInstaller.resolveSteps(pluginDepPkg, versionToInstall);
208
+ const installer = new PluginInstaller(steps);
209
+ await installer.run();
210
+ }
211
+ }
212
+ async function loadPackageJson(plugin) {
213
+ if (plugin.endsWith("package.json")) {
214
+ return await fs__default["default"].readJson(plugin);
215
+ }
216
+ return await fetchPluginPackage(plugin);
217
+ }
218
+ async function loadPeerPluginDeps(pkg, pluginMap) {
219
+ var _a, _b;
220
+ for (const [pluginId, pluginVersion] of Object.entries((_b = (_a = pkg.experimentalInstallationRecipe) == null ? void 0 : _a.peerPluginDependencies) != null ? _b : {})) {
221
+ const depPkg = await loadPackageJson(pluginId);
222
+ if (!pluginMap.get(depPkg.name)) {
223
+ pluginMap.set(depPkg.name, {
224
+ pkg: depPkg,
225
+ versionToInstall: pluginVersion
226
+ });
227
+ await loadPeerPluginDeps(depPkg, pluginMap);
228
+ }
229
+ }
230
+ }
199
231
  var install = async (pluginId, cmd) => {
200
- let pkg;
201
- if (pluginId) {
202
- pkg = await fetchPluginPackage(pluginId);
203
- } else if (cmd == null ? void 0 : cmd.from) {
204
- pkg = await fs__default['default'].readJson(cmd.from);
205
- } else {
232
+ const from = pluginId || (cmd == null ? void 0 : cmd.from);
233
+ if (!from) {
206
234
  throw new Error("Missing both <plugin-id> or a package.json file path in the --from flag.");
207
235
  }
208
- const steps = await PluginInstaller.resolveSteps(pkg);
209
- const installer = new PluginInstaller(steps);
210
- await installer.run();
236
+ const pkg = await loadPackageJson(from);
237
+ await installPluginAndPeerPlugins(pkg);
211
238
  };
212
239
 
213
- exports.default = install;
214
- //# sourceMappingURL=install-807a9039.cjs.js.map
240
+ exports["default"] = install;
241
+ //# sourceMappingURL=install-68bbffa5.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var run = require('./run-40072d67.cjs.js');
4
- var index = require('./index-994e77d9.cjs.js');
3
+ var run = require('./run-330d1527.cjs.js');
4
+ var index = require('./index-dc8e5d2a.cjs.js');
5
5
  require('child_process');
6
6
  require('util');
7
7
  require('@backstage/errors');
@@ -14,7 +14,7 @@ require('@backstage/config/package.json');
14
14
 
15
15
  var lint = async (cmd, cmdArgs) => {
16
16
  const args = [
17
- "--ext=js,jsx,ts,tsx",
17
+ "--ext=js,jsx,ts,tsx,mjs,cjs",
18
18
  "--max-warnings=0",
19
19
  `--format=${cmd.format}`,
20
20
  ...cmdArgs != null ? cmdArgs : [index.paths.targetDir]
@@ -25,5 +25,5 @@ var lint = async (cmd, cmdArgs) => {
25
25
  await run.run("eslint", args);
26
26
  };
27
27
 
28
- exports.default = lint;
29
- //# sourceMappingURL=lint-03faccc3.cjs.js.map
28
+ exports["default"] = lint;
29
+ //# sourceMappingURL=lint-4ec38c59.cjs.js.map
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var Lockfile = require('./Lockfile-80f0eec4.cjs.js');
4
- require('./run-40072d67.cjs.js');
3
+ var Lockfile = require('./Lockfile-35661afa.cjs.js');
4
+ require('./run-330d1527.cjs.js');
5
5
  require('chalk');
6
- var index = require('./index-994e77d9.cjs.js');
6
+ var index = require('./index-dc8e5d2a.cjs.js');
7
7
  var partition = require('lodash/partition');
8
8
  require('fs-extra');
9
9
  require('semver');
@@ -42,14 +42,14 @@ var lint = async (cmd) => {
42
42
  lockfile.replaceVersions(result.newVersions);
43
43
  await lockfile.save();
44
44
  } else {
45
- const [newVersionsForbidden, newVersionsAllowed] = partition__default['default'](result.newVersions, ({name}) => forbiddenDuplicatesFilter(name));
45
+ const [newVersionsForbidden, newVersionsAllowed] = partition__default["default"](result.newVersions, ({ name }) => forbiddenDuplicatesFilter(name));
46
46
  if (newVersionsForbidden.length && !fix) {
47
47
  success = false;
48
48
  }
49
49
  logArray(newVersionsForbidden, "The following packages must be deduplicated, this can be done automatically with --fix", (e) => ` ${e.name} @ ${e.range} bumped from ${e.oldVersion} to ${e.newVersion}`);
50
50
  logArray(newVersionsAllowed, "The following packages can be deduplicated, this can be done automatically with --fix", (e) => ` ${e.name} @ ${e.range} bumped from ${e.oldVersion} to ${e.newVersion}`);
51
51
  }
52
- const [newRangesForbidden, newRangesAllowed] = partition__default['default'](result.newRanges, ({name}) => forbiddenDuplicatesFilter(name));
52
+ const [newRangesForbidden, newRangesAllowed] = partition__default["default"](result.newRanges, ({ name }) => forbiddenDuplicatesFilter(name));
53
53
  if (newRangesForbidden.length) {
54
54
  success = false;
55
55
  }
@@ -71,7 +71,7 @@ function logArray(arr, header, each) {
71
71
  console.log();
72
72
  }
73
73
 
74
- exports.default = lint;
74
+ exports["default"] = lint;
75
75
  exports.forbiddenDuplicatesFilter = forbiddenDuplicatesFilter;
76
76
  exports.includedFilter = includedFilter;
77
- //# sourceMappingURL=lint-50ae8c8b.cjs.js.map
77
+ //# sourceMappingURL=lint-a525caa3.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs-extra');
4
- var index = require('./index-994e77d9.cjs.js');
4
+ var index = require('./index-dc8e5d2a.cjs.js');
5
5
  require('commander');
6
6
  require('chalk');
7
7
  require('semver');
@@ -19,19 +19,19 @@ const PKG_BACKUP_PATH = "package.json-prepack";
19
19
  const pre = async () => {
20
20
  var _a;
21
21
  const pkgPath = index.paths.resolveTarget(PKG_PATH);
22
- const pkgContent = await fs__default['default'].readFile(pkgPath, "utf8");
22
+ const pkgContent = await fs__default["default"].readFile(pkgPath, "utf8");
23
23
  const pkg = JSON.parse(pkgContent);
24
- await fs__default['default'].writeFile(PKG_BACKUP_PATH, pkgContent);
24
+ await fs__default["default"].writeFile(PKG_BACKUP_PATH, pkgContent);
25
25
  for (const key of Object.keys((_a = pkg.publishConfig) != null ? _a : {})) {
26
26
  if (!SKIPPED_KEYS.includes(key)) {
27
27
  pkg[key] = pkg.publishConfig[key];
28
28
  }
29
29
  }
30
- await fs__default['default'].writeJson(pkgPath, pkg, {encoding: "utf8", spaces: 2});
30
+ await fs__default["default"].writeJson(pkgPath, pkg, { encoding: "utf8", spaces: 2 });
31
31
  };
32
32
  const post = async () => {
33
33
  try {
34
- await fs__default['default'].move(PKG_BACKUP_PATH, PKG_PATH, {overwrite: true});
34
+ await fs__default["default"].move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true });
35
35
  } catch (error) {
36
36
  console.warn(`Failed to restore package.json during postpack, ${error}. Your package will be fine but you may have ended up with some garbage in the repo.`);
37
37
  }
@@ -39,4 +39,4 @@ const post = async () => {
39
39
 
40
40
  exports.post = post;
41
41
  exports.pre = pre;
42
- //# sourceMappingURL=pack-7d39c708.cjs.js.map
42
+ //# sourceMappingURL=pack-5af390ec.cjs.js.map