@backstage/cli 0.0.0-nightly-202182222128 → 0.0.0-nightly-202182622037

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 (38) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/dist/cjs/{lint-a04ad0c9.cjs.js → Lockfile-80f0eec4.cjs.js} +1 -65
  3. package/dist/cjs/{build-8ff700d9.cjs.js → build-469caaac.cjs.js} +6 -5
  4. package/dist/cjs/{build-b1687478.cjs.js → build-87f92a6c.cjs.js} +4 -3
  5. package/dist/cjs/{build-b64bd9d1.cjs.js → build-8c8fc2b9.cjs.js} +4 -3
  6. package/dist/cjs/{build-207e0e14.cjs.js → build-e2c9e9a7.cjs.js} +4 -3
  7. package/dist/cjs/{buildImage-499c6040.cjs.js → buildImage-3e12ca8f.cjs.js} +5 -4
  8. package/dist/cjs/{buildWorkspace-c2982f76.cjs.js → buildWorkspace-83214a95.cjs.js} +5 -4
  9. package/dist/cjs/{bump-95c0a841.cjs.js → bump-e0a6cf05.cjs.js} +7 -6
  10. package/dist/cjs/{bundle-12b58961.cjs.js → bundle-23f9f94d.cjs.js} +6 -5
  11. package/dist/cjs/{clean-19a871a4.cjs.js → clean-39612213.cjs.js} +3 -2
  12. package/dist/cjs/{config-28e42b9e.cjs.js → config-90b3ea39.cjs.js} +2 -2
  13. package/dist/cjs/{createPlugin-1fd4b486.cjs.js → createPlugin-f20d7f4e.cjs.js} +14 -4
  14. package/dist/cjs/{dev-8a34f2b0.cjs.js → dev-26b0d0ee.cjs.js} +5 -4
  15. package/dist/cjs/{diff-13756f9e.cjs.js → diff-20b1ec49.cjs.js} +6 -7
  16. package/dist/cjs/{docs-9150c87f.cjs.js → docs-5137c9f9.cjs.js} +4 -3
  17. package/dist/cjs/{index-4c8e4312.cjs.js → index-1adee07b.cjs.js} +60 -31
  18. package/dist/cjs/{index-fbc48d0c.cjs.js → index-71361099.cjs.js} +3 -2
  19. package/dist/cjs/{index-18d4fc40.cjs.js → index-b352eec0.cjs.js} +3 -3
  20. package/dist/cjs/lint-b0918343.cjs.js +76 -0
  21. package/dist/cjs/{lint-d4a182a6.cjs.js → lint-d7ce67ae.cjs.js} +4 -3
  22. package/dist/cjs/{pack-002e0d18.cjs.js → pack-b7d41635.cjs.js} +3 -2
  23. package/dist/cjs/{packager-48e2ffad.cjs.js → packager-dca4411a.cjs.js} +2 -2
  24. package/dist/cjs/{paths-90c07c2d.cjs.js → paths-3d580aef.cjs.js} +3 -3
  25. package/dist/cjs/{print-079ef43a.cjs.js → print-d06a0a0e.cjs.js} +4 -3
  26. package/dist/cjs/{removePlugin-13199b61.cjs.js → removePlugin-eb156ee2.cjs.js} +4 -3
  27. package/dist/cjs/{run-9dbe70e9.cjs.js → run-51c0c9a1.cjs.js} +2 -2
  28. package/dist/cjs/{schema-2bf6bfc2.cjs.js → schema-3867dda3.cjs.js} +4 -3
  29. package/dist/cjs/{serve-31f9b4d5.cjs.js → serve-3b88ab87.cjs.js} +10 -9
  30. package/dist/cjs/{serve-d38dbc03.cjs.js → serve-a365d3ec.cjs.js} +7 -6
  31. package/dist/cjs/{server-8c07098b.cjs.js → server-f4d04d41.cjs.js} +2 -2
  32. package/dist/cjs/{tasks-e05ab474.cjs.js → tasks-bab2ff89.cjs.js} +5 -8
  33. package/dist/cjs/{testCommand-5342acbc.cjs.js → testCommand-2117c366.cjs.js} +4 -3
  34. package/dist/cjs/{validate-39bddb12.cjs.js → validate-13940d59.cjs.js} +4 -3
  35. package/dist/index.cjs.js +2 -1
  36. package/package.json +7 -7
  37. package/templates/default-backend-plugin/package.json.hbs +12 -12
  38. package/templates/default-plugin/package.json.hbs +20 -20
@@ -3,6 +3,7 @@
3
3
  var program = require('commander');
4
4
  var chalk = require('chalk');
5
5
  var fs = require('fs-extra');
6
+ var semver = require('semver');
6
7
  var cliCommon = require('@backstage/cli-common');
7
8
  var package_json = require('@backstage/config/package.json');
8
9
 
@@ -11,6 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
12
  var program__default = /*#__PURE__*/_interopDefaultLegacy(program);
12
13
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
13
14
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
15
+ var semver__default = /*#__PURE__*/_interopDefaultLegacy(semver);
14
16
 
15
17
  class CustomError extends Error {
16
18
  get name() {
@@ -47,17 +49,17 @@ class NotFoundError extends CustomError {
47
49
 
48
50
  const paths = cliCommon.findPaths(__dirname);
49
51
 
50
- var version$8 = "0.9.3";
52
+ var version$8 = "0.9.4";
51
53
 
52
- var version$7 = "0.7.12";
54
+ var version$7 = "0.7.13";
53
55
 
54
- var version$6 = "0.1.13";
56
+ var version$6 = "0.1.14";
55
57
 
56
- var version$5 = "0.4.2";
58
+ var version$5 = "0.5.0";
57
59
 
58
60
  var version$4 = "0.1.8";
59
61
 
60
- var version$3 = "0.2.9";
62
+ var version$3 = "0.2.10";
61
63
 
62
64
  var version$2 = "0.1.17";
63
65
 
@@ -80,6 +82,32 @@ function findVersion() {
80
82
  }
81
83
  const version = findVersion();
82
84
  fs__default['default'].pathExistsSync(paths.resolveOwn("src"));
85
+ function createPackageVersionProvider(lockfile) {
86
+ return (name, versionHint) => {
87
+ var _a;
88
+ const packageVersion = packageVersions[name];
89
+ const targetVersion = versionHint || packageVersion;
90
+ if (!targetVersion) {
91
+ throw new Error(`No version available for package ${name}`);
92
+ }
93
+ const lockfileEntries = lockfile == null ? void 0 : lockfile.get(name);
94
+ if (name.startsWith("@types/") && (lockfileEntries == null ? void 0 : lockfileEntries.some((entry) => entry.range === "*"))) {
95
+ return "*";
96
+ }
97
+ const validRanges = lockfileEntries == null ? void 0 : lockfileEntries.filter((entry) => semver__default['default'].satisfies(targetVersion, entry.range));
98
+ const highestRange = validRanges == null ? void 0 : validRanges.slice(-1)[0];
99
+ if (highestRange == null ? void 0 : highestRange.range) {
100
+ return highestRange == null ? void 0 : highestRange.range;
101
+ }
102
+ if (packageVersion) {
103
+ return `^${packageVersion}`;
104
+ }
105
+ if ((_a = semver__default['default'].parse(versionHint)) == null ? void 0 : _a.prerelease.length) {
106
+ return versionHint;
107
+ }
108
+ return `^${versionHint}`;
109
+ };
110
+ }
83
111
 
84
112
  function registerCommands(program) {
85
113
  const configOption = [
@@ -88,31 +116,31 @@ function registerCommands(program) {
88
116
  (opt, opts) => [...opts, opt],
89
117
  Array()
90
118
  ];
91
- 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-8ff700d9.cjs.js'); }).then((m) => m.default)));
92
- 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-31f9b4d5.cjs.js'); }).then((m) => m.default)));
93
- program.command("backend:build").description("Build a backend plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-b1687478.cjs.js'); }).then((m) => m.default)));
94
- 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-12b58961.cjs.js'); }).then((m) => m.default)));
95
- 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-499c6040.cjs.js'); }).then((m) => m.default)));
96
- 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(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./dev-8a34f2b0.cjs.js'); }).then((m) => m.default)));
97
- 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-1fd4b486.cjs.js'); }).then((m) => m.default)));
98
- program.command("remove-plugin").description("Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-13199b61.cjs.js'); }).then((m) => m.default)));
99
- program.command("plugin:build").description("Build a plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-b64bd9d1.cjs.js'); }).then((m) => m.default)));
100
- 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-d38dbc03.cjs.js'); }).then((m) => m.default)));
101
- 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-13756f9e.cjs.js'); }).then((m) => m.default)));
102
- 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-207e0e14.cjs.js'); }).then((m) => m.default)));
103
- 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-d4a182a6.cjs.js'); }).then((m) => m.default)));
104
- 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-5342acbc.cjs.js'); }).then((m) => m.default)));
105
- 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-9150c87f.cjs.js'); }).then((m) => m.default)));
106
- 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-079ef43a.cjs.js'); }).then((m) => m.default)));
107
- 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(...configOption).description("Validate that the given configuration loads and matches schema").action(lazy(() => Promise.resolve().then(function () { return require('./validate-39bddb12.cjs.js'); }).then((m) => m.default)));
108
- 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-2bf6bfc2.cjs.js'); }).then((m) => m.default)));
109
- program.command("versions:bump").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-95c0a841.cjs.js'); }).then((m) => m.default)));
110
- 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-a04ad0c9.cjs.js'); }).then(function (n) { return n.lint; }).then((m) => m.default)));
111
- program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-002e0d18.cjs.js'); }).then((m) => m.pre)));
112
- program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-002e0d18.cjs.js'); }).then((m) => m.post)));
113
- program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-19a871a4.cjs.js'); }).then((m) => m.default)));
114
- 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-c2982f76.cjs.js'); }).then((m) => m.default)));
115
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-fbc48d0c.cjs.js'); }).then((m) => m.default)));
119
+ 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-469caaac.cjs.js'); }).then((m) => m.default)));
120
+ 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-3b88ab87.cjs.js'); }).then((m) => m.default)));
121
+ program.command("backend:build").description("Build a backend plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-87f92a6c.cjs.js'); }).then((m) => m.default)));
122
+ 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-23f9f94d.cjs.js'); }).then((m) => m.default)));
123
+ 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-3e12ca8f.cjs.js'); }).then((m) => m.default)));
124
+ 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(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./dev-26b0d0ee.cjs.js'); }).then((m) => m.default)));
125
+ 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-f20d7f4e.cjs.js'); }).then((m) => m.default)));
126
+ program.command("remove-plugin").description("Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-eb156ee2.cjs.js'); }).then((m) => m.default)));
127
+ program.command("plugin:build").description("Build a plugin").action(lazy(() => Promise.resolve().then(function () { return require('./build-8c8fc2b9.cjs.js'); }).then((m) => m.default)));
128
+ 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-a365d3ec.cjs.js'); }).then((m) => m.default)));
129
+ 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-20b1ec49.cjs.js'); }).then((m) => m.default)));
130
+ 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-e2c9e9a7.cjs.js'); }).then((m) => m.default)));
131
+ 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-d7ce67ae.cjs.js'); }).then((m) => m.default)));
132
+ 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-2117c366.cjs.js'); }).then((m) => m.default)));
133
+ 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-5137c9f9.cjs.js'); }).then((m) => m.default)));
134
+ 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-d06a0a0e.cjs.js'); }).then((m) => m.default)));
135
+ 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(...configOption).description("Validate that the given configuration loads and matches schema").action(lazy(() => Promise.resolve().then(function () { return require('./validate-13940d59.cjs.js'); }).then((m) => m.default)));
136
+ 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-3867dda3.cjs.js'); }).then((m) => m.default)));
137
+ program.command("versions:bump").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-e0a6cf05.cjs.js'); }).then((m) => m.default)));
138
+ 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-b0918343.cjs.js'); }).then((m) => m.default)));
139
+ program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-b7d41635.cjs.js'); }).then((m) => m.pre)));
140
+ program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-b7d41635.cjs.js'); }).then((m) => m.post)));
141
+ program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-39612213.cjs.js'); }).then((m) => m.default)));
142
+ 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-83214a95.cjs.js'); }).then((m) => m.default)));
143
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-71361099.cjs.js'); }).then((m) => m.default)));
116
144
  }
117
145
  function lazy(getActionFunc) {
118
146
  return async (...args) => {
@@ -149,7 +177,8 @@ main(process.argv);
149
177
 
150
178
  exports.ExitCodeError = ExitCodeError;
151
179
  exports.NotFoundError = NotFoundError;
180
+ exports.createPackageVersionProvider = createPackageVersionProvider;
152
181
  exports.packageVersions = packageVersions;
153
182
  exports.paths = paths;
154
183
  exports.version = version;
155
- //# sourceMappingURL=index-4c8e4312.cjs.js.map
184
+ //# sourceMappingURL=index-1adee07b.cjs.js.map
@@ -3,12 +3,13 @@
3
3
  var fs = require('fs-extra');
4
4
  var chalk = require('chalk');
5
5
  var yaml = require('yaml');
6
- var index$1 = require('./index-4c8e4312.cjs.js');
6
+ var index$1 = require('./index-1adee07b.cjs.js');
7
7
  var crypto = require('crypto');
8
8
  var openBrowser = require('react-dev-utils/openBrowser');
9
9
  var request = require('@octokit/request');
10
10
  var express = require('express');
11
11
  require('commander');
12
+ require('semver');
12
13
  require('@backstage/cli-common');
13
14
  require('@backstage/config/package.json');
14
15
 
@@ -126,4 +127,4 @@ ${yaml.stringify(config)}`;
126
127
  };
127
128
 
128
129
  exports.default = index;
129
- //# sourceMappingURL=index-fbc48d0c.cjs.js.map
130
+ //# sourceMappingURL=index-71361099.cjs.js.map
@@ -4,8 +4,8 @@ var fs = require('fs-extra');
4
4
  var path = require('path');
5
5
  var os = require('os');
6
6
  var tar = require('tar');
7
- var index = require('./index-4c8e4312.cjs.js');
8
- var run = require('./run-9dbe70e9.cjs.js');
7
+ var index = require('./index-1adee07b.cjs.js');
8
+ var run = require('./run-51c0c9a1.cjs.js');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
11
 
@@ -118,4 +118,4 @@ async function findTargetPackages(pkgNames) {
118
118
  }
119
119
 
120
120
  exports.createDistWorkspace = createDistWorkspace;
121
- //# sourceMappingURL=index-18d4fc40.cjs.js.map
121
+ //# sourceMappingURL=index-b352eec0.cjs.js.map
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ var Lockfile = require('./Lockfile-80f0eec4.cjs.js');
4
+ require('./run-51c0c9a1.cjs.js');
5
+ require('chalk');
6
+ var index = require('./index-1adee07b.cjs.js');
7
+ var partition = require('lodash/partition');
8
+ require('fs-extra');
9
+ require('semver');
10
+ require('@yarnpkg/lockfile');
11
+ require('child_process');
12
+ require('util');
13
+ require('commander');
14
+ require('@backstage/cli-common');
15
+ require('@backstage/config/package.json');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var partition__default = /*#__PURE__*/_interopDefaultLegacy(partition);
20
+
21
+ const INCLUDED = [/^@backstage\//];
22
+ const includedFilter = (name) => INCLUDED.some((pattern) => pattern.test(name));
23
+ const FORBID_DUPLICATES = [
24
+ /^@backstage\/core-app-api$/,
25
+ /^@backstage\/plugin-/
26
+ ];
27
+ const ALLOW_DUPLICATES = [
28
+ /^@backstage\/core-plugin-api$/,
29
+ /^@backstage\/plugin-catalog-react$/
30
+ ];
31
+ const forbiddenDuplicatesFilter = (name) => FORBID_DUPLICATES.some((pattern) => pattern.test(name)) && !ALLOW_DUPLICATES.some((pattern) => pattern.test(name));
32
+ var lint = async (cmd) => {
33
+ const fix = Boolean(cmd.fix);
34
+ let success = true;
35
+ const lockfile = await Lockfile.Lockfile.load(index.paths.resolveTargetRoot("yarn.lock"));
36
+ const result = lockfile.analyze({
37
+ filter: includedFilter
38
+ });
39
+ logArray(result.invalidRanges, "The following packages versions are invalid and can't be analyzed:", (e) => ` ${e.name} @ ${e.range}`);
40
+ if (fix) {
41
+ lockfile.replaceVersions(result.newVersions);
42
+ await lockfile.save();
43
+ } else {
44
+ const [newVersionsForbidden, newVersionsAllowed] = partition__default['default'](result.newVersions, ({name}) => forbiddenDuplicatesFilter(name));
45
+ if (newVersionsForbidden.length && !fix) {
46
+ success = false;
47
+ }
48
+ 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}`);
49
+ 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}`);
50
+ }
51
+ const [newRangesForbidden, newRangesAllowed] = partition__default['default'](result.newRanges, ({name}) => forbiddenDuplicatesFilter(name));
52
+ if (newRangesForbidden.length) {
53
+ success = false;
54
+ }
55
+ logArray(newRangesForbidden, "The following packages must be deduplicated by updating dependencies in package.json", (e) => ` ${e.name} @ ${e.oldRange} should be changed to ${e.newRange}`);
56
+ logArray(newRangesAllowed, "The following packages can be deduplicated by updating dependencies in package.json", (e) => ` ${e.name} @ ${e.oldRange} should be changed to ${e.newRange}`);
57
+ if (!success) {
58
+ throw new Error("Failed versioning check");
59
+ }
60
+ };
61
+ function logArray(arr, header, each) {
62
+ if (arr.length === 0) {
63
+ return;
64
+ }
65
+ console.log(header);
66
+ console.log();
67
+ for (const e of arr) {
68
+ console.log(each(e));
69
+ }
70
+ console.log();
71
+ }
72
+
73
+ exports.default = lint;
74
+ exports.forbiddenDuplicatesFilter = forbiddenDuplicatesFilter;
75
+ exports.includedFilter = includedFilter;
76
+ //# sourceMappingURL=lint-b0918343.cjs.js.map
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var run = require('./run-9dbe70e9.cjs.js');
4
- var index = require('./index-4c8e4312.cjs.js');
3
+ var run = require('./run-51c0c9a1.cjs.js');
4
+ var index = require('./index-1adee07b.cjs.js');
5
5
  require('child_process');
6
6
  require('util');
7
7
  require('commander');
8
8
  require('chalk');
9
9
  require('fs-extra');
10
+ require('semver');
10
11
  require('@backstage/cli-common');
11
12
  require('@backstage/config/package.json');
12
13
 
@@ -24,4 +25,4 @@ var lint = async (cmd, cmdArgs) => {
24
25
  };
25
26
 
26
27
  exports.default = lint;
27
- //# sourceMappingURL=lint-d4a182a6.cjs.js.map
28
+ //# sourceMappingURL=lint-d7ce67ae.cjs.js.map
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs-extra');
4
- var index = require('./index-4c8e4312.cjs.js');
4
+ var index = require('./index-1adee07b.cjs.js');
5
5
  require('commander');
6
6
  require('chalk');
7
+ require('semver');
7
8
  require('@backstage/cli-common');
8
9
  require('@backstage/config/package.json');
9
10
 
@@ -37,4 +38,4 @@ const post = async () => {
37
38
 
38
39
  exports.post = post;
39
40
  exports.pre = pre;
40
- //# sourceMappingURL=pack-002e0d18.cjs.js.map
41
+ //# sourceMappingURL=pack-b7d41635.cjs.js.map
@@ -4,7 +4,7 @@ var fs = require('fs-extra');
4
4
  var rollup = require('rollup');
5
5
  var chalk = require('chalk');
6
6
  var path = require('path');
7
- var index = require('./index-4c8e4312.cjs.js');
7
+ var index = require('./index-1adee07b.cjs.js');
8
8
  var peerDepsExternal = require('rollup-plugin-peer-deps-external');
9
9
  var commonjs = require('@rollup/plugin-commonjs');
10
10
  var resolve = require('@rollup/plugin-node-resolve');
@@ -254,4 +254,4 @@ const buildPackage = async (options) => {
254
254
  };
255
255
 
256
256
  exports.buildPackage = buildPackage;
257
- //# sourceMappingURL=packager-48e2ffad.cjs.js.map
257
+ //# sourceMappingURL=packager-dca4411a.cjs.js.map
@@ -13,8 +13,8 @@ var TerserPlugin = require('terser-webpack-plugin');
13
13
  var parallel = require('./parallel-a4714c72.cjs.js');
14
14
  var MiniCssExtractPlugin = require('mini-css-extract-plugin');
15
15
  var svgrTemplate = require('./svgrTemplate-2d0d15cf.cjs.js');
16
- var index = require('./index-4c8e4312.cjs.js');
17
- var run = require('./run-9dbe70e9.cjs.js');
16
+ var index = require('./index-1adee07b.cjs.js');
17
+ var run = require('./run-51c0c9a1.cjs.js');
18
18
  var pickBy = require('lodash/pickBy');
19
19
 
20
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -489,4 +489,4 @@ exports.createBackendConfig = createBackendConfig;
489
489
  exports.createConfig = createConfig;
490
490
  exports.resolveBaseUrl = resolveBaseUrl;
491
491
  exports.resolveBundlingPaths = resolveBundlingPaths;
492
- //# sourceMappingURL=paths-90c07c2d.cjs.js.map
492
+ //# sourceMappingURL=paths-3d580aef.cjs.js.map
@@ -2,12 +2,13 @@
2
2
 
3
3
  var yaml = require('yaml');
4
4
  var config$1 = require('@backstage/config');
5
- var config = require('./config-28e42b9e.cjs.js');
5
+ var config = require('./config-90b3ea39.cjs.js');
6
6
  require('@backstage/config-loader');
7
- require('./index-4c8e4312.cjs.js');
7
+ require('./index-1adee07b.cjs.js');
8
8
  require('commander');
9
9
  require('chalk');
10
10
  require('fs-extra');
11
+ require('semver');
11
12
  require('@backstage/cli-common');
12
13
  require('@backstage/config/package.json');
13
14
 
@@ -54,4 +55,4 @@ function serializeConfigData(appConfigs, schema, visibility) {
54
55
  }
55
56
 
56
57
  exports.default = print;
57
- //# sourceMappingURL=print-079ef43a.cjs.js.map
58
+ //# sourceMappingURL=print-d06a0a0e.cjs.js.map
@@ -4,12 +4,13 @@ var fs = require('fs-extra');
4
4
  var path = require('path');
5
5
  var chalk = require('chalk');
6
6
  var inquirer = require('inquirer');
7
- var tasks = require('./tasks-e05ab474.cjs.js');
8
- var index = require('./index-4c8e4312.cjs.js');
7
+ var tasks = require('./tasks-bab2ff89.cjs.js');
8
+ var index = require('./index-1adee07b.cjs.js');
9
9
  require('handlebars');
10
10
  require('ora');
11
11
  require('recursive-readdir');
12
12
  require('commander');
13
+ require('semver');
13
14
  require('@backstage/cli-common');
14
15
  require('@backstage/config/package.json');
15
16
 
@@ -160,4 +161,4 @@ exports.removePluginFromCodeOwners = removePluginFromCodeOwners;
160
161
  exports.removeReferencesFromAppPackage = removeReferencesFromAppPackage;
161
162
  exports.removeReferencesFromPluginsFile = removeReferencesFromPluginsFile;
162
163
  exports.removeSymLink = removeSymLink;
163
- //# sourceMappingURL=removePlugin-13199b61.cjs.js.map
164
+ //# sourceMappingURL=removePlugin-eb156ee2.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-4c8e4312.cjs.js');
4
+ var index = require('./index-1adee07b.cjs.js');
5
5
  var util = require('util');
6
6
 
7
7
  const execFile = util.promisify(child_process.execFile);
@@ -73,4 +73,4 @@ async function waitForExit(child, name) {
73
73
  exports.run = run;
74
74
  exports.runCheck = runCheck;
75
75
  exports.runPlain = runPlain;
76
- //# sourceMappingURL=run-9dbe70e9.cjs.js.map
76
+ //# sourceMappingURL=run-51c0c9a1.cjs.js.map
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var yaml = require('yaml');
4
- var config = require('./config-28e42b9e.cjs.js');
4
+ var config = require('./config-90b3ea39.cjs.js');
5
5
  var configLoader = require('@backstage/config-loader');
6
6
  require('@backstage/config');
7
- require('./index-4c8e4312.cjs.js');
7
+ require('./index-1adee07b.cjs.js');
8
8
  require('commander');
9
9
  require('chalk');
10
10
  require('fs-extra');
11
+ require('semver');
11
12
  require('@backstage/cli-common');
12
13
  require('@backstage/config/package.json');
13
14
 
@@ -30,4 +31,4 @@ var schema = async (cmd) => {
30
31
  };
31
32
 
32
33
  exports.default = schema;
33
- //# sourceMappingURL=schema-2bf6bfc2.cjs.js.map
34
+ //# sourceMappingURL=schema-3867dda3.cjs.js.map
@@ -13,27 +13,28 @@ require('webpack-node-externals');
13
13
  require('@backstage/cli-common');
14
14
  require('terser-webpack-plugin');
15
15
  require('mini-css-extract-plugin');
16
- var index = require('./index-4c8e4312.cjs.js');
17
- require('./run-9dbe70e9.cjs.js');
16
+ var index = require('./index-1adee07b.cjs.js');
17
+ require('./run-51c0c9a1.cjs.js');
18
18
  require('lodash/pickBy');
19
19
  require('yn');
20
20
  require('react-dev-utils/FileSizeReporter');
21
21
  require('react-dev-utils/formatWebpackMessages');
22
- var server = require('./server-8c07098b.cjs.js');
23
- var config = require('./config-28e42b9e.cjs.js');
24
- var lint = require('./lint-a04ad0c9.cjs.js');
22
+ var server = require('./server-f4d04d41.cjs.js');
23
+ var config = require('./config-90b3ea39.cjs.js');
24
+ var Lockfile = require('./Lockfile-80f0eec4.cjs.js');
25
+ var lint = require('./lint-b0918343.cjs.js');
25
26
  require('commander');
27
+ require('semver');
26
28
  require('@backstage/config/package.json');
27
29
  require('child_process');
28
30
  require('util');
29
31
  require('webpack-dev-server');
30
32
  require('react-dev-utils/openBrowser');
31
- require('./paths-90c07c2d.cjs.js');
33
+ require('./paths-3d580aef.cjs.js');
32
34
  require('./parallel-a4714c72.cjs.js');
33
35
  require('./svgrTemplate-2d0d15cf.cjs.js');
34
36
  require('@backstage/config-loader');
35
37
  require('@backstage/config');
36
- require('semver');
37
38
  require('@yarnpkg/lockfile');
38
39
  require('lodash/partition');
39
40
 
@@ -44,7 +45,7 @@ var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
44
45
  var uniq__default = /*#__PURE__*/_interopDefaultLegacy(uniq);
45
46
 
46
47
  var serve = async (cmd) => {
47
- const lockfile = await lint.Lockfile.load(index.paths.resolveTargetRoot("yarn.lock"));
48
+ const lockfile = await Lockfile.Lockfile.load(index.paths.resolveTargetRoot("yarn.lock"));
48
49
  const result = lockfile.analyze({
49
50
  filter: lint.includedFilter
50
51
  });
@@ -73,4 +74,4 @@ var serve = async (cmd) => {
73
74
  };
74
75
 
75
76
  exports.default = serve;
76
- //# sourceMappingURL=serve-31f9b4d5.cjs.js.map
77
+ //# sourceMappingURL=serve-3b88ab87.cjs.js.map
@@ -11,22 +11,23 @@ require('webpack-node-externals');
11
11
  require('@backstage/cli-common');
12
12
  require('terser-webpack-plugin');
13
13
  require('mini-css-extract-plugin');
14
- var index = require('./index-4c8e4312.cjs.js');
15
- require('./run-9dbe70e9.cjs.js');
14
+ var index = require('./index-1adee07b.cjs.js');
15
+ require('./run-51c0c9a1.cjs.js');
16
16
  require('lodash/pickBy');
17
17
  require('yn');
18
18
  require('react-dev-utils/FileSizeReporter');
19
19
  require('react-dev-utils/formatWebpackMessages');
20
20
  require('chalk');
21
- var server = require('./server-8c07098b.cjs.js');
22
- var config = require('./config-28e42b9e.cjs.js');
21
+ var server = require('./server-f4d04d41.cjs.js');
22
+ var config = require('./config-90b3ea39.cjs.js');
23
23
  require('commander');
24
+ require('semver');
24
25
  require('@backstage/config/package.json');
25
26
  require('child_process');
26
27
  require('util');
27
28
  require('webpack-dev-server');
28
29
  require('react-dev-utils/openBrowser');
29
- require('./paths-90c07c2d.cjs.js');
30
+ require('./paths-3d580aef.cjs.js');
30
31
  require('./parallel-a4714c72.cjs.js');
31
32
  require('./svgrTemplate-2d0d15cf.cjs.js');
32
33
  require('@backstage/config-loader');
@@ -51,4 +52,4 @@ var serve = async (cmd) => {
51
52
  };
52
53
 
53
54
  exports.default = serve;
54
- //# sourceMappingURL=serve-d38dbc03.cjs.js.map
55
+ //# sourceMappingURL=serve-a365d3ec.cjs.js.map
@@ -4,7 +4,7 @@ var fs = require('fs-extra');
4
4
  var webpack = require('webpack');
5
5
  var WebpackDevServer = require('webpack-dev-server');
6
6
  var openBrowser = require('react-dev-utils/openBrowser');
7
- var paths = require('./paths-90c07c2d.cjs.js');
7
+ var paths = require('./paths-3d580aef.cjs.js');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
@@ -70,4 +70,4 @@ async function serveBundle(options) {
70
70
  }
71
71
 
72
72
  exports.serveBundle = serveBundle;
73
- //# sourceMappingURL=server-8c07098b.cjs.js.map
73
+ //# sourceMappingURL=server-f4d04d41.cjs.js.map
@@ -6,7 +6,7 @@ var chalk = require('chalk');
6
6
  var handlebars = require('handlebars');
7
7
  var ora = require('ora');
8
8
  var recursive = require('recursive-readdir');
9
- var index = require('./index-4c8e4312.cjs.js');
9
+ var index = require('./index-1adee07b.cjs.js');
10
10
 
11
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
12
 
@@ -115,7 +115,7 @@ ${chalk__default['default'].red(message)}
115
115
  }
116
116
  }
117
117
  }
118
- async function templatingTask(templateDir, destinationDir, context, versions) {
118
+ async function templatingTask(templateDir, destinationDir, context, versionProvider) {
119
119
  const files = await recursive__default['default'](templateDir).catch((error) => {
120
120
  throw new Error(`Failed to read template directory: ${error.message}`);
121
121
  });
@@ -130,11 +130,8 @@ async function templatingTask(templateDir, destinationDir, context, versions) {
130
130
  const compiled = handlebars__default['default'].compile(template.toString());
131
131
  const contents = compiled({name: path.basename(destination), ...context}, {
132
132
  helpers: {
133
- version(name) {
134
- if (versions[name]) {
135
- return versions[name];
136
- }
137
- throw new Error(`No version available for package ${name}`);
133
+ versionQuery(name, versionHint) {
134
+ return versionProvider(name, typeof versionHint === "string" ? versionHint : void 0);
138
135
  }
139
136
  }
140
137
  });
@@ -161,4 +158,4 @@ exports.addCodeownersEntry = addCodeownersEntry;
161
158
  exports.getCodeownersFilePath = getCodeownersFilePath;
162
159
  exports.parseOwnerIds = parseOwnerIds;
163
160
  exports.templatingTask = templatingTask;
164
- //# sourceMappingURL=tasks-e05ab474.cjs.js.map
161
+ //# sourceMappingURL=tasks-bab2ff89.cjs.js.map
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-4c8e4312.cjs.js');
4
- var run = require('./run-9dbe70e9.cjs.js');
3
+ var index = require('./index-1adee07b.cjs.js');
4
+ var run = require('./run-51c0c9a1.cjs.js');
5
5
  require('commander');
6
6
  require('chalk');
7
7
  require('fs-extra');
8
+ require('semver');
8
9
  require('@backstage/cli-common');
9
10
  require('@backstage/config/package.json');
10
11
  require('child_process');
@@ -43,4 +44,4 @@ var testCommand = async (cmd) => {
43
44
  };
44
45
 
45
46
  exports.default = testCommand;
46
- //# sourceMappingURL=testCommand-5342acbc.cjs.js.map
47
+ //# sourceMappingURL=testCommand-2117c366.cjs.js.map
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var config = require('./config-28e42b9e.cjs.js');
3
+ var config = require('./config-90b3ea39.cjs.js');
4
4
  require('@backstage/config-loader');
5
5
  require('@backstage/config');
6
- require('./index-4c8e4312.cjs.js');
6
+ require('./index-1adee07b.cjs.js');
7
7
  require('commander');
8
8
  require('chalk');
9
9
  require('fs-extra');
10
+ require('semver');
10
11
  require('@backstage/cli-common');
11
12
  require('@backstage/config/package.json');
12
13
 
@@ -19,4 +20,4 @@ var validate = async (cmd) => {
19
20
  };
20
21
 
21
22
  exports.default = validate;
22
- //# sourceMappingURL=validate-39bddb12.cjs.js.map
23
+ //# sourceMappingURL=validate-13940d59.cjs.js.map
package/dist/index.cjs.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  require('commander');
4
4
  require('chalk');
5
- require('./cjs/index-4c8e4312.cjs.js');
5
+ require('./cjs/index-1adee07b.cjs.js');
6
6
  require('fs-extra');
7
+ require('semver');
7
8
  require('@backstage/cli-common');
8
9
  require('@backstage/config/package.json');
9
10