@backstage/cli 0.18.0 → 0.18.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 (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/config/eslint-factory.js +1 -1
  3. package/dist/cjs/{Lockfile-48dc675e.cjs.js → Lockfile-72b7072e.cjs.js} +25 -9
  4. package/dist/cjs/{PackageGraph-1d7b086a.cjs.js → PackageGraph-7ea22294.cjs.js} +17 -9
  5. package/dist/cjs/{build-52ba70a2.cjs.js → build-688edcd3.cjs.js} +26 -15
  6. package/dist/cjs/{buildBackend-55985c84.cjs.js → buildBackend-ac6c633b.cjs.js} +61 -36
  7. package/dist/cjs/{buildWorkspace-d663903d.cjs.js → buildWorkspace-76f958f0.cjs.js} +7 -7
  8. package/dist/cjs/{bump-1a3769e9.cjs.js → bump-db89c0f3.cjs.js} +88 -33
  9. package/dist/cjs/{clean-9a8c294a.cjs.js → clean-68c34bfd.cjs.js} +2 -2
  10. package/dist/cjs/{config-de1bf46a.cjs.js → config-9d64a562.cjs.js} +15 -11
  11. package/dist/cjs/{create-b0ca2add.cjs.js → create-94a20b19.cjs.js} +80 -32
  12. package/dist/cjs/{createDistWorkspace-fc94c796.cjs.js → createDistWorkspace-0412df70.cjs.js} +137 -65
  13. package/dist/cjs/{createPlugin-4d7e1b01.cjs.js → createPlugin-02079f81.cjs.js} +69 -30
  14. package/dist/cjs/{diff-a561bee3.cjs.js → diff-f68eaf29.cjs.js} +68 -16
  15. package/dist/cjs/{docs-bd70b38e.cjs.js → docs-1527b730.cjs.js} +9 -5
  16. package/dist/cjs/{fix-47eb8dc4.cjs.js → fix-56a6d092.cjs.js} +17 -7
  17. package/dist/cjs/{index-27d57881.cjs.js → index-025feb83.cjs.js} +10 -10
  18. package/dist/cjs/{index-bb24147b.cjs.js → index-16fe1d27.cjs.js} +39 -12
  19. package/dist/cjs/{index-4f4a8498.cjs.js → index-4f8f2562.cjs.js} +58 -38
  20. package/dist/cjs/{index-7e13cc9d.cjs.js → index-b7ce30d9.cjs.js} +151 -50
  21. package/dist/cjs/{info-29f0ee36.cjs.js → info-88431720.cjs.js} +20 -6
  22. package/dist/cjs/{install-fea0e3f5.cjs.js → install-4d423030.cjs.js} +44 -17
  23. package/dist/cjs/{lint-0db8937c.cjs.js → lint-2fd53d5f.cjs.js} +4 -4
  24. package/dist/cjs/{lint-81a75364.cjs.js → lint-bd7b9e13.cjs.js} +37 -11
  25. package/dist/cjs/{lint-1711bbbb.cjs.js → lint-da011116.cjs.js} +5 -3
  26. package/dist/cjs/{list-deprecations-cea8fad3.cjs.js → list-deprecations-268e1d6b.cjs.js} +3 -3
  27. package/dist/cjs/{pack-8ab429c0.cjs.js → pack-ce12d4b7.cjs.js} +17 -11
  28. package/dist/cjs/packageLintConfigs-9f3b0766.cjs.js +83 -0
  29. package/dist/cjs/packageRole-582e0558.cjs.js +59 -0
  30. package/dist/cjs/{packageRoles-a310f84c.cjs.js → packageRoles-fec3121b.cjs.js} +5 -3
  31. package/dist/cjs/packageScripts-04ac9bc2.cjs.js +98 -0
  32. package/dist/cjs/{packages-ea5c38ec.cjs.js → packages-24759dcb.cjs.js} +17 -12
  33. package/dist/cjs/parallel-a8f6219c.cjs.js +187 -0
  34. package/dist/cjs/{paths-d98c9d0c.cjs.js → paths-13d8625f.cjs.js} +102 -57
  35. package/dist/cjs/{print-4cbe70e7.cjs.js → print-58fe18ba.cjs.js} +4 -4
  36. package/dist/cjs/{run-5e05ba2c.cjs.js → run-f4586ef6.cjs.js} +2 -2
  37. package/dist/cjs/{schema-2c842cbe.cjs.js → schema-65c31be1.cjs.js} +9 -5
  38. package/dist/cjs/{tasks-b054c9ce.cjs.js → tasks-16da761b.cjs.js} +29 -12
  39. package/dist/cjs/{test-b5969f53.cjs.js → test-464a46fe.cjs.js} +3 -3
  40. package/dist/cjs/{validate-8a03d402.cjs.js → validate-3231ba7d.cjs.js} +4 -4
  41. package/dist/index.cjs.js +1 -1
  42. package/package.json +12 -12
  43. package/dist/cjs/packageLintConfigs-77b71b79.cjs.js +0 -74
  44. package/dist/cjs/packageRole-d1e7c7d6.cjs.js +0 -53
  45. package/dist/cjs/packageScripts-6731503e.cjs.js +0 -96
  46. package/dist/cjs/parallel-8286d3fa.cjs.js +0 -171
@@ -12,8 +12,8 @@ var cliCommon = require('@backstage/cli-common');
12
12
  var getPackages = require('@manypkg/get-packages');
13
13
  var MiniCssExtractPlugin = require('mini-css-extract-plugin');
14
14
  var svgrTemplate = require('./svgrTemplate-550efce6.cjs.js');
15
- var index = require('./index-7e13cc9d.cjs.js');
16
- var run = require('./run-5e05ba2c.cjs.js');
15
+ var index = require('./index-b7ce30d9.cjs.js');
16
+ var run = require('./run-f4586ef6.cjs.js');
17
17
  var ESLintPlugin = require('eslint-webpack-plugin');
18
18
  var pickBy = require('lodash/pickBy');
19
19
 
@@ -49,10 +49,14 @@ const optimization = (options) => {
49
49
  chunks: "initial",
50
50
  test(module) {
51
51
  var _a;
52
- return Boolean((_a = module == null ? void 0 : module.resource) == null ? void 0 : _a.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/));
52
+ return Boolean(
53
+ (_a = module == null ? void 0 : module.resource) == null ? void 0 : _a.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)
54
+ );
53
55
  },
