@backstage/cli 0.0.0-nightly-20220923026 → 0.0.0-nightly-202201921950

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 (41) hide show
  1. package/CHANGELOG.md +129 -4
  2. package/dist/cjs/PackageGraph-7a0d3a83.cjs.js +73 -0
  3. package/dist/cjs/{build-8e079434.cjs.js → build-41b160e1.cjs.js} +5 -4
  4. package/dist/cjs/{build-79497058.cjs.js → build-5e469530.cjs.js} +5 -4
  5. package/dist/cjs/{build-57f88626.cjs.js → build-6a564e18.cjs.js} +8 -4
  6. package/dist/cjs/{build-7f2135a7.cjs.js → build-e1cfa92a.cjs.js} +7 -5
  7. package/dist/cjs/{buildWorkspace-78bd544f.cjs.js → buildWorkspace-b198351d.cjs.js} +6 -4
  8. package/dist/cjs/{bump-4a788102.cjs.js → bump-0d4c7e07.cjs.js} +6 -5
  9. package/dist/cjs/{bundle-9491c329.cjs.js → bundle-2cb505f3.cjs.js} +7 -5
  10. package/dist/cjs/{clean-7e944afc.cjs.js → clean-265d3ed5.cjs.js} +2 -2
  11. package/dist/cjs/{config-0d6e4de0.cjs.js → config-a790fbee.cjs.js} +15 -29
  12. package/dist/cjs/{create-f0969b95.cjs.js → create-8dc87021.cjs.js} +5 -4
  13. package/dist/cjs/{createPlugin-0db14da6.cjs.js → createPlugin-f480902b.cjs.js} +5 -4
  14. package/dist/cjs/{dev-1afb13fc.cjs.js → dev-558ef0c6.cjs.js} +5 -4
  15. package/dist/cjs/{diff-00980d7f.cjs.js → diff-7382e071.cjs.js} +2 -2
  16. package/dist/cjs/{docs-f7db071f.cjs.js → docs-a44be9cd.cjs.js} +5 -3
  17. package/dist/cjs/{index-5a342e80.cjs.js → index-1f61de85.cjs.js} +21 -38
  18. package/dist/cjs/{index-2f474a74.cjs.js → index-63774350.cjs.js} +2 -2
  19. package/dist/cjs/{index-bd3b0c1e.cjs.js → index-92454bcd.cjs.js} +49 -51
  20. package/dist/cjs/{info-e811e67f.cjs.js → info-643074cc.cjs.js} +4 -3
  21. package/dist/cjs/{install-8b1beb58.cjs.js → install-c8b107f7.cjs.js} +5 -4
  22. package/dist/cjs/{lint-68e81c10.cjs.js → lint-25eb1889.cjs.js} +4 -3
  23. package/dist/cjs/{lint-1b0b6806.cjs.js → lint-5aa2e47f.cjs.js} +3 -3
  24. package/dist/cjs/pack-a5e15cdb.cjs.js +69 -0
  25. package/dist/cjs/{packager-e08008bd.cjs.js → packager-052876f4.cjs.js} +101 -8
  26. package/dist/cjs/{packages-5024d195.cjs.js → packages-435d71fd.cjs.js} +8 -9
  27. package/dist/cjs/{paths-95c895b2.cjs.js → paths-21c29d56.cjs.js} +14 -18
  28. package/dist/cjs/{print-f1d77fd9.cjs.js → print-207cc148.cjs.js} +5 -3
  29. package/dist/cjs/{removePlugin-a9768c44.cjs.js → removePlugin-350b9293.cjs.js} +3 -3
  30. package/dist/cjs/{run-d9adcdf0.cjs.js → run-ad69ea39.cjs.js} +2 -2
  31. package/dist/cjs/{schema-527a88e1.cjs.js → schema-aa853b70.cjs.js} +5 -3
  32. package/dist/cjs/{serve-a7577340.cjs.js → serve-90512169.cjs.js} +9 -7
  33. package/dist/cjs/{serve-53a1a479.cjs.js → serve-d962519a.cjs.js} +8 -6
  34. package/dist/cjs/{server-31c9fc29.cjs.js → server-acd52f96.cjs.js} +2 -2
  35. package/dist/cjs/{tasks-ad37878c.cjs.js → tasks-7bce14e6.cjs.js} +2 -2
  36. package/dist/cjs/{testCommand-daf4fd8b.cjs.js → testCommand-0e57c1d2.cjs.js} +3 -3
  37. package/dist/cjs/{validate-3a993cfc.cjs.js → validate-878f8022.cjs.js} +7 -4
  38. package/dist/index.cjs.js +1 -1
  39. package/package.json +24 -18
  40. package/templates/default-backend-plugin/src/service/standaloneServer.ts.hbs +1 -1
  41. package/dist/cjs/pack-3efd831f.cjs.js +0 -42
@@ -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-bd3b0c1e.cjs.js');
8
- var run = require('./run-d9adcdf0.cjs.js');
7
+ var index = require('./index-92454bcd.cjs.js');
8
+ var run = require('./run-ad69ea39.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-5a342e80.cjs.js.map
106
+ //# sourceMappingURL=index-1f61de85.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-bd3b0c1e.cjs.js');
6
+ var index$1 = require('./index-92454bcd.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-2f474a74.cjs.js.map
131
+ //# sourceMappingURL=index-63774350.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.10.2";
49
+ var version$9 = "0.10.4-next.0";
50
50
 
51
- var version$8 = "0.10.5";
51
+ var version$8 = "0.12.0-next.0";
52
52
  var dependencies = {
53
53
  "@backstage/cli-common": "^0.1.6",
54
- "@backstage/config": "^0.1.11",
55
- "@backstage/config-loader": "^0.9.1",
56
- "@backstage/errors": "^0.1.5",
54
+ "@backstage/config": "^0.1.13-next.0",
55
+ "@backstage/config-loader": "^0.9.3-next.0",
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",
@@ -68,8 +67,8 @@ var dependencies = {
68
67
  "@spotify/eslint-config-typescript": "^12.0.0",
69
68
  "@sucrase/jest-plugin": "^2.1.1",
70
69
  "@sucrase/webpack-loader": "^2.0.0",
71
- "@svgr/plugin-jsx": "5.5.x",
72
- "@svgr/plugin-svgo": "5.4.x",
70
+ "@svgr/plugin-jsx": "6.2.x",
71
+ "@svgr/plugin-svgo": "6.2.x",
73
72
  "@svgr/rollup": "5.5.x",
74
73
  "@svgr/webpack": "5.5.x",
75
74
  "@types/webpack-env": "^1.15.2",
@@ -128,7 +127,6 @@ var dependencies = {
128
127
  sucrase: "^3.20.2",
129
128
  tar: "^6.1.2",
130
129
  "terser-webpack-plugin": "^5.1.3",
131
- typescript: "^4.0.3",
132
130
  util: "^0.12.3",
133
131
  webpack: "^5.48.0",
134
132
  "webpack-dev-server": "4.3.1",
@@ -138,13 +136,13 @@ var dependencies = {
138
136
  yn: "^4.0.0"
139
137
  };
140
138
  var devDependencies = {
141
- "@backstage/backend-common": "^0.10.2",
142
- "@backstage/config": "^0.1.11",
143
- "@backstage/core-components": "^0.8.3",
144
- "@backstage/core-plugin-api": "^0.4.1",
145
- "@backstage/core-app-api": "^0.3.1",
146
- "@backstage/dev-utils": "^0.2.16",
147
- "@backstage/test-utils": "^0.2.1",
139
+ "@backstage/backend-common": "^0.10.4-next.0",
140
+ "@backstage/config": "^0.1.13-next.0",
141
+ "@backstage/core-components": "^0.8.5-next.0",
142
+ "@backstage/core-plugin-api": "^0.6.0-next.0",
143
+ "@backstage/core-app-api": "^0.5.0-next.0",
144
+ "@backstage/dev-utils": "^0.2.18-next.0",
145
+ "@backstage/test-utils": "^0.2.3-next.0",
148
146
  "@backstage/theme": "^0.2.14",
149
147
  "@types/diff": "^5.0.0",
150
148
  "@types/express": "^4.17.6",
@@ -168,19 +166,19 @@ var devDependencies = {
168
166
  "ts-node": "^10.0.0"
169
167
  };
170
168
 
171
- var version$7 = "0.3.1";
169
+ var version$7 = "0.5.0-next.0";
172
170
 
173
- var version$6 = "0.8.3";
171
+ var version$6 = "0.8.5-next.0";
174
172
 
175
- var version$5 = "0.4.1";
173
+ var version$5 = "0.6.0-next.0";
176
174
 
177
- var version$4 = "0.2.16";
175
+ var version$4 = "0.2.18-next.0";
178
176
 
179
- var version$3 = "0.2.1";
177
+ var version$3 = "0.2.3-next.0";
180
178
 
181
179
  var version$2 = "0.2.14";
182
180
 
183
- var version$1 = "0.15.19";
181
+ var version$1 = "0.15.21-next.0";
184
182
 
185
183
  const packageVersions = {
186
184
  "@backstage/backend-common": version$9,
@@ -234,33 +232,33 @@ function registerCommands(program) {
234
232
  (opt, opts) => [...opts, opt],
235
233
  Array()
236
234
  ];
237
- 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-7f2135a7.cjs.js'); }).then((m) => m.default)));
238
- program.command("app:serve").description("Serve an app for local development").option("--check", "Enable type checking and linting").option(...configOption).action(lazy(() => Promise.resolve().then(function () { return require('./serve-a7577340.cjs.js'); }).then((m) => m.default)));
239
- program.command("backend:build").description("Build a backend plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-79497058.cjs.js'); }).then((m) => m.default)));
240
- program.command("backend:bundle").description("Bundle the backend into a deployment archive").option("--build-dependencies", "Build all local package dependencies before bundling the backend").action(lazy(() => Promise.resolve().then(function () { return require('./bundle-9491c329.cjs.js'); }).then((m) => m.default)));
241
- 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-1afb13fc.cjs.js'); }).then((m) => m.default)));
242
- 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-f0969b95.cjs.js'); }).then((m) => m.default)));
243
- 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-0db14da6.cjs.js'); }).then((m) => m.default)));
244
- program.command("remove-plugin").description("[DEPRECATED] - Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-a9768c44.cjs.js'); }).then((m) => m.default)));
245
- program.command("plugin:build").description("Build a plugin").option("--minify", "Minify the generated code").action(lazy(() => Promise.resolve().then(function () { return require('./build-8e079434.cjs.js'); }).then((m) => m.default)));
246
- 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-53a1a479.cjs.js'); }).then((m) => m.default)));
247
- 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-00980d7f.cjs.js'); }).then((m) => m.default)));
248
- 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-57f88626.cjs.js'); }).then((m) => m.default)));
249
- 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-1b0b6806.cjs.js'); }).then((m) => m.default)));
250
- 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-daf4fd8b.cjs.js'); }).then((m) => m.default)));
251
- 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-f7db071f.cjs.js'); }).then((m) => m.default)));
252
- 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-f1d77fd9.cjs.js'); }).then((m) => m.default)));
253
- 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-3a993cfc.cjs.js'); }).then((m) => m.default)));
254
- 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-527a88e1.cjs.js'); }).then((m) => m.default)));
255
- 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-4a788102.cjs.js'); }).then((m) => m.default)));
256
- 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-68e81c10.cjs.js'); }).then((m) => m.default)));
257
- program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-3efd831f.cjs.js'); }).then((m) => m.pre)));
258
- program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-3efd831f.cjs.js'); }).then((m) => m.post)));
259
- program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-7e944afc.cjs.js'); }).then((m) => m.default)));
260
- 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-78bd544f.cjs.js'); }).then((m) => m.default)));
261
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-2f474a74.cjs.js'); }).then((m) => m.default)));
262
- program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-e811e67f.cjs.js'); }).then((m) => m.default)));
263
- 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-8b1beb58.cjs.js'); }).then((m) => m.default)));
235
+ 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-e1cfa92a.cjs.js'); }).then((m) => m.default)));
236
+ 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-90512169.cjs.js'); }).then((m) => m.default)));
237
+ program.command("backend:build").description("Build a backend plugin").option("--minify", "Minify the generated code").option("--experimental-type-build", "Enable experimental type build").action(lazy(() => Promise.resolve().then(function () { return require('./build-5e469530.cjs.js'); }).then((m) => m.default)));
238
+ 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-2cb505f3.cjs.js'); }).then((m) => m.default)));
239
+ 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-558ef0c6.cjs.js'); }).then((m) => m.default)));
240
+ 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-8dc87021.cjs.js'); }).then((m) => m.default)));
241
+ 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-f480902b.cjs.js'); }).then((m) => m.default)));
242
+ program.command("remove-plugin").description("[DEPRECATED] - Removes plugin in the current repository").action(lazy(() => Promise.resolve().then(function () { return require('./removePlugin-350b9293.cjs.js'); }).then((m) => m.default)));
243
+ program.command("plugin:build").description("Build a plugin").option("--minify", "Minify the generated code").option("--experimental-type-build", "Enable experimental type build").action(lazy(() => Promise.resolve().then(function () { return require('./build-41b160e1.cjs.js'); }).then((m) => m.default)));
244
+ 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-d962519a.cjs.js'); }).then((m) => m.default)));
245
+ 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-7382e071.cjs.js'); }).then((m) => m.default)));
246
+ 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").option("--experimental-type-build", "Enable experimental type build").action(lazy(() => Promise.resolve().then(function () { return require('./build-6a564e18.cjs.js'); }).then((m) => m.default)));
247
+ 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-5aa2e47f.cjs.js'); }).then((m) => m.default)));
248
+ 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-0e57c1d2.cjs.js'); }).then((m) => m.default)));
249
+ 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-a44be9cd.cjs.js'); }).then((m) => m.default)));
250
+ 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-207cc148.cjs.js'); }).then((m) => m.default)));
251
+ 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("--deprecated", "Output deprecated configuration settings").option(...configOption).description("Validate that the given configuration loads and matches schema").action(lazy(() => Promise.resolve().then(function () { return require('./validate-878f8022.cjs.js'); }).then((m) => m.default)));
252
+ 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-aa853b70.cjs.js'); }).then((m) => m.default)));
253
+ 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-0d4c7e07.cjs.js'); }).then((m) => m.default)));
254
+ 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-25eb1889.cjs.js'); }).then((m) => m.default)));
255
+ program.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack-a5e15cdb.cjs.js'); }).then((m) => m.pre)));
256
+ program.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack-a5e15cdb.cjs.js'); }).then((m) => m.post)));
257
+ program.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean-265d3ed5.cjs.js'); }).then((m) => m.default)));
258
+ 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-b198351d.cjs.js'); }).then((m) => m.default)));
259
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./index-63774350.cjs.js'); }).then((m) => m.default)));
260
+ program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info-643074cc.cjs.js'); }).then((m) => m.default)));
261
+ 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-c8b107f7.cjs.js'); }).then((m) => m.default)));
264
262
  }
265
263
  function lazy(getActionFunc) {
266
264
  return async (...args) => {
@@ -304,4 +302,4 @@ exports.devDependencies = devDependencies;
304
302
  exports.paths = paths;
305
303
  exports.version = version;
306
304
  exports.version$1 = version$8;
307
- //# sourceMappingURL=index-bd3b0c1e.cjs.js.map
305
+ //# sourceMappingURL=index-92454bcd.cjs.js.map
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-bd3b0c1e.cjs.js');
3
+ var index = require('./index-92454bcd.cjs.js');
4
4
  var os = require('os');
5
- var run = require('./run-d9adcdf0.cjs.js');
5
+ var run = require('./run-ad69ea39.cjs.js');
6
6
  var Lockfile = require('./Lockfile-35661afa.cjs.js');
7
7
  require('minimatch');
8
+ require('@manypkg/get-packages');
8
9
  require('chalk');
9
10
  require('commander');
10
11
  require('fs-extra');
@@ -42,4 +43,4 @@ var info = async () => {
42
43
  };
43
44
 
44
45
  exports["default"] = info;
45
- //# sourceMappingURL=info-e811e67f.cjs.js.map
46
+ //# sourceMappingURL=info-643074cc.cjs.js.map
@@ -3,13 +3,14 @@
3
3
  var fs = require('fs-extra');
4
4
  require('semver');
5
5
  require('@yarnpkg/lockfile');
6
- var packages = require('./packages-5024d195.cjs.js');
7
- var index = require('./index-bd3b0c1e.cjs.js');
6
+ var packages = require('./packages-435d71fd.cjs.js');
7
+ var index = require('./index-92454bcd.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-d9adcdf0.cjs.js');
11
+ var run = require('./run-ad69ea39.cjs.js');
12
12
  require('minimatch');
13
+ require('@manypkg/get-packages');
13
14
  require('commander');
14
15
  require('@backstage/cli-common');
15
16
  require('@backstage/config/package.json');
@@ -239,4 +240,4 @@ var install = async (pluginId, cmd) => {
239
240
  };
240
241
 
241
242
  exports["default"] = install;
242
- //# sourceMappingURL=install-8b1beb58.cjs.js.map
243
+ //# sourceMappingURL=install-c8b107f7.cjs.js.map
@@ -2,9 +2,10 @@
2
2
 
3
3
  var Lockfile = require('./Lockfile-35661afa.cjs.js');
4
4
  require('minimatch');
5
- require('./run-d9adcdf0.cjs.js');
5
+ require('@manypkg/get-packages');
6
+ require('./run-ad69ea39.cjs.js');
6
7
  require('chalk');
7
- var index = require('./index-bd3b0c1e.cjs.js');
8
+ var index = require('./index-92454bcd.cjs.js');
8
9
  var partition = require('lodash/partition');
9
10
  require('fs-extra');
10
11
  require('semver');
@@ -75,4 +76,4 @@ function logArray(arr, header, each) {
75
76
  exports["default"] = lint;
76
77
  exports.forbiddenDuplicatesFilter = forbiddenDuplicatesFilter;
77
78
  exports.includedFilter = includedFilter;
78
- //# sourceMappingURL=lint-68e81c10.cjs.js.map
79
+ //# sourceMappingURL=lint-25eb1889.cjs.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var run = require('./run-d9adcdf0.cjs.js');
4
- var index = require('./index-bd3b0c1e.cjs.js');
3
+ var run = require('./run-ad69ea39.cjs.js');
4
+ var index = require('./index-92454bcd.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-1b0b6806.cjs.js.map
29
+ //# sourceMappingURL=lint-5aa2e47f.cjs.js.map
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs-extra');
4
+ var index = require('./index-92454bcd.cjs.js');
5
+ var path = require('path');
6
+ require('commander');
7
+ require('chalk');
8
+ require('semver');
9
+ require('@backstage/cli-common');
10
+ require('@backstage/config/package.json');
11
+ require('@backstage/errors');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
16
+
17
+ const SKIPPED_KEYS = ["access", "registry", "tag", "alphaTypes", "betaTypes"];
18
+ const PKG_PATH = "package.json";
19
+ const PKG_BACKUP_PATH = "package.json-prepack";
20
+ async function writeReleaseStageEntrypoint(pkg, stage) {
21
+ await fs__default["default"].ensureDir(index.paths.resolveTarget(stage));
22
+ await fs__default["default"].writeJson(index.paths.resolveTarget(stage, PKG_PATH), {
23
+ name: pkg.name,
24
+ version: pkg.version,
25
+ main: (pkg.publishConfig.main || pkg.main) && "..",
26
+ module: (pkg.publishConfig.module || pkg.module) && "..",
27
+ browser: (pkg.publishConfig.browser || pkg.browser) && "..",
28
+ types: path.join("..", pkg.publishConfig[`${stage}Types`])
29
+ }, { encoding: "utf8", spaces: 2 });
30
+ }
31
+ const pre = async () => {
32
+ var _a;
33
+ const pkgPath = index.paths.resolveTarget(PKG_PATH);
34
+ const pkgContent = await fs__default["default"].readFile(pkgPath, "utf8");
35
+ const pkg = JSON.parse(pkgContent);
36
+ await fs__default["default"].writeFile(PKG_BACKUP_PATH, pkgContent);
37
+ const publishConfig = (_a = pkg.publishConfig) != null ? _a : {};
38
+ for (const key of Object.keys(publishConfig)) {
39
+ if (!SKIPPED_KEYS.includes(key)) {
40
+ pkg[key] = publishConfig[key];
41
+ }
42
+ }
43
+ await fs__default["default"].writeJson(pkgPath, pkg, { encoding: "utf8", spaces: 2 });
44
+ if (publishConfig.alphaTypes) {
45
+ await writeReleaseStageEntrypoint(pkg, "alpha");
46
+ }
47
+ if (publishConfig.betaTypes) {
48
+ await writeReleaseStageEntrypoint(pkg, "beta");
49
+ }
50
+ };
51
+ const post = async () => {
52
+ var _a, _b;
53
+ try {
54
+ await fs__default["default"].move(PKG_BACKUP_PATH, PKG_PATH, { overwrite: true });
55
+ const pkg = await fs__default["default"].readJson(PKG_PATH);
56
+ if ((_a = pkg.publishConfig) == null ? void 0 : _a.alphaTypes) {
57
+ await fs__default["default"].remove(index.paths.resolveTarget("alpha"));
58
+ }
59
+ if ((_b = pkg.publishConfig) == null ? void 0 : _b.betaTypes) {
60
+ await fs__default["default"].remove(index.paths.resolveTarget("beta"));
61
+ }
62
+ } catch (error) {
63
+ console.warn(`Failed to restore package.json during postpack, ${error}. Your package will be fine but you may have ended up with some garbage in the repo.`);
64
+ }
65
+ };
66
+
67
+ exports.post = post;
68
+ exports.pre = pre;
69
+ //# sourceMappingURL=pack-a5e15cdb.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-bd3b0c1e.cjs.js');
7
+ var index = require('./index-92454bcd.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');
@@ -95,7 +95,7 @@ var Output = /* @__PURE__ */ ((Output2) => {
95
95
  return Output2;
96
96
  })(Output || {});
97
97
 
98
- const makeConfigs = async (options) => {
98
+ async function makeRollupConfigs(options) {
99
99
  const configs = new Array();
100
100
  if (options.outputs.has(Output.cjs) || options.outputs.has(Output.esm)) {
101
101
  const output = new Array();
@@ -161,7 +161,7 @@ const makeConfigs = async (options) => {
161
161
  ]
162
162
  });
163
163
  }
164
- if (options.outputs.has(Output.types)) {
164
+ if (options.outputs.has(Output.types) && !options.useApiExtractor) {
165
165
  const typesInput = index.paths.resolveTargetRoot("dist-types", path.relative(index.paths.targetRoot, index.paths.targetDir), "src/index.d.ts");
166
166
  const declarationsExist = await fs__default["default"].pathExists(typesInput);
167
167
  if (!declarationsExist) {
@@ -178,7 +178,96 @@ const makeConfigs = async (options) => {
178
178
  });
179
179
  }
180
180
  return configs;
181
- };
181
+ }
182
+
183
+ const ignoredMessages = /* @__PURE__ */ new Set(["tsdoc-undefined-tag", "ae-forgotten-export"]);
184
+ let apiExtractor;
185
+ function prepareApiExtractor() {
186
+ if (apiExtractor) {
187
+ return apiExtractor;
188
+ }
189
+ try {
190
+ apiExtractor = require("@microsoft/api-extractor");
191
+ } catch (error) {
192
+ throw new Error("Failed to resolve @microsoft/api-extractor, it must best installed as a dependency of your project in order to use experimental type builds");
193
+ }
194
+ const {
195
+ PackageJsonLookup
196
+ } = require("@rushstack/node-core-library/lib/PackageJsonLookup");
197
+ const old = PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor;
198
+ PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor = function tryGetPackageJsonFilePathForPatch(path$1) {
199
+ if (path$1.includes("@material-ui") && !path.dirname(path$1).endsWith("@material-ui")) {
200
+ return void 0;
201
+ }
202
+ return old.call(this, path$1);
203
+ };
204
+ return apiExtractor;
205
+ }
206
+ async function buildTypeDefinitions() {
207
+ const { Extractor, ExtractorConfig } = prepareApiExtractor();
208
+ const distTypesPackageDir = index.paths.resolveTargetRoot("dist-types", path.relative(index.paths.targetRoot, index.paths.targetDir));
209
+ const entryPoint = path.resolve(distTypesPackageDir, "src/index.d.ts");
210
+ const declarationsExist = await fs__default["default"].pathExists(entryPoint);
211
+ if (!declarationsExist) {
212
+ const path$1 = path.relative(index.paths.targetDir, entryPoint);
213
+ throw new Error(`No declaration files found at ${path$1}, be sure to run ${chalk__default["default"].bgRed.white("yarn tsc")} to generate .d.ts files before packaging`);
214
+ }
215
+ const extractorConfig = ExtractorConfig.prepare({
216
+ configObject: {
217
+ mainEntryPointFilePath: entryPoint,
218
+ bundledPackages: [],
219
+ compiler: {
220
+ skipLibCheck: true,
221
+ tsconfigFilePath: index.paths.resolveTargetRoot("tsconfig.json")
222
+ },
223
+ dtsRollup: {
224
+ enabled: true,
225
+ untrimmedFilePath: index.paths.resolveTarget("dist/index.alpha.d.ts"),
226
+ betaTrimmedFilePath: index.paths.resolveTarget("dist/index.beta.d.ts"),
227
+ publicTrimmedFilePath: index.paths.resolveTarget("dist/index.d.ts")
228
+ },
229
+ newlineKind: "lf",
230
+ projectFolder: index.paths.targetDir
231
+ },
232
+ configObjectFullPath: index.paths.targetDir,
233
+ packageJsonFullPath: index.paths.resolveTarget("package.json")
234
+ });
235
+ const typescriptDir = index.paths.resolveTargetRoot("node_modules/typescript");
236
+ const hasTypescript = await fs__default["default"].pathExists(typescriptDir);
237
+ const extractorResult = Extractor.invoke(extractorConfig, {
238
+ typescriptCompilerFolder: hasTypescript ? typescriptDir : void 0,
239
+ localBuild: false,
240
+ showVerboseMessages: false,
241
+ showDiagnostics: false,
242
+ messageCallback(message) {
243
+ message.handled = true;
244
+ if (ignoredMessages.has(message.messageId)) {
245
+ return;
246
+ }
247
+ let text = `${message.text} (${message.messageId})`;
248
+ if (message.sourceFilePath) {
249
+ text += " at ";
250
+ text += path.relative(distTypesPackageDir, message.sourceFilePath);
251
+ if (message.sourceFileLine) {
252
+ text += `:${message.sourceFileLine}`;
253
+ if (message.sourceFileColumn) {
254
+ text += `:${message.sourceFileColumn}`;
255
+ }
256
+ }
257
+ }
258
+ if (message.logLevel === "error") {
259
+ console.error(chalk__default["default"].red(`Error: ${text}`));
260
+ } else if (message.logLevel === "warning" || message.category === "Extractor") {
261
+ console.warn(`Warning: ${text}`);
262
+ } else {
263
+ console.log(text);
264
+ }
265
+ }
266
+ });
267
+ if (!extractorResult.succeeded) {
268
+ throw new Error(`Type definition build completed with ${extractorResult.errorCount} errors and ${extractorResult.warningCount} warnings`);
269
+ }
270
+ }
182
271
 
183
272
  function formatErrorMessage(error) {
184
273
  var _a;
@@ -228,7 +317,7 @@ function formatErrorMessage(error) {
228
317
  }
229
318
  return msg;
230
319
  }
231
- async function build(config) {
320
+ async function rollupBuild(config) {
232
321
  try {
233
322
  const bundle = await rollup.rollup(config);
234
323
  if (config.output) {
@@ -249,11 +338,15 @@ const buildPackage = async (options) => {
249
338
  }
250
339
  } catch {
251
340
  }
252
- const configs = await makeConfigs(options);
341
+ const rollupConfigs = await makeRollupConfigs(options);
253
342
  await fs__default["default"].remove(index.paths.resolveTarget("dist"));
254
- await Promise.all(configs.map(build));
343
+ const buildTasks = rollupConfigs.map(rollupBuild);
344
+ if (options.outputs.has(Output.types) && options.useApiExtractor) {
345
+ buildTasks.push(buildTypeDefinitions());
346
+ }
347
+ await Promise.all(buildTasks);
255
348
  };
256
349
 
257
350
  exports.Output = Output;
258
351
  exports.buildPackage = buildPackage;
259
- //# sourceMappingURL=packager-e08008bd.cjs.js.map
352
+ //# sourceMappingURL=packager-052876f4.cjs.js.map