@backstage/cli 0.10.2 → 0.11.0

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 (44) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/config/eslint.js +4 -0
  3. package/dist/cjs/PackageGraph-7a0d3a83.cjs.js +73 -0
  4. package/dist/cjs/{build-f7391d28.cjs.js → build-3ec9b2bc.cjs.js} +11 -10
  5. package/dist/cjs/{build-cff6118b.cjs.js → build-52b0db70.cjs.js} +3 -3
  6. package/dist/cjs/{build-88dedfeb.cjs.js → build-821a11bc.cjs.js} +4 -4
  7. package/dist/cjs/{build-bdcd371f.cjs.js → build-cee864c1.cjs.js} +3 -3
  8. package/dist/cjs/{buildWorkspace-9b87177e.cjs.js → buildWorkspace-45130a91.cjs.js} +6 -4
  9. package/dist/cjs/{bump-b25927fc.cjs.js → bump-a67373dc.cjs.js} +21 -9
  10. package/dist/cjs/{bundle-55979dfa.cjs.js → bundle-a7edd074.cjs.js} +8 -6
  11. package/dist/cjs/{clean-0f54cc14.cjs.js → clean-639396b1.cjs.js} +2 -2
  12. package/dist/cjs/{config-5ba91797.cjs.js → config-123cfeb7.cjs.js} +21 -28
  13. package/dist/cjs/{create-6d641d14.cjs.js → create-fa295702.cjs.js} +6 -4
  14. package/dist/cjs/{createPlugin-6ac2d312.cjs.js → createPlugin-e3f24ce4.cjs.js} +6 -4
  15. package/dist/cjs/{dev-cd429ce6.cjs.js → dev-770fcb5a.cjs.js} +5 -6
  16. package/dist/cjs/{diff-1d56d594.cjs.js → diff-1cb77679.cjs.js} +2 -2
  17. package/dist/cjs/{docs-e4d44819.cjs.js → docs-0c0c53e6.cjs.js} +5 -3
  18. package/dist/cjs/{index-3c84ba54.cjs.js → index-79dd2453.cjs.js} +21 -38
  19. package/dist/cjs/{index-6d614e80.cjs.js → index-cf8ea481.cjs.js} +60 -60
  20. package/dist/cjs/{index-fedaf3ca.cjs.js → index-f1e57e57.cjs.js} +2 -2
  21. package/dist/cjs/{info-8f94b247.cjs.js → info-ac02891f.cjs.js} +5 -3
  22. package/dist/cjs/{install-ca0d283c.cjs.js → install-f342f3ba.cjs.js} +44 -15
  23. package/dist/cjs/{lint-011ecb5e.cjs.js → lint-a6f00949.cjs.js} +3 -3
  24. package/dist/cjs/{lint-95e6683a.cjs.js → lint-b832c4cb.cjs.js} +5 -3
  25. package/dist/cjs/{pack-e560ac5d.cjs.js → pack-30336e9e.cjs.js} +2 -2
  26. package/dist/cjs/{packager-ce66e788.cjs.js → packager-23503c79.cjs.js} +2 -2
  27. package/dist/cjs/{packages-9eb07d25.cjs.js → packages-c57bbd82.cjs.js} +15 -12
  28. package/dist/cjs/{parallel-a4714c72.cjs.js → parallel-7e32a8d0.cjs.js} +1 -5
  29. package/dist/cjs/{paths-21a11756.cjs.js → paths-8ed90bf4.cjs.js} +45 -37
  30. package/dist/cjs/{print-f804a5cf.cjs.js → print-806737e5.cjs.js} +5 -3
  31. package/dist/cjs/{removePlugin-706b2785.cjs.js → removePlugin-4925434c.cjs.js} +3 -3
  32. package/dist/cjs/{run-d553c76f.cjs.js → run-267170f8.cjs.js} +2 -2
  33. package/dist/cjs/{schema-96e87e90.cjs.js → schema-80d0f67f.cjs.js} +5 -3
  34. package/dist/cjs/{serve-58628236.cjs.js → serve-08f7c81f.cjs.js} +10 -10
  35. package/dist/cjs/{serve-7d0a208f.cjs.js → serve-da609963.cjs.js} +11 -10
  36. package/dist/cjs/{server-3261a34f.cjs.js → server-8a3d6585.cjs.js} +2 -2
  37. package/dist/cjs/{tasks-0a4f957e.cjs.js → tasks-6f86c24f.cjs.js} +2 -2
  38. package/dist/cjs/{testCommand-ee69f817.cjs.js → testCommand-08baa990.cjs.js} +3 -3
  39. package/dist/cjs/{validate-095aa31b.cjs.js → validate-b3cefb09.cjs.js} +5 -3
  40. package/dist/index.cjs.js +1 -1
  41. package/package.json +26 -26
  42. package/templates/default-backend-plugin/src/service/standaloneServer.ts.hbs +1 -1
  43. package/templates/default-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +1 -1
  44. package/templates/serve_index.html +1 -1
@@ -4,8 +4,10 @@ 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-6d614e80.cjs.js');
8
- var run = require('./run-d553c76f.cjs.js');
7
+ var index = require('./index-cf8ea481.cjs.js');
8
+ var run = require('./run-267170f8.cjs.js');
9
+ var getPackages = require('@manypkg/get-packages');
10
+ var PackageGraph = require('./PackageGraph-7a0d3a83.cjs.js');
9
11
 
10
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
13
 
@@ -19,7 +21,15 @@ const UNSAFE_PACKAGES = [
19
21
  async function createDistWorkspace(packageNames, options = {}) {
20
22
  var _a, _b, _c;
21
23
  const targetDir = (_a = options.targetDir) != null ? _a : await fs__default["default"].mkdtemp(path.resolve(os.tmpdir(), "dist-workspace"));
22
- const targets = await findTargetPackages(packageNames);
24
+ const { packages } = await getPackages.getPackages(index.paths.targetDir);
25
+ const packageGraph = PackageGraph.PackageGraph.fromPackages(packages);
26
+ const targetNames = packageGraph.collectPackageNames(packageNames, (node) => {
27
+ if (node.packageJson.bundled) {
28
+ return void 0;
29
+ }
30
+ return node.publishedLocalDependencies.keys();
31
+ });
32
+ const targets = Array.from(targetNames).map((name) => packageGraph.get(name));
23
33
  if (options.buildDependencies) {
24
34
  const exclude = (_b = options.buildExcludes) != null ? _b : [];
25
35
  const toBuild = targets.filter((target) => !exclude.includes(target.name));
@@ -40,7 +50,7 @@ async function createDistWorkspace(packageNames, options = {}) {
40
50
  }
41
51
  if (options.skeleton) {
42
52
  const skeletonFiles = targets.map((target) => {
43
- const dir = path.relative(index.paths.targetRoot, target.location);
53
+ const dir = path.relative(index.paths.targetRoot, target.dir);
44
54
  return path.join(dir, "package.json");
45
55
  });
46
56
  await tar__default["default"].create({
@@ -55,15 +65,16 @@ async function createDistWorkspace(packageNames, options = {}) {
55
65
  }
56
66
  async function moveToDistWorkspace(workspaceDir, localPackages) {
57
67
  async function pack(target, archive) {
68
+ var _a, _b;
58
69
  console.log(`Repacking ${target.name} into dist workspace`);
59
70
  const archivePath = path.resolve(workspaceDir, archive);
60
71
  await run.run("yarn", ["pack", "--filename", archivePath], {
61
- cwd: target.location
72
+ cwd: target.dir
62
73
  });
63
- if (target.scripts.postpack) {
64
- await run.run("yarn", ["postpack"], { cwd: target.location });
74
+ if ((_b = (_a = target.packageJson) == null ? void 0 : _a.scripts) == null ? void 0 : _b.postpack) {
75
+ await run.run("yarn", ["postpack"], { cwd: target.dir });
65
76
  }
66
- const outputDir = path.relative(index.paths.targetRoot, target.location);
77
+ const outputDir = path.relative(index.paths.targetRoot, target.dir);
67
78
  const absoluteOutputPath = path.resolve(workspaceDir, outputDir);
68
79
  await fs__default["default"].ensureDir(absoluteOutputPath);
69
80
  await tar__default["default"].extract({
@@ -72,7 +83,7 @@ async function moveToDistWorkspace(workspaceDir, localPackages) {
72
83
  strip: 1
73
84
  });
74
85
  await fs__default["default"].remove(archivePath);
75
- if (target.get("bundled")) {
86
+ if (target.packageJson.bundled) {
76
87
  const pkgJson = await fs__default["default"].readJson(path.resolve(absoluteOutputPath, "package.json"));
77
88
  delete pkgJson.dependencies;
78
89
  delete pkgJson.devDependencies;
@@ -90,34 +101,6 @@ async function moveToDistWorkspace(workspaceDir, localPackages) {
90
101
  }
91
102
  await Promise.all(safePackages.map(async (target, index) => pack(target, `temp-package-${index}.tgz`)));
92
103
  }
93
- async function findTargetPackages(pkgNames) {
94
- var _a;
95
- const { Project } = require("@lerna/project");
96
- const { PackageGraph } = require("@lerna/package-graph");
97
- const project = new Project(index.paths.targetDir);
98
- const packages = await project.getPackages();
99
- const graph = new PackageGraph(packages);
100
- const targets = /* @__PURE__ */ new Map();
101
- const searchNames = pkgNames.slice();
102
- while (searchNames.length) {
103
- const name = searchNames.pop();
104
- if (targets.has(name)) {
105
- continue;
106
- }
107
- const node = graph.get(name);
108
- if (!node) {
109
- throw new Error(`Package '${name}' not found`);
110
- }
111
- if (!node.pkg.get("bundled")) {
112
- const pkgDeps = Object.keys((_a = node.pkg.dependencies) != null ? _a : {});
113
- const localDeps = Array.from(node.localDependencies.keys());
114
- const filteredDeps = localDeps.filter((dep) => pkgDeps.includes(dep));
115
- searchNames.push(...filteredDeps);
116
- }
117
- targets.set(name, node.pkg);
118
- }
119
- return Array.from(targets.values());
120
- }
121
104
 
122
105
  exports.createDistWorkspace = createDistWorkspace;
123
- //# sourceMappingURL=index-3c84ba54.cjs.js.map
106
+ //# sourceMappingURL=index-79dd2453.cjs.js.map
@@ -46,18 +46,17 @@ class NotFoundError extends CustomError {
46
46
 
47
47
  const paths = cliCommon.findPaths(__dirname);
48
48
 
49
- var version$9 = "0.9.14";
49
+ var version$9 = "0.10.3";
50
50
 
51
- var version$8 = "0.10.2";
51
+ var version$8 = "0.11.0";
52
52
  var dependencies = {
53
53
  "@backstage/cli-common": "^0.1.6",
54
- "@backstage/config": "^0.1.11",
55
- "@backstage/config-loader": "^0.8.1",
56
- "@backstage/errors": "^0.1.5",
54
+ "@backstage/config": "^0.1.12",
55
+ "@backstage/config-loader": "^0.9.2",
56
+ "@backstage/errors": "^0.2.0",
57
57
  "@backstage/types": "^0.1.1",
58
58
  "@hot-loader/react-dom": "^16.13.0",
59
- "@lerna/package-graph": "^4.0.0",
60
- "@lerna/project": "^4.0.0",
59
+ "@manypkg/get-packages": "^1.1.3",
61
60
  "@octokit/request": "^5.4.12",
62
61
  "@rollup/plugin-commonjs": "^21.0.1",
63
62
  "@rollup/plugin-json": "^4.1.0",
@@ -73,27 +72,27 @@ var dependencies = {
73
72
  "@svgr/rollup": "5.5.x",
74
73
  "@svgr/webpack": "5.5.x",
75
74
  "@types/webpack-env": "^1.15.2",
76
- "@typescript-eslint/eslint-plugin": "^v4.30.0",
77
- "@typescript-eslint/parser": "^v4.28.3",
75
+ "@typescript-eslint/eslint-plugin": "^5.9.0",
76
+ "@typescript-eslint/parser": "^5.9.0",
78
77
  "@yarnpkg/lockfile": "^1.1.0",
79
78
  bfj: "^7.0.2",
80
79
  buffer: "^6.0.3",
81
80
  chalk: "^4.0.0",
82
81
  chokidar: "^3.3.1",
83
82
  commander: "^6.1.0",
84
- "css-loader": "^5.2.6",
85
- dashify: "^2.0.0",
83
+ "css-loader": "^6.5.1",
86
84
  diff: "^5.0.0",
87
- esbuild: "^0.14.1",
88
- eslint: "^7.30.0",
85
+ esbuild: "^0.14.10",
86
+ "esbuild-loader": "^2.18.0",
87
+ eslint: "^8.6.0",
89
88
  "eslint-config-prettier": "^8.3.0",
90
89
  "eslint-formatter-friendly": "^7.0.0",
91
- "eslint-plugin-import": "^2.20.2",
92
- "eslint-plugin-jest": "^24.1.0",
93
- "eslint-plugin-jsx-a11y": "^6.2.1",
90
+ "eslint-plugin-import": "^2.25.4",
91
+ "eslint-plugin-jest": "^25.3.4",
92
+ "eslint-plugin-jsx-a11y": "^6.5.1",
94
93
  "eslint-plugin-monorepo": "^0.3.2",
95
- "eslint-plugin-react": "^7.12.4",
96
- "eslint-plugin-react-hooks": "^4.0.0",
94
+ "eslint-plugin-react": "^7.28.0",
95
+ "eslint-plugin-react-hooks": "^4.3.0",
97
96
  express: "^4.17.1",
98
97
  "fork-ts-checker-webpack-plugin": "^4.0.5",
99
98
  "fs-extra": "9.1.0",
@@ -106,6 +105,7 @@ var dependencies = {
106
105
  "json-schema": "^0.4.0",
107
106
  "jest-transform-yaml": "^0.1.1",
108
107
  lodash: "^4.17.21",
108
+ minimatch: "3.0.4",
109
109
  "mini-css-extract-plugin": "^2.4.2",
110
110
  "node-libs-browser": "^2.2.1",
111
111
  ora: "^5.3.0",
@@ -127,7 +127,6 @@ var dependencies = {
127
127
  sucrase: "^3.20.2",
128
128
  tar: "^6.1.2",
129
129
  "terser-webpack-plugin": "^5.1.3",
130
- "ts-loader": "^8.0.17",
131
130
  typescript: "^4.0.3",
132
131
  util: "^0.12.3",
133
132
  webpack: "^5.48.0",
@@ -138,19 +137,20 @@ var dependencies = {
138
137
  yn: "^4.0.0"
139
138
  };
140
139
  var devDependencies = {
141
- "@backstage/backend-common": "^0.9.14",
142
- "@backstage/config": "^0.1.11",
143
- "@backstage/core-components": "^0.8.1",
144
- "@backstage/core-plugin-api": "^0.3.1",
145
- "@backstage/core-app-api": "^0.2.1",
146
- "@backstage/dev-utils": "^0.2.14",
147
- "@backstage/test-utils": "^0.1.24",
140
+ "@backstage/backend-common": "^0.10.3",
141
+ "@backstage/config": "^0.1.12",
142
+ "@backstage/core-components": "^0.8.4",
143
+ "@backstage/core-plugin-api": "^0.5.0",
144
+ "@backstage/core-app-api": "^0.4.0",
145
+ "@backstage/dev-utils": "^0.2.17",
146
+ "@backstage/test-utils": "^0.2.2",
148
147
  "@backstage/theme": "^0.2.14",
149
148
  "@types/diff": "^5.0.0",
150
149
  "@types/express": "^4.17.6",
151
150
  "@types/fs-extra": "^9.0.1",
152
151
  "@types/http-proxy": "^1.17.4",
153
152
  "@types/inquirer": "^8.1.3",
153
+ "@types/minimatch": "^3.0.5",
154
154
  "@types/mock-fs": "^4.13.0",
155
155
  "@types/node": "^14.14.32",
156
156
  "@types/recursive-readdir": "^2.2.0",
@@ -167,19 +167,19 @@ var devDependencies = {
167
167
  "ts-node": "^10.0.0"
168
168
  };
169
169
 
170
- var version$7 = "0.2.1";
170
+ var version$7 = "0.4.0";
171
171
 
172
- var version$6 = "0.8.1";
172
+ var version$6 = "0.8.4";
173
173
 
174
- var version$5 = "0.3.1";
174
+ var version$5 = "0.5.0";
175
175
 
176
- var version$4 = "0.2.14";
176
+ var version$4 = "0.2.17";
177
177
 
178
- var version$3 = "0.1.24";
178
+ var version$3 = "0.2.2";
179
179
 
180
180
  var version$2 = "0.2.14";
181
181
 
182
- var version$1 = "0.15.17";
182
+ var version$1 = "0.15.20";
183
183
 
184
184
  const packageVersions = {
185
185
  "@backstage/backend-common": version$9,
@@ -233,33 +233,33 @@ function registerCommands(program) {
233
233
  (opt, opts) => [...opts, opt],
234
234
  Array()
235
235
  ];
236
- 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-f7391d28.cjs.js'); }).then((m) => m.default)));
237
- 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-7d0a208f.cjs.js'); }).then((m) => m.default)));
238
- program.command("backend:build").description("Build a backend plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-bdcd371f.cjs.js'); }).then((m) => m.default)));
239
- 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-55979dfa.cjs.js'); }).then((m) => m.default)));
240
- 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-cd429ce6.cjs.js'); }).then((m) => m.default)));
241
- 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-6d641d14.cjs.js'); }).then((m) => m.default)));
242
- 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-6ac2d312.cjs.js'); }).then((m) => m.default)));
243
- program.command("remove-plugin").description("[DEPRECATED] - Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-706b2785.cjs.js'); }).then((m) => m.default)));
244
- program.command("plugin:build").description("Build a plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-cff6118b.cjs.js'); }).then((m) => m.default)));
245
- 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-58628236.cjs.js'); }).then((m) => m.default)));
246
- 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-1d56d594.cjs.js'); }).then((m) => m.default)));
247
- 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-88dedfeb.cjs.js'); }).then((m) => m.default)));
248
- 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-011ecb5e.cjs.js'); }).then((m) => m.default)));
249
- 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-ee69f817.cjs.js'); }).then((m) => m.default)));
250
- 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-e4d44819.cjs.js'); }).then((m) => m.default)));
251
- 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-f804a5cf.cjs.js'); }).then((m) => m.default)));
252
- 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-095aa31b.cjs.js'); }).then((m) => m.default)));
253
- 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-96e87e90.cjs.js'); }).then((m) => m.default)));
254
- program.command("versions:bump").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-b25927fc.cjs.js'); }).then((m) => m.default)));
255
- 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-95e6683a.cjs.js'); }).then((m) => m.default)));
256
- program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-e560ac5d.cjs.js'); }).then((m) => m.pre)));
257
- program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-e560ac5d.cjs.js'); }).then((m) => m.post)));
258
- program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-0f54cc14.cjs.js'); }).then((m) => m.default)));
259
- 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-9b87177e.cjs.js'); }).then((m) => m.default)));
260
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-fedaf3ca.cjs.js'); }).then((m) => m.default)));
261
- program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-8f94b247.cjs.js'); }).then((m) => m.default)));
262
- 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-ca0d283c.cjs.js'); }).then((m) => m.default)));
236
+ 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-3ec9b2bc.cjs.js'); }).then((m) => m.default)));
237
+ 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-da609963.cjs.js'); }).then((m) => m.default)));
238
+ program.command("backend:build").description("Build a backend plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-cee864c1.cjs.js'); }).then((m) => m.default)));
239
+ 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-a7edd074.cjs.js'); }).then((m) => m.default)));
240
+ 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-770fcb5a.cjs.js'); }).then((m) => m.default)));
241
+ 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-fa295702.cjs.js'); }).then((m) => m.default)));
242
+ 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-e3f24ce4.cjs.js'); }).then((m) => m.default)));
243
+ program.command("remove-plugin").description("[DEPRECATED] - Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-4925434c.cjs.js'); }).then((m) => m.default)));
244
+ program.command("plugin:build").description("Build a plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-52b0db70.cjs.js'); }).then((m) => m.default)));
245
+ 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-08f7c81f.cjs.js'); }).then((m) => m.default)));
246
+ 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-1cb77679.cjs.js'); }).then((m) => m.default)));
247
+ program.command("build").description("Build a package for publishing").option("--outputs <formats>", "List of formats to output [types,cjs,esm]").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-821a11bc.cjs.js'); }).then((m) => m.default)));
248
+ 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-a6f00949.cjs.js'); }).then((m) => m.default)));
249
+ 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-08baa990.cjs.js'); }).then((m) => m.default)));
250
+ 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-0c0c53e6.cjs.js'); }).then((m) => m.default)));
251
+ 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-806737e5.cjs.js'); }).then((m) => m.default)));
252
+ 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-b3cefb09.cjs.js'); }).then((m) => m.default)));
253
+ 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-80d0f67f.cjs.js'); }).then((m) => m.default)));
254
+ program.command("versions:bump").option("--pattern <glob>", "Override glob for matching packages to upgrade").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./bump-a67373dc.cjs.js'); }).then((m) => m.default)));
255
+ 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-b832c4cb.cjs.js'); }).then((m) => m.default)));
256
+ program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-30336e9e.cjs.js'); }).then((m) => m.pre)));
257
+ program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-30336e9e.cjs.js'); }).then((m) => m.post)));
258
+ program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-639396b1.cjs.js'); }).then((m) => m.default)));
259
+ 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-45130a91.cjs.js'); }).then((m) => m.default)));
260
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-f1e57e57.cjs.js'); }).then((m) => m.default)));
261
+ program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-ac02891f.cjs.js'); }).then((m) => m.default)));
262
+ 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-f342f3ba.cjs.js'); }).then((m) => m.default)));
263
263
  }
264
264
  function lazy(getActionFunc) {
265
265
  return async (...args) => {
@@ -303,4 +303,4 @@ exports.devDependencies = devDependencies;
303
303
  exports.paths = paths;
304
304
  exports.version = version;
305
305
  exports.version$1 = version$8;
306
- //# sourceMappingURL=index-6d614e80.cjs.js.map
306
+ //# sourceMappingURL=index-cf8ea481.cjs.js.map
@@ -3,7 +3,7 @@
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-6d614e80.cjs.js');
6
+ var index$1 = require('./index-cf8ea481.cjs.js');
7
7
  var crypto = require('crypto');
8
8
  var openBrowser = require('react-dev-utils/openBrowser');
9
9
  var request = require('@octokit/request');
@@ -128,4 +128,4 @@ ${yaml.stringify(config)}`;
128
128
  };
129
129
 
130
130
  exports["default"] = index;
131
- //# sourceMappingURL=index-fedaf3ca.cjs.js.map
131
+ //# sourceMappingURL=index-f1e57e57.cjs.js.map
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-6d614e80.cjs.js');
3
+ var index = require('./index-cf8ea481.cjs.js');
4
4
  var os = require('os');
5
- var run = require('./run-d553c76f.cjs.js');
5
+ var run = require('./run-267170f8.cjs.js');
6
6
  var Lockfile = require('./Lockfile-35661afa.cjs.js');
7
+ require('minimatch');
8
+ require('@manypkg/get-packages');
7
9
  require('chalk');
8
10
  require('commander');
9
11
  require('fs-extra');
@@ -41,4 +43,4 @@ var info = async () => {
41
43
  };
42
44
 
43
45
  exports["default"] = info;
44
- //# sourceMappingURL=info-8f94b247.cjs.js.map
46
+ //# sourceMappingURL=info-ac02891f.cjs.js.map
@@ -3,12 +3,14 @@
3
3
  var fs = require('fs-extra');
4
4
  require('semver');
5
5
  require('@yarnpkg/lockfile');
6
- var packages = require('./packages-9eb07d25.cjs.js');
7
- var index = require('./index-6d614e80.cjs.js');
6
+ var packages = require('./packages-c57bbd82.cjs.js');
7
+ var index = require('./index-cf8ea481.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-d553c76f.cjs.js');
11
+ var run = require('./run-267170f8.cjs.js');
12
+ require('minimatch');
13
+ require('@manypkg/get-packages');
12
14
  require('commander');
13
15
  require('@backstage/cli-common');
14
16
  require('@backstage/config/package.json');
@@ -161,7 +163,7 @@ class PluginInstaller {
161
163
  constructor(steps) {
162
164
  this.steps = steps;
163
165
  }
164
- static async resolveSteps(pkg) {
166
+ static async resolveSteps(pkg, versionToInstall) {
165
167
  var _a, _b;
166
168
  const steps = [];
167
169
  const dependencies$1 = [];
@@ -169,7 +171,7 @@ class PluginInstaller {
169
171
  target: "packages/app",
170
172
  type: "dependencies",
171
173
  name: pkg.name,
172
- query: `^${pkg.version}`
174
+ query: versionToInstall || `^${pkg.version}`
173
175
  });
174
176
  steps.push({
175
177
  type: "dependencies",
@@ -196,19 +198,46 @@ class PluginInstaller {
196
198
  }
197
199
  }
198
200
  }
201
+ async function installPluginAndPeerPlugins(pkg) {
202
+ const pluginDeps = /* @__PURE__ */ new Map();
203
+ pluginDeps.set(pkg.name, { pkg });
204
+ await loadPeerPluginDeps(pkg, pluginDeps);
205
+ console.log(`Installing ${pkg.name} AND any peer plugin dependencies.`);
206
+ for (const [_pluginDepName, pluginDep] of pluginDeps.entries()) {
207
+ const { pkg: pluginDepPkg, versionToInstall } = pluginDep;
208
+ console.log(`Installing plugin: ${pluginDepPkg.name}: ${versionToInstall || pluginDepPkg.version}`);
209
+ const steps = await PluginInstaller.resolveSteps(pluginDepPkg, versionToInstall);
210
+ const installer = new PluginInstaller(steps);
211
+ await installer.run();
212
+ }
213
+ }
214
+ async function loadPackageJson(plugin) {
215
+ if (plugin.endsWith("package.json")) {
216
+ return await fs__default["default"].readJson(plugin);
217
+ }
218
+ return await fetchPluginPackage(plugin);
219
+ }
220
+ async function loadPeerPluginDeps(pkg, pluginMap) {
221
+ var _a, _b;
222
+ for (const [pluginId, pluginVersion] of Object.entries((_b = (_a = pkg.experimentalInstallationRecipe) == null ? void 0 : _a.peerPluginDependencies) != null ? _b : {})) {
223
+ const depPkg = await loadPackageJson(pluginId);
224
+ if (!pluginMap.get(depPkg.name)) {
225
+ pluginMap.set(depPkg.name, {
226
+ pkg: depPkg,
227
+ versionToInstall: pluginVersion
228
+ });
229
+ await loadPeerPluginDeps(depPkg, pluginMap);
230
+ }
231
+ }
232
+ }
199
233
  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 {
234
+ const from = pluginId || (cmd == null ? void 0 : cmd.from);
235
+ if (!from) {
206
236
  throw new Error("Missing both <plugin-id> or a package.json file path in the --from flag.");
207
237
  }
208
- const steps = await PluginInstaller.resolveSteps(pkg);
209
- const installer = new PluginInstaller(steps);
210
- await installer.run();
238
+ const pkg = await loadPackageJson(from);
239
+ await installPluginAndPeerPlugins(pkg);
211
240
  };
212
241
 
213
242
  exports["default"] = install;
214
- //# sourceMappingURL=install-ca0d283c.cjs.js.map
243
+ //# sourceMappingURL=install-f342f3ba.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var run = require('./run-d553c76f.cjs.js');
4
- var index = require('./index-6d614e80.cjs.js');
3
+ var run = require('./run-267170f8.cjs.js');
4
+ var index = require('./index-cf8ea481.cjs.js');
5
5
  require('child_process');
6
6
  require('util');
7
7
  require('@backstage/errors');
@@ -26,4 +26,4 @@ var lint = async (cmd, cmdArgs) => {
26
26
  };
27
27
 
28
28
  exports["default"] = lint;
29
- //# sourceMappingURL=lint-011ecb5e.cjs.js.map
29
+ //# sourceMappingURL=lint-a6f00949.cjs.js.map
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var Lockfile = require('./Lockfile-35661afa.cjs.js');
4
- require('./run-d553c76f.cjs.js');
4
+ require('minimatch');
5
+ require('@manypkg/get-packages');
6
+ require('./run-267170f8.cjs.js');
5
7
  require('chalk');
6
- var index = require('./index-6d614e80.cjs.js');
8
+ var index = require('./index-cf8ea481.cjs.js');
7
9
  var partition = require('lodash/partition');
8
10
  require('fs-extra');
9
11
  require('semver');
@@ -74,4 +76,4 @@ function logArray(arr, header, each) {
74
76
  exports["default"] = lint;
75
77
  exports.forbiddenDuplicatesFilter = forbiddenDuplicatesFilter;
76
78
  exports.includedFilter = includedFilter;
77
- //# sourceMappingURL=lint-95e6683a.cjs.js.map
79
+ //# sourceMappingURL=lint-b832c4cb.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-6d614e80.cjs.js');
4
+ var index = require('./index-cf8ea481.cjs.js');
5
5
  require('commander');
6
6
  require('chalk');
7
7
  require('semver');
@@ -39,4 +39,4 @@ const post = async () => {
39
39
 
40
40
  exports.post = post;
41
41
  exports.pre = pre;
42
- //# sourceMappingURL=pack-e560ac5d.cjs.js.map
42
+ //# sourceMappingURL=pack-30336e9e.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-6d614e80.cjs.js');
7
+ var index = require('./index-cf8ea481.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');
@@ -256,4 +256,4 @@ const buildPackage = async (options) => {
256
256
 
257
257
  exports.Output = Output;
258
258
  exports.buildPackage = buildPackage;
259
- //# sourceMappingURL=packager-ce66e788.cjs.js.map
259
+ //# sourceMappingURL=packager-23503c79.cjs.js.map
@@ -1,9 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var run = require('./run-d553c76f.cjs.js');
4
- var index = require('./index-6d614e80.cjs.js');
3
+ var minimatch = require('minimatch');
4
+ var getPackages = require('@manypkg/get-packages');
5
+ var run = require('./run-267170f8.cjs.js');
6
+ var index = require('./index-cf8ea481.cjs.js');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var minimatch__default = /*#__PURE__*/_interopDefaultLegacy(minimatch);
5
11
 
6
- const PREFIX = "@backstage";
7
12
  const DEP_TYPES = [
8
13
  "dependencies",
9
14
  "devDependencies",
@@ -21,23 +26,21 @@ async function fetchPackageInfo(name) {
21
26
  }
22
27
  return info.data;
23
28
  }
24
- async function mapDependencies(targetDir) {
29
+ async function mapDependencies(targetDir, pattern) {
25
30
  var _a;
26
- const { Project } = require("@lerna/project");
27
- const project = new Project(targetDir);
28
- const packages = await project.getPackages();
31
+ const { packages } = await getPackages.getPackages(targetDir);
29
32
  const dependencyMap = /* @__PURE__ */ new Map();
30
33
  for (const pkg of packages) {
31
34
  const deps = DEP_TYPES.flatMap((t) => {
32
35
  var _a2;
33
- return Object.entries((_a2 = pkg.get(t)) != null ? _a2 : {});
36
+ return Object.entries((_a2 = pkg.packageJson[t]) != null ? _a2 : {});
34
37
  });
35
38
  for (const [name, range] of deps) {
36
- if (name.startsWith(PREFIX)) {
39
+ if (minimatch__default["default"](name, pattern)) {
37
40
  dependencyMap.set(name, ((_a = dependencyMap.get(name)) != null ? _a : []).concat({
38
41
  range,
39
- name: pkg.name,
40
- location: pkg.location
42
+ name: pkg.packageJson.name,
43
+ location: pkg.dir
41
44
  }));
42
45
  }
43
46
  }
@@ -47,4 +50,4 @@ async function mapDependencies(targetDir) {
47
50
 
48
51
  exports.fetchPackageInfo = fetchPackageInfo;
49
52
  exports.mapDependencies = mapDependencies;
50
- //# sourceMappingURL=packages-9eb07d25.cjs.js.map
53
+ //# sourceMappingURL=packages-c57bbd82.cjs.js.map
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const PARALLEL_ENV_VAR = "BACKSTAGE_CLI_BUILD_PARALLEL";
4
- function isParallelDefault(parallel) {
5
- return parallel === void 0 || parallel === true;
6
- }
7
4
  function parseParallel(parallel) {
8
5
  if (parallel === void 0 || parallel === null) {
9
6
  return true;
@@ -24,6 +21,5 @@ function parseParallel(parallel) {
24
21
  }
25
22
 
26
23
  exports.PARALLEL_ENV_VAR = PARALLEL_ENV_VAR;
27
- exports.isParallelDefault = isParallelDefault;
28
24
  exports.parseParallel = parseParallel;
29
- //# sourceMappingURL=parallel-a4714c72.cjs.js.map
25
+ //# sourceMappingURL=parallel-7e32a8d0.cjs.js.map