54
56
  name(module) {
55
- const packageName = module.resource.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
57
+ const packageName = module.resource.match(
58
+ /[\\/]node_modules[\\/](.*?)([\\/]|$)/
59
+ )[1];
56
60
  return packageName.replace("@", "");
57
61
  },
58
62
  filename: isDev ? "module-[name].js" : "static/module-[name].[chunkhash:8].js",
@@ -185,11 +189,13 @@ const transforms = (options) => {
185
189
  if (isDev) {
186
190
  plugins.push(new webpack__default["default"].HotModuleReplacementPlugin());
187
191
  } else {
188
- plugins.push(new MiniCssExtractPlugin__default["default"]({
189
- filename: "static/[name].[contenthash:8].css",
190
- chunkFilename: "static/[name].[id].[contenthash:8].css",
191
- insert: insertBeforeJssStyles
192
- }));
192
+ plugins.push(
193
+ new MiniCssExtractPlugin__default["default"]({
194
+ filename: "static/[name].[contenthash:8].css",
195
+ chunkFilename: "static/[name].[id].[contenthash:8].css",
196
+ insert: insertBeforeJssStyles
197
+ })
198
+ );
193
199
  }
194
200
  return { loaders, plugins };
195
201
  };
@@ -200,24 +206,38 @@ class LinkedPackageResolvePlugin {
200
206
  this.packages = packages;
201
207
  }
202
208
  apply(resolver) {
203
- resolver.hooks.resolve.tapAsync("LinkedPackageResolvePlugin", (data, context, callback) => {
204
- var _a;
205
- const pkg = this.packages.find((pkge) => data.path && cliCommon.isChildPath(pkge.dir, data.path));
206
- if (!pkg) {
207
- callback();
208
- return;
209
+ resolver.hooks.resolve.tapAsync(
210
+ "LinkedPackageResolvePlugin",
211
+ (data, context, callback) => {
212
+ var _a;
213
+ const pkg = this.packages.find(
214
+ (pkge) => data.path && cliCommon.isChildPath(pkge.dir, data.path)
215
+ );
216
+ if (!pkg) {
217
+ callback();
218
+ return;
219
+ }
220
+ const modulesLocation = path.resolve(
221
+ this.targetModules,
222
+ pkg.packageJson.name
223
+ );
224
+ const newContext = ((_a = data.context) == null ? void 0 : _a.issuer) ? {
225
+ ...data.context,
226
+ issuer: data.context.issuer.replace(pkg.dir, modulesLocation)
227
+ } : data.context;
228
+ resolver.doResolve(
229
+ resolver.hooks.resolve,
230
+ {
231
+ ...data,
232
+ context: newContext,
233
+ path: data.path && data.path.replace(pkg.dir, modulesLocation)
234
+ },
235
+ `resolve ${data.request} in ${modulesLocation}`,
236
+ context,
237
+ callback
238
+ );
209
239
  }
210
- const modulesLocation = path.resolve(this.targetModules, pkg.packageJson.name);
211
- const newContext = ((_a = data.context) == null ? void 0 : _a.issuer) ? {
212
- ...data.context,
213
- issuer: data.context.issuer.replace(pkg.dir, modulesLocation)
214
- } : data.context;
215
- resolver.doResolve(resolver.hooks.resolve, {
216
- ...data,
217
- context: newContext,
218
- path: data.path && data.path.replace(pkg.dir, modulesLocation)
219
- }, `resolve ${data.request} in ${modulesLocation}`, context, callback);
220
- });
240
+ );
221
241
  }
222
242
  }
223
243
 
@@ -243,7 +263,9 @@ async function readBuildInfo() {
243
263
  } catch (error) {
244
264
  console.warn(`WARNING: Failed to describe git version, ${error}`);
245
265
  }
246
- const { version: packageVersion } = await fs__default["default"].readJson(index.paths.resolveTarget("package.json"));
266
+ const { version: packageVersion } = await fs__default["default"].readJson(
267
+ index.paths.resolveTarget("package.json")
268
+ );
247
269
  return {
248
270
  cliVersion: index.version,
249
271
  gitVersion,
@@ -261,31 +283,42 @@ async function createConfig(paths, options) {
261
283
  const validBaseUrl = new URL(baseUrl);
262
284
  const publicPath = validBaseUrl.pathname.replace(/\/$/, "");
263
285
  if (checksEnabled) {
264
- plugins.push(new ForkTsCheckerWebpackPlugin__default["default"]({
265
- typescript: { configFile: paths.targetTsConfig, memoryLimit: 4096 }
266
- }), new ESLintPlugin__default["default"]({
267
- context: paths.targetPath,
268
- files: ["**", "!**/__tests__/**", "!**/?(*.)(spec|test).*"]
269
- }));
286
+ plugins.push(
287
+ new ForkTsCheckerWebpackPlugin__default["default"]({
288
+ typescript: { configFile: paths.targetTsConfig, memoryLimit: 4096 }
289
+ }),
290
+ new ESLintPlugin__default["default"]({
291
+ context: paths.targetPath,
292
+ files: ["**", "!**/__tests__/**", "!**/?(*.)(spec|test).*"]
293
+ })
294
+ );
270
295
  }
271
- plugins.push(new webpack.ProvidePlugin({
272
- process: "process/browser",
273
- Buffer: ["buffer", "Buffer"]
274
- }));
275
- plugins.push(new webpack__default["default"].EnvironmentPlugin({
276
- APP_CONFIG: options.frontendAppConfigs
277
- }));
278
- plugins.push(new HtmlWebpackPlugin__default["default"]({
279
- template: paths.targetHtml,
280
- templateParameters: {
281
- publicPath,
282
- config: frontendConfig
283
- }
284
- }));
296
+ plugins.push(
297
+ new webpack.ProvidePlugin({
298
+ process: "process/browser",
299
+ Buffer: ["buffer", "Buffer"]
300
+ })
301
+ );
302
+ plugins.push(
303
+ new webpack__default["default"].EnvironmentPlugin({
304
+ APP_CONFIG: options.frontendAppConfigs
305
+ })
306
+ );
307
+ plugins.push(
308
+ new HtmlWebpackPlugin__default["default"]({
309
+ template: paths.targetHtml,
310
+ templateParameters: {
311
+ publicPath,
312
+ config: frontendConfig
313
+ }
314
+ })
315
+ );
285
316
  const buildInfo = await readBuildInfo();
286
- plugins.push(new webpack__default["default"].DefinePlugin({
287
- "process.env.BUILD_INFO": JSON.stringify(buildInfo)
288
- }));
317
+ plugins.push(
318
+ new webpack__default["default"].DefinePlugin({
319
+ "process.env.BUILD_INFO": JSON.stringify(buildInfo)
320
+ })
321
+ );
289
322
  const resolveAliases = {};
290
323
  try {
291
324
  const { version: reactDomVersion } = require("react-dom/package.json");
@@ -309,7 +342,7 @@ async function createConfig(paths, options) {
309
342
  context: paths.targetPath,
310
343
  entry: [require.resolve("react-hot-loader/patch"), paths.targetEntry],
311
344
  resolve: {
312
- extensions: [".ts", ".tsx", ".mjs", ".js", ".jsx"],
345
+ extensions: [".ts", ".tsx", ".mjs", ".js", ".jsx", ".json", ".wasm"],
313
346
  mainFields: ["browser", "module", "main"],
314
347
  fallback: {
315
348
  ...pickBy__default["default"](require("node-libs-browser")),
@@ -328,7 +361,10 @@ async function createConfig(paths, options) {
328
361
  },
329
362
  plugins: [
330
363
  new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
331
- new ModuleScopePlugin__default["default"]([paths.targetSrc, paths.targetDev], [paths.targetPackageJson])
364
+ new ModuleScopePlugin__default["default"](
365
+ [paths.targetSrc, paths.targetDev],
366
+ [paths.targetPackageJson]
367
+ )
332
368
  ],
333
369
  alias: resolveAliases
334
370
  },
@@ -341,7 +377,10 @@ async function createConfig(paths, options) {
341
377
  filename: isDev ? "[name].js" : "static/[name].[fullhash:8].js",
342
378
  chunkFilename: isDev ? "[name].chunk.js" : "static/[name].[chunkhash:8].chunk.js",
343
379
  ...isDev ? {
344
- devtoolModuleFilenameTemplate: (info) => `file:///${path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")}`
380
+ devtoolModuleFilenameTemplate: (info) => `file:///${path.resolve(info.absoluteResourcePath).replace(
381
+ /\\/g,
382
+ "/"
383
+ )}`
345
384
  } : {}
346
385
  },
347
386
  plugins
@@ -393,12 +432,15 @@ async function createBackendConfig(paths, options) {
393
432
  paths.targetRunFile ? paths.targetRunFile : paths.targetEntry
394
433
  ],
395
434
  resolve: {
396
- extensions: [".ts", ".tsx", ".mjs", ".js", ".jsx"],
435
+ extensions: [".ts", ".tsx", ".mjs", ".js", ".jsx", ".json"],
397
436
  mainFields: ["main"],
398
437
  modules: [paths.rootNodeModules, ...moduleDirs],
399
438
  plugins: [
400
439
  new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
401
- new ModuleScopePlugin__default["default"]([paths.targetSrc, paths.targetDev], [paths.targetPackageJson])
440
+ new ModuleScopePlugin__default["default"](
441
+ [paths.targetSrc, paths.targetDev],
442
+ [paths.targetPackageJson]
443
+ )
402
444
  ],
403
445
  alias: {
404
446
  "react-dom": "@hot-loader/react-dom"
@@ -412,7 +454,10 @@ async function createBackendConfig(paths, options) {
412
454
  filename: isDev ? "[name].js" : "[name].[hash:8].js",
413
455
  chunkFilename: isDev ? "[name].chunk.js" : "[name].[chunkhash:8].chunk.js",
414
456
  ...isDev ? {
415
- devtoolModuleFilenameTemplate: (info) => `file:///${path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")}`
457
+ devtoolModuleFilenameTemplate: (info) => `file:///${path.resolve(info.absoluteResourcePath).replace(
458
+ /\\/g,
459
+ "/"
460
+ )}`
416
461
  } : {}
417
462
  },
418
463
  plugins: [
@@ -494,4 +539,4 @@ exports.createBackendConfig = createBackendConfig;
494
539
  exports.createConfig = createConfig;
495
540
  exports.resolveBaseUrl = resolveBaseUrl;
496
541
  exports.resolveBundlingPaths = resolveBundlingPaths;
497
- //# sourceMappingURL=paths-d98c9d0c.cjs.js.map
542
+ //# sourceMappingURL=paths-13d8625f.cjs.js.map
@@ -2,9 +2,9 @@
2
2
 
3
3
  var yaml = require('yaml');
4
4
  var config$1 = require('@backstage/config');
5
- var config = require('./config-de1bf46a.cjs.js');
5
+ var config = require('./config-9d64a562.cjs.js');
6
6
  require('@backstage/config-loader');
7
- require('./index-7e13cc9d.cjs.js');
7
+ require('./index-b7ce30d9.cjs.js');
8
8
  require('commander');
9
9
  require('chalk');
10
10
  require('fs-extra');
@@ -12,7 +12,7 @@ require('semver');
12
12
  require('@backstage/cli-common');
13
13
  require('@backstage/errors');
14
14
  require('@manypkg/get-packages');
15
- require('./PackageGraph-1d7b086a.cjs.js');
15
+ require('./PackageGraph-7ea22294.cjs.js');
16
16
  require('path');
17
17
  require('child_process');
18
18
  require('util');
@@ -61,4 +61,4 @@ function serializeConfigData(appConfigs, schema, visibility) {
61
61
  }
62
62
 
63
63
  exports["default"] = print;
64
- //# sourceMappingURL=print-4cbe70e7.cjs.js.map
64
+ //# sourceMappingURL=print-58fe18ba.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var child_process = require('child_process');
4
- var index = require('./index-7e13cc9d.cjs.js');
4
+ var index = require('./index-b7ce30d9.cjs.js');
5
5
  var util = require('util');
6
6
  var errors = require('@backstage/errors');
7
7
 
@@ -78,4 +78,4 @@ async function waitForExit(child, name) {
78
78
  exports.run = run;
79
79
  exports.runCheck = runCheck;
80
80
  exports.runPlain = runPlain;
81
- //# sourceMappingURL=run-5e05ba2c.cjs.js.map
81
+ //# sourceMappingURL=run-f4586ef6.cjs.js.map
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var yaml = require('yaml');
4
- var config = require('./config-de1bf46a.cjs.js');
4
+ var config = require('./config-9d64a562.cjs.js');
5
5
  var configLoader = require('@backstage/config-loader');
6
6
  require('@backstage/config');
7
- require('./index-7e13cc9d.cjs.js');
7
+ require('./index-b7ce30d9.cjs.js');
8
8
  require('commander');
9
9
  require('chalk');
10
10
  require('fs-extra');
@@ -12,7 +12,7 @@ require('semver');
12
12
  require('@backstage/cli-common');
13
13
  require('@backstage/errors');
14
14
  require('@manypkg/get-packages');
15
- require('./PackageGraph-1d7b086a.cjs.js');
15
+ require('./PackageGraph-7ea22294.cjs.js');
16
16
  require('path');
17
17
  require('child_process');
18
18
  require('util');
@@ -23,7 +23,11 @@ var schema = async (opts) => {
23
23
  fromPackage: opts.package,
24
24
  mockEnv: true
25
25
  });
26
- const merged = configLoader.mergeConfigSchemas(schema.serialize().schemas.map((_) => _.value));
26
+ const merged = configLoader.mergeConfigSchemas(
27
+ schema.serialize().schemas.map(
28
+ (_) => _.value
29
+ )
30
+ );
27
31
  merged.title = "Application Configuration Schema";
28
32
  merged.description = "This is the schema describing the structure of the app-config.yaml configuration file.";
29
33
  if (opts.format === "json") {
@@ -36,4 +40,4 @@ var schema = async (opts) => {
36
40
  };
37
41
 
38
42
  exports["default"] = schema;
39
- //# sourceMappingURL=schema-2c842cbe.cjs.js.map
43
+ //# sourceMappingURL=schema-65c31be1.cjs.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  var fs = require('fs-extra');
4
4
  var path = require('path');
5
- var index = require('./index-7e13cc9d.cjs.js');
5
+ var index = require('./index-b7ce30d9.cjs.js');
6
6
  var chalk = require('chalk');
7
7
  var handlebars = require('handlebars');
8
8
  var ora = require('ora');
@@ -83,7 +83,10 @@ async function addCodeownersEntry(ownedPath, ownerStr, codeownersFilePath) {
83
83
  ownedPath: "*",
84
84
  ownerIds: [DEFAULT_OWNER]
85
85
  });
86
- const longestOwnedPath = newDeclarationEntries.reduce((length, entry) => Math.max(length, entry.ownedPath.length), 0);
86
+ const longestOwnedPath = newDeclarationEntries.reduce(
87
+ (length, entry) => Math.max(length, entry.ownedPath.length),
88
+ 0
89
+ );
87
90
  const newDeclarationLines = newDeclarationEntries.map((entry) => {
88
91
  const entryPath = entry.ownedPath + " ".repeat(longestOwnedPath - entry.ownedPath.length);
89
92
  return [entryPath, ...entry.ownerIds].join(" ");
@@ -147,7 +150,9 @@ ${chalk__default["default"].red(message)}
147
150
  if (options == null ? void 0 : options.optional) {
148
151
  Task.error(`Warning: Failed to execute command ${chalk__default["default"].cyan(command)}`);
149
152
  } else {
150
- throw new Error(`Failed to execute command '${chalk__default["default"].cyan(command)}', ${error}`);
153
+ throw new Error(
154
+ `Failed to execute command '${chalk__default["default"].cyan(command)}', ${error}`
155
+ );
151
156
  }
152
157
  }
153
158
  }
@@ -167,15 +172,23 @@ async function templatingTask(templateDir, destinationDir, context, versionProvi
167
172
  const compiled = handlebars__default["default"].compile(template.toString(), {
168
173
  strict: true
169
174
  });
170
- const contents = compiled({ name: path.basename(destination), ...context }, {
171
- helpers: {
172
- versionQuery(name, versionHint) {
173
- return versionProvider(name, typeof versionHint === "string" ? versionHint : void 0);
175
+ const contents = compiled(
176
+ { name: path.basename(destination), ...context },
177
+ {
178
+ helpers: {
179
+ versionQuery(name, versionHint) {
180
+ return versionProvider(
181
+ name,
182
+ typeof versionHint === "string" ? versionHint : void 0
183
+ );
184
+ }
174
185
  }
175
186
  }
176
- });
187
+ );
177
188
  await fs__default["default"].writeFile(destination, contents).catch((error) => {
178
- throw new Error(`Failed to create file: ${destination}: ${error.message}`);
189
+ throw new Error(
190
+ `Failed to create file: ${destination}: ${error.message}`
191
+ );
179
192
  });
180
193
  });
181
194
  } else {
@@ -185,7 +198,9 @@ async function templatingTask(templateDir, destinationDir, context, versionProvi
185
198
  await Task.forItem("copying", path.basename(file), async () => {
186
199
  await fs__default["default"].copyFile(file, destinationFile).catch((error) => {
187
200
  const destination = destinationFile;
188
- throw new Error(`Failed to copy file to ${destination} : ${error.message}`);
201
+ throw new Error(
202
+ `Failed to copy file to ${destination} : ${error.message}`
203
+ );
189
204
  });
190
205
  });
191
206
  }
@@ -198,7 +213,9 @@ async function addPackageDependency(path, options) {
198
213
  if (Object.keys(obj).length === 0) {
199
214
  return void 0;
200
215
  }
201
- return Object.fromEntries(Object.keys(obj).sort().map((key) => [key, obj[key]]));
216
+ return Object.fromEntries(
217
+ Object.keys(obj).sort().map((key) => [key, obj[key]])
218
+ );
202
219
  };
203
220
  pkgJson.dependencies = normalize({
204
221
  ...pkgJson.dependencies,
@@ -224,4 +241,4 @@ exports.addPackageDependency = addPackageDependency;
224
241
  exports.getCodeownersFilePath = getCodeownersFilePath;
225
242
  exports.parseOwnerIds = parseOwnerIds;
226
243
  exports.templatingTask = templatingTask;
227
- //# sourceMappingURL=tasks-b054c9ce.cjs.js.map
244
+ //# sourceMappingURL=tasks-16da761b.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-7e13cc9d.cjs.js');
4
- var run = require('./run-5e05ba2c.cjs.js');
3
+ var index = require('./index-b7ce30d9.cjs.js');
4
+ var run = require('./run-f4586ef6.cjs.js');
5
5
  require('commander');
6
6
  require('chalk');
7
7
  require('fs-extra');
@@ -54,4 +54,4 @@ var test = async (_opts, cmd) => {
54
54
  };
55
55
 
56
56
  exports["default"] = test;
57
- //# sourceMappingURL=test-b5969f53.cjs.js.map
57
+ //# sourceMappingURL=test-464a46fe.cjs.js.map
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var config = require('./config-de1bf46a.cjs.js');
3
+ var config = require('./config-9d64a562.cjs.js');
4
4
  require('@backstage/config-loader');
5
5
  require('@backstage/config');
6
- require('./index-7e13cc9d.cjs.js');
6
+ require('./index-b7ce30d9.cjs.js');
7
7
  require('commander');
8
8
  require('chalk');
9
9
  require('fs-extra');
@@ -11,7 +11,7 @@ require('semver');
11
11
  require('@backstage/cli-common');
12
12
  require('@backstage/errors');
13
13
  require('@manypkg/get-packages');
14
- require('./PackageGraph-1d7b086a.cjs.js');
14
+ require('./PackageGraph-7ea22294.cjs.js');
15
15
  require('path');
16
16
  require('child_process');
17
17
  require('util');
@@ -27,4 +27,4 @@ var validate = async (opts) => {
27
27
  };
28
28
 
29
29
  exports["default"] = validate;
30
- //# sourceMappingURL=validate-8a03d402.cjs.js.map
30
+ //# sourceMappingURL=validate-3231ba7d.cjs.js.map
package/dist/index.cjs.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require('commander');
4
4
  require('chalk');
5
- require('./cjs/index-7e13cc9d.cjs.js');
5
+ require('./cjs/index-b7ce30d9.cjs.js');
6
6
  require('fs-extra');
7
7
  require('semver');
8
8
  require('@backstage/cli-common');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/cli",
3
3
  "description": "CLI for developing Backstage plugins and apps",
4
- "version": "0.18.0",
4
+ "version": "0.18.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -50,10 +50,10 @@
50
50
  "@spotify/eslint-config-typescript": "^14.0.0",
51
51
  "@sucrase/jest-plugin": "^2.1.1",
52
52
  "@sucrase/webpack-loader": "^2.0.0",
53
- "@svgr/plugin-jsx": "6.2.x",
54
- "@svgr/plugin-svgo": "6.2.x",
55
- "@svgr/rollup": "6.2.x",
56
- "@svgr/webpack": "6.2.x",
53
+ "@svgr/plugin-jsx": "6.3.x",
54
+ "@svgr/plugin-svgo": "6.3.x",
55
+ "@svgr/rollup": "6.3.x",
56
+ "@svgr/webpack": "6.3.x",
57
57
  "@types/webpack-env": "^1.15.2",
58
58
  "@typescript-eslint/eslint-plugin": "^5.9.0",
59
59
  "@typescript-eslint/parser": "^5.9.0",
@@ -126,13 +126,13 @@
126
126
  "zod": "^3.11.6"
127
127
  },
128
128
  "devDependencies": {
129
- "@backstage/backend-common": "^0.14.1",
129
+ "@backstage/backend-common": "^0.15.0",
130
130
  "@backstage/config": "^1.0.1",
131
- "@backstage/core-app-api": "^1.0.4",
132
- "@backstage/core-components": "^0.10.0",
133
- "@backstage/core-plugin-api": "^1.0.4",
134
- "@backstage/dev-utils": "^1.0.4",
135
- "@backstage/test-utils": "^1.1.2",
131
+ "@backstage/core-app-api": "^1.0.5",
132
+ "@backstage/core-components": "^0.11.0",
133
+ "@backstage/core-plugin-api": "^1.0.5",
134
+ "@backstage/dev-utils": "^1.0.5",
135
+ "@backstage/test-utils": "^1.1.3",
136
136
  "@backstage/theme": "^0.2.16",
137
137
  "@types/diff": "^5.0.0",
138
138
  "@types/express": "^4.17.6",
@@ -250,5 +250,5 @@
250
250
  }
251
251
  }
252
252
  },
253
- "gitHead": "999878d8f1ae30f6a15925816af2016cb9d717a1"
253
+ "gitHead": "a12f6269e3bf224aa7f52475be9152bc52addeed"
254
254
  }
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var path = require('path');
5
- var PackageGraph = require('./PackageGraph-1d7b086a.cjs.js');
6
- var run = require('./run-5e05ba2c.cjs.js');
7
- require('@manypkg/get-packages');
8
- require('./index-7e13cc9d.cjs.js');
9
- require('commander');
10
- require('chalk');
11
- require('semver');
12
- require('@backstage/cli-common');
13
- require('@backstage/errors');
14
- require('child_process');
15
- require('util');
16
-
17
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
-
19
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
20
-
21
- const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
22
- async function command() {
23
- const packages = await PackageGraph.PackageGraph.listTargetPackages();
24
- const oldConfigs = [
25
- require.resolve("@backstage/cli/config/eslint.js"),
26
- require.resolve("@backstage/cli/config/eslint.backend.js")
27
- ];
28
- const configPaths = new Array();
29
- await Promise.all(packages.map(async ({ dir, packageJson }) => {
30
- var _a;
31
- const configPath = path.resolve(dir, ".eslintrc.js");
32
- if (!await fs__default["default"].pathExists(configPath)) {
33
- console.log(`Skipping ${packageJson.name}, missing .eslintrc.js`);
34
- return;
35
- }
36
- let existingConfig;
37
- try {
38
- existingConfig = require(configPath);
39
- } catch (error) {
40
- console.log(`Skipping ${packageJson.name}, failed to load .eslintrc.js, ${error}`);
41
- return;
42
- }
43
- const extendsArray = (_a = existingConfig.extends) != null ? _a : [];
44
- const extendIndex = extendsArray.findIndex((p) => oldConfigs.includes(p));
45
- if (extendIndex === -1) {
46
- console.log(`Skipping ${packageJson.name}, .eslintrc.js does not extend the legacy config`);
47
- return;
48
- }
49
- extendsArray.splice(extendIndex, 1);
50
- if (extendsArray.length === 0) {
51
- delete existingConfig.extends;
52
- }
53
- if (Object.keys(existingConfig).length > 0) {
54
- await fs__default["default"].writeFile(configPath, `${PREFIX}(__dirname, ${JSON.stringify(existingConfig, null, 2)});
55
- `);
56
- } else {
57
- await fs__default["default"].writeFile(configPath, `${PREFIX}(__dirname);
58
- `);
59
- }
60
- configPaths.push(configPath);
61
- }));
62
- let hasPrettier = false;
63
- try {
64
- require.resolve("prettier");
65
- hasPrettier = true;
66
- } catch {
67
- }
68
- if (hasPrettier) {
69
- await run.runPlain("prettier", "--write", ...configPaths);
70
- }
71
- }
72
-
73
- exports.command = command;
74
- //# sourceMappingURL=packageLintConfigs-77b71b79.cjs.js.map
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var path = require('path');
5
- var getPackages = require('@manypkg/get-packages');
6
- var index = require('./index-7e13cc9d.cjs.js');
7
- var packageRoles = require('./packageRoles-a310f84c.cjs.js');
8
- require('commander');
9
- require('chalk');
10
- require('semver');
11
- require('@backstage/cli-common');
12
- require('@backstage/errors');
13
- require('zod');
14
-
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
-
17
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
18
-
19
- var packageRole = async () => {
20
- const { packages } = await getPackages.getPackages(index.paths.targetDir);
21
- await Promise.all(packages.map(async ({ dir, packageJson: pkg }) => {
22
- const { name } = pkg;
23
- const existingRole = packageRoles.getRoleFromPackage(pkg);
24
- if (existingRole) {
25
- return;
26
- }
27
- const detectedRole = packageRoles.detectRoleFromPackage(pkg);
28
- if (!detectedRole) {
29
- console.error(`No role detected for package ${name}`);
30
- return;
31
- }
32
- console.log(`Detected package role of ${name} as ${detectedRole}`);
33
- let newPkg = pkg;
34
- const pkgKeys = Object.keys(pkg);
35
- if (pkgKeys.includes("backstage")) {
36
- newPkg.backstage = {
37
- ...newPkg.backstage,
38
- role: detectedRole
39
- };
40
- } else {
41
- const index = Math.max(pkgKeys.indexOf("version"), pkgKeys.indexOf("private"), pkgKeys.indexOf("publishConfig")) + 1 || pkgKeys.length;
42
- const pkgEntries = Object.entries(pkg);
43
- pkgEntries.splice(index, 0, ["backstage", { role: detectedRole }]);
44
- newPkg = Object.fromEntries(pkgEntries);
45
- }
46
- await fs__default["default"].writeJson(path.resolve(dir, "package.json"), newPkg, {
47
- spaces: 2
48
- });
49
- }));
50
- };
51
-
52
- exports["default"] = packageRole;
53
- //# sourceMappingURL=packageRole-d1e7c7d6.cjs.js.map