@backstage/cli 0.28.0-next.0 → 0.28.0-next.2

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 (131) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/config/jest.js +123 -69
  3. package/config/jestCacheResultProcessor.cjs +23 -0
  4. package/config/jestSwcTransform.js +4 -1
  5. package/dist/commands/build/buildBackend.cjs.js +65 -0
  6. package/dist/commands/build/buildFrontend.cjs.js +56 -0
  7. package/dist/commands/build/command.cjs.js +72 -0
  8. package/dist/commands/build/index.cjs.js +8 -0
  9. package/dist/commands/buildWorkspace.cjs.js +24 -0
  10. package/dist/commands/clean/clean.cjs.js +19 -0
  11. package/dist/{cjs/docs-CDE82fWG.cjs.js → commands/config/docs.cjs.js} +4 -12
  12. package/dist/{cjs/print-BX8-7Nzg.cjs.js → commands/config/print.cjs.js} +4 -12
  13. package/dist/{cjs/schema-Cabm6I6c.cjs.js → commands/config/schema.cjs.js} +4 -12
  14. package/dist/commands/config/validate.cjs.js +19 -0
  15. package/dist/{cjs/index-DVDDx3pk.cjs.js → commands/create-github-app/GithubCreateAppServer.cjs.js} +2 -110
  16. package/dist/commands/create-github-app/index.cjs.js +117 -0
  17. package/dist/commands/index.cjs.js +231 -0
  18. package/dist/{cjs/info-CB7ln5K_.cjs.js → commands/info.cjs.js} +13 -17
  19. package/dist/{cjs/lint-6_0f9f26.cjs.js → commands/lint.cjs.js} +10 -10
  20. package/dist/commands/migrate/packageExports.cjs.js +17 -0
  21. package/dist/{cjs/packageLintConfigs-BBvQehRd.cjs.js → commands/migrate/packageLintConfigs.cjs.js} +2 -10
  22. package/dist/{cjs/packageRole-CkpKfhJA.cjs.js → commands/migrate/packageRole.cjs.js} +5 -8
  23. package/dist/{cjs/packageScripts-DX6dilK6.cjs.js → commands/migrate/packageScripts.cjs.js} +1 -1
  24. package/dist/{cjs/reactRouterDeps-CR-hjviw.cjs.js → commands/migrate/reactRouterDeps.cjs.js} +1 -1
  25. package/dist/commands/new/new.cjs.js +101 -0
  26. package/dist/commands/pack.cjs.js +29 -0
  27. package/dist/commands/repo/build.cjs.js +113 -0
  28. package/dist/{cjs/clean-bdpRw-oZ.cjs.js → commands/repo/clean.cjs.js} +5 -10
  29. package/dist/{cjs/fix-BTjof5XT.cjs.js → commands/repo/fix.cjs.js} +8 -13
  30. package/dist/commands/repo/lint.cjs.js +193 -0
  31. package/dist/{cjs/list-deprecations-DFgQENam.cjs.js → commands/repo/list-deprecations.cjs.js} +7 -12
  32. package/dist/commands/repo/optionsParser.cjs.js +37 -0
  33. package/dist/commands/repo/test.cjs.js +274 -0
  34. package/dist/commands/start/command.cjs.js +48 -0
  35. package/dist/commands/start/index.cjs.js +8 -0
  36. package/dist/commands/start/startBackend.cjs.js +112 -0
  37. package/dist/commands/start/startFrontend.cjs.js +47 -0
  38. package/dist/{cjs/test-YJMOGqXG.cjs.js → commands/test.cjs.js} +6 -12
  39. package/dist/{cjs/bump-d9dS56p9.cjs.js → commands/versions/bump.cjs.js} +21 -190
  40. package/dist/commands/versions/migrate.cjs.js +112 -0
  41. package/dist/index.cjs.js +29 -7
  42. package/dist/lib/builder/config.cjs.js +199 -0
  43. package/dist/lib/builder/packager.cjs.js +131 -0
  44. package/dist/lib/builder/plugins.cjs.js +71 -0
  45. package/dist/lib/builder/types.cjs.js +11 -0
  46. package/dist/lib/bundler/LinkedPackageResolvePlugin.cjs.js +47 -0
  47. package/dist/lib/bundler/backend.cjs.js +36 -0
  48. package/dist/{cjs/buildBackend-DXvz7jvh.cjs.js → lib/bundler/bundle.cjs.js} +26 -113
  49. package/dist/lib/bundler/config.cjs.js +469 -0
  50. package/dist/lib/bundler/hasReactDomClient.cjs.js +13 -0
  51. package/dist/lib/bundler/moduleFederation.cjs.js +28 -0
  52. package/dist/lib/bundler/optimization.cjs.js +63 -0
  53. package/dist/lib/bundler/packageDetection.cjs.js +117 -0
  54. package/dist/lib/bundler/paths.cjs.js +60 -0
  55. package/dist/lib/bundler/server.cjs.js +246 -0
  56. package/dist/lib/bundler/transforms.cjs.js +171 -0
  57. package/dist/lib/codeowners/codeowners.cjs.js +92 -0
  58. package/dist/{cjs/config-nCB2LQK-.cjs.js → lib/config.cjs.js} +6 -6
  59. package/dist/{cjs/entryPoints-CoHH4lBA.cjs.js → lib/entryPoints.cjs.js} +4 -1
  60. package/dist/lib/errors.cjs.js +45 -0
  61. package/dist/lib/experimental/IpcServer.cjs.js +60 -0
  62. package/dist/lib/experimental/ServerDataStore.cjs.js +36 -0
  63. package/dist/lib/experimental/startBackendExperimental.cjs.js +128 -0
  64. package/dist/lib/new/FactoryRegistry.cjs.js +96 -0
  65. package/dist/lib/new/factories/backendModule.cjs.js +82 -0
  66. package/dist/lib/new/factories/backendPlugin.cjs.js +78 -0
  67. package/dist/lib/new/factories/common/prompts.cjs.js +57 -0
  68. package/dist/lib/new/factories/common/tasks.cjs.js +66 -0
  69. package/dist/lib/new/factories/common/util.cjs.js +16 -0
  70. package/dist/lib/new/factories/frontendPlugin.cjs.js +107 -0
  71. package/dist/lib/new/factories/index.cjs.js +24 -0
  72. package/dist/lib/new/factories/nodeLibraryPackage.cjs.js +57 -0
  73. package/dist/lib/new/factories/pluginCommon.cjs.js +58 -0
  74. package/dist/lib/new/factories/pluginNode.cjs.js +58 -0
  75. package/dist/lib/new/factories/pluginWeb.cjs.js +58 -0
  76. package/dist/lib/new/factories/scaffolderModule.cjs.js +90 -0
  77. package/dist/lib/new/factories/webLibraryPackage.cjs.js +57 -0
  78. package/dist/lib/new/types.cjs.js +8 -0
  79. package/dist/lib/packager/createDistWorkspace.cjs.js +219 -0
  80. package/dist/{cjs/productionPack-Dfl28j3c.cjs.js → lib/packager/productionPack.cjs.js} +8 -96
  81. package/dist/{cjs/parallel-BszNaKyc.cjs.js → lib/parallel.cjs.js} +2 -1
  82. package/dist/lib/paths.cjs.js +8 -0
  83. package/dist/{cjs/publishing-DQtsKTbc.cjs.js → lib/publishing.cjs.js} +1 -1
  84. package/dist/{cjs/role-e0emQj8q.cjs.js → lib/role.cjs.js} +3 -3
  85. package/dist/{cjs/run-HW3lfDbM.cjs.js → lib/run.cjs.js} +6 -5
  86. package/dist/{cjs/svgrTemplate-BTjBQ3by.cjs.js → lib/svgrTemplate.cjs.js} +1 -1
  87. package/dist/lib/tasks.cjs.js +188 -0
  88. package/dist/lib/typeDistProject.cjs.js +94 -0
  89. package/dist/lib/urls.cjs.js +13 -0
  90. package/dist/lib/version.cjs.js +86 -0
  91. package/dist/{cjs/yarn-6FNAgNBK.cjs.js → lib/versioning/Lockfile.cjs.js} +1 -31
  92. package/dist/lib/versioning/packages.cjs.js +75 -0
  93. package/dist/lib/yarn.cjs.js +34 -0
  94. package/dist/packages/backend-defaults/package.json.cjs.js +6 -0
  95. package/dist/packages/backend-plugin-api/package.json.cjs.js +6 -0
  96. package/dist/packages/backend-test-utils/package.json.cjs.js +6 -0
  97. package/dist/packages/cli/package.json.cjs.js +159 -0
  98. package/dist/packages/config/package.json.cjs.js +6 -0
  99. package/dist/packages/core-app-api/package.json.cjs.js +6 -0
  100. package/dist/packages/core-components/package.json.cjs.js +6 -0
  101. package/dist/packages/core-plugin-api/package.json.cjs.js +6 -0
  102. package/dist/packages/dev-utils/package.json.cjs.js +6 -0
  103. package/dist/packages/test-utils/package.json.cjs.js +6 -0
  104. package/dist/packages/theme/package.json.cjs.js +6 -0
  105. package/dist/plugins/auth-backend/package.json.cjs.js +6 -0
  106. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +6 -0
  107. package/dist/plugins/scaffolder-node/package.json.cjs.js +6 -0
  108. package/package.json +23 -23
  109. package/dist/cjs/build-gNEKjjhr.cjs.js +0 -194
  110. package/dist/cjs/buildWorkspace-DLfI3EjD.cjs.js +0 -53
  111. package/dist/cjs/clean-Dpgqc3P2.cjs.js +0 -22
  112. package/dist/cjs/createDistWorkspace-DKzy-L-f.cjs.js +0 -576
  113. package/dist/cjs/index-7LxfekFu.cjs.js +0 -625
  114. package/dist/cjs/index-DsP5wbju.cjs.js +0 -131
  115. package/dist/cjs/index-v57xnvgT.cjs.js +0 -520
  116. package/dist/cjs/lint-DYO_SeK3.cjs.js +0 -91
  117. package/dist/cjs/moduleFederation-Dq0n1quT.cjs.js +0 -910
  118. package/dist/cjs/new-C0D_k25O.cjs.js +0 -1043
  119. package/dist/cjs/pack-D8AK7Uem.cjs.js +0 -34
  120. package/dist/cjs/packageExports-bg4mFuFZ.cjs.js +0 -27
  121. package/dist/cjs/test-5bQM0VRL.cjs.js +0 -126
  122. package/dist/cjs/validate-DKBlShmI.cjs.js +0 -28
  123. /package/templates/default-backend-module/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  124. /package/templates/default-backend-plugin/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  125. /package/templates/default-common-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  126. /package/templates/default-node-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  127. /package/templates/default-plugin/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  128. /package/templates/default-react-plugin-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  129. /package/templates/node-library-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  130. /package/templates/scaffolder-module/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
  131. /package/templates/web-library-package/{.eslintrc.js → .eslintrc.js.hbs} +0 -0
@@ -1,18 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var yaml = require('yaml');
4
- var config = require('./config-nCB2LQK-.cjs.js');
6
+ var config = require('../../lib/config.cjs.js');
5
7
  var configLoader = require('@backstage/config-loader');
6
- require('@backstage/config');
7
- require('./index-v57xnvgT.cjs.js');
8
- require('commander');
9
- require('chalk');
10
- require('fs-extra');
11
- require('semver');
12
- require('@backstage/cli-common');
13
- require('@backstage/errors');
14
- require('@manypkg/get-packages');
15
- require('@backstage/cli-node');
16
8
 
17
9
  var schema = async (opts) => {
18
10
  const { schema } = await config.loadCliConfig({
@@ -42,4 +34,4 @@ var schema = async (opts) => {
42
34
  };
43
35
 
44
36
  exports.default = schema;
45
- //# sourceMappingURL=schema-Cabm6I6c.cjs.js.map
37
+ //# sourceMappingURL=schema.cjs.js.map
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var config = require('../../lib/config.cjs.js');
6
+
7
+ var validate = async (opts) => {
8
+ await config.loadCliConfig({
9
+ args: opts.config,
10
+ fromPackage: opts.package,
11
+ mockEnv: opts.lax,
12
+ fullVisibility: !opts.frontend,
13
+ withDeprecatedKeys: opts.deprecated,
14
+ strict: opts.strict
15
+ });
16
+ };
17
+
18
+ exports.default = validate;
19
+ //# sourceMappingURL=validate.cjs.js.map
@@ -1,29 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var fs = require('fs-extra');
4
- var chalk = require('chalk');
5
- var yaml = require('yaml');
6
- var inquirer = require('inquirer');
7
- var index$1 = require('./index-v57xnvgT.cjs.js');
8
3
  var crypto = require('crypto');
9
4
  var openBrowser = require('react-dev-utils/openBrowser');
10
5
  var request = require('@octokit/request');
11
6
  var express = require('express');
12
- var fetch = require('node-fetch');
13
- require('commander');
14
- require('semver');
15
- require('@backstage/cli-common');
16
- require('@backstage/errors');
17
7
 
18
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
19
9
 
20
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
21
- var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
22
- var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
23
10
  var crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
24
11
  var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
25
12
  var express__default = /*#__PURE__*/_interopDefaultCompat(express);
26
- var fetch__default = /*#__PURE__*/_interopDefaultCompat(fetch);
27
13
 
28
14
  const FORM_PAGE = `
29
15
  <html>
@@ -135,99 +121,5 @@ class GithubCreateAppServer {
135
121
  }
136
122
  }
137
123
 
138
- var index = async (org) => {
139
- const answers = await inquirer__default.default.prompt({
140
- name: "appType",
141
- type: "checkbox",
142
- message: "Select permissions [required] (these can be changed later but then require approvals in all installations)",
143
- choices: [
144
- {
145
- name: "Read access to content (required by Software Catalog to ingest data from repositories)",
146
- value: "read",
147
- checked: true
148
- },
149
- {
150
- name: "Read access to members (required by Software Catalog to ingest GitHub teams)",
151
- value: "members",
152
- checked: true
153
- },
154
- {
155
- name: "Read and Write to content and actions (required by Software Templates to create new repositories)",
156
- value: "write"
157
- }
158
- ]
159
- });
160
- if (answers.appType.length === 0) {
161
- console.log(chalk__default.default.red("You must select at least one permission"));
162
- process.exit(1);
163
- }
164
- await verifyGithubOrg(org);
165
- const { slug, name, ...config } = await GithubCreateAppServer.run({
166
- org,
167
- permissions: answers.appType
168
- });
169
- const fileName = `github-app-${slug}-credentials.yaml`;
170
- const content = `# Name: ${name}
171
- ${yaml.stringify(config)}`;
172
- await fs__default.default.writeFile(index$1.paths.resolveTargetRoot(fileName), content);
173
- console.log(`GitHub App configuration written to ${chalk__default.default.cyan(fileName)}`);
174
- console.log(
175
- chalk__default.default.yellow(
176
- "This file contains sensitive credentials, it should not be committed to version control and handled with care!"
177
- )
178
- );
179
- console.log(
180
- "Here's an example on how to update the integrations section in app-config.yaml"
181
- );
182
- console.log(
183
- chalk__default.default.green(`
184
- integrations:
185
- github:
186
- - host: github.com
187
- apps:
188
- - $include: ${fileName}`)
189
- );
190
- };
191
- async function verifyGithubOrg(org) {
192
- let response;
193
- try {
194
- response = await fetch__default.default(
195
- `https://api.github.com/orgs/${encodeURIComponent(org)}`
196
- );
197
- } catch (e) {
198
- console.log(
199
- chalk__default.default.yellow(
200
- "Warning: Unable to verify existence of GitHub organization. ",
201
- e
202
- )
203
- );
204
- }
205
- if (response?.status === 404) {
206
- const questions = [
207
- {
208
- type: "confirm",
209
- name: "shouldCreateOrg",
210
- message: `GitHub organization ${chalk__default.default.cyan(
211
- org
212
- )} does not exist. Would you like to create a new Organization instead?`
213
- }
214
- ];
215
- const answers = await inquirer__default.default.prompt(questions);
216
- if (!answers.shouldCreateOrg) {
217
- console.log(
218
- chalk__default.default.yellow("GitHub organization must exist to create GitHub app")
219
- );
220
- process.exit(1);
221
- }
222
- openBrowser__default.default("https://github.com/account/organizations/new");
223
- console.log(
224
- chalk__default.default.yellow(
225
- "Please re-run this command when you have created your new organization"
226
- )
227
- );
228
- process.exit(0);
229
- }
230
- }
231
-
232
- exports.default = index;
233
- //# sourceMappingURL=index-DVDDx3pk.cjs.js.map
124
+ exports.GithubCreateAppServer = GithubCreateAppServer;
125
+ //# sourceMappingURL=GithubCreateAppServer.cjs.js.map
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var fs = require('fs-extra');
6
+ var chalk = require('chalk');
7
+ var yaml = require('yaml');
8
+ var inquirer = require('inquirer');
9
+ var paths = require('../../lib/paths.cjs.js');
10
+ var GithubCreateAppServer = require('./GithubCreateAppServer.cjs.js');
11
+ var fetch = require('node-fetch');
12
+ var openBrowser = require('react-dev-utils/openBrowser');
13
+
14
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
+
16
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
17
+ var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
18
+ var inquirer__default = /*#__PURE__*/_interopDefaultCompat(inquirer);
19
+ var fetch__default = /*#__PURE__*/_interopDefaultCompat(fetch);
20
+ var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
21
+
22
+ var index = async (org) => {
23
+ const answers = await inquirer__default.default.prompt({
24
+ name: "appType",
25
+ type: "checkbox",
26
+ message: "Select permissions [required] (these can be changed later but then require approvals in all installations)",
27
+ choices: [
28
+ {
29
+ name: "Read access to content (required by Software Catalog to ingest data from repositories)",
30
+ value: "read",
31
+ checked: true
32
+ },
33
+ {
34
+ name: "Read access to members (required by Software Catalog to ingest GitHub teams)",
35
+ value: "members",
36
+ checked: true
37
+ },
38
+ {
39
+ name: "Read and Write to content and actions (required by Software Templates to create new repositories)",
40
+ value: "write"
41
+ }
42
+ ]
43
+ });
44
+ if (answers.appType.length === 0) {
45
+ console.log(chalk__default.default.red("You must select at least one permission"));
46
+ process.exit(1);
47
+ }
48
+ await verifyGithubOrg(org);
49
+ const { slug, name, ...config } = await GithubCreateAppServer.GithubCreateAppServer.run({
50
+ org,
51
+ permissions: answers.appType
52
+ });
53
+ const fileName = `github-app-${slug}-credentials.yaml`;
54
+ const content = `# Name: ${name}
55
+ ${yaml.stringify(config)}`;
56
+ await fs__default.default.writeFile(paths.paths.resolveTargetRoot(fileName), content);
57
+ console.log(`GitHub App configuration written to ${chalk__default.default.cyan(fileName)}`);
58
+ console.log(
59
+ chalk__default.default.yellow(
60
+ "This file contains sensitive credentials, it should not be committed to version control and handled with care!"
61
+ )
62
+ );
63
+ console.log(
64
+ "Here's an example on how to update the integrations section in app-config.yaml"
65
+ );
66
+ console.log(
67
+ chalk__default.default.green(`
68
+ integrations:
69
+ github:
70
+ - host: github.com
71
+ apps:
72
+ - $include: ${fileName}`)
73
+ );
74
+ };
75
+ async function verifyGithubOrg(org) {
76
+ let response;
77
+ try {
78
+ response = await fetch__default.default(
79
+ `https://api.github.com/orgs/${encodeURIComponent(org)}`
80
+ );
81
+ } catch (e) {
82
+ console.log(
83
+ chalk__default.default.yellow(
84
+ "Warning: Unable to verify existence of GitHub organization. ",
85
+ e
86
+ )
87
+ );
88
+ }
89
+ if (response?.status === 404) {
90
+ const questions = [
91
+ {
92
+ type: "confirm",
93
+ name: "shouldCreateOrg",
94
+ message: `GitHub organization ${chalk__default.default.cyan(
95
+ org
96
+ )} does not exist. Would you like to create a new Organization instead?`
97
+ }
98
+ ];
99
+ const answers = await inquirer__default.default.prompt(questions);
100
+ if (!answers.shouldCreateOrg) {
101
+ console.log(
102
+ chalk__default.default.yellow("GitHub organization must exist to create GitHub app")
103
+ );
104
+ process.exit(1);
105
+ }
106
+ openBrowser__default.default("https://github.com/account/organizations/new");
107
+ console.log(
108
+ chalk__default.default.yellow(
109
+ "Please re-run this command when you have created your new organization"
110
+ )
111
+ );
112
+ process.exit(0);
113
+ }
114
+ }
115
+
116
+ exports.default = index;
117
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1,231 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+ var errors$1 = require('../lib/errors.cjs.js');
5
+
6
+ const configOption = [
7
+ "--config <path>",
8
+ "Config files to load instead of app-config.yaml",
9
+ (opt, opts) => opts ? [...opts, opt] : [opt],
10
+ Array()
11
+ ];
12
+ function registerRepoCommand(program) {
13
+ const command = program.command("repo [command]").description("Command that run across an entire Backstage project");
14
+ command.command("build").description(
15
+ "Build packages in the project, excluding bundled app and backend packages."
16
+ ).option(
17
+ "--all",
18
+ "Build all packages, including bundled app and backend packages."
19
+ ).option(
20
+ "--since <ref>",
21
+ "Only build packages and their dev dependents that changed since the specified ref"
22
+ ).option(
23
+ "--minify",
24
+ "Minify the generated code. Does not apply to app package (app is minified by default)."
25
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./repo/build.cjs.js'); }).then((m) => m.command)));
26
+ command.command("lint").description("Lint all packages in the project").option(
27
+ "--format <format>",
28
+ "Lint report output format",
29
+ "eslint-formatter-friendly"
30
+ ).option(
31
+ "--since <ref>",
32
+ "Only lint packages that changed since the specified ref"
33
+ ).option(
34
+ "--successCache",
35
+ "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
36
+ ).option(
37
+ "--successCacheDir <path>",
38
+ "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
39
+ ).option("--fix", "Attempt to automatically fix violations").action(lazy(() => Promise.resolve().then(function () { return require('./repo/lint.cjs.js'); }).then((m) => m.command)));
40
+ command.command("fix").description("Automatically fix packages in the project").option(
41
+ "--publish",
42
+ "Enable additional fixes that only apply when publishing packages"
43
+ ).option(
44
+ "--check",
45
+ "Fail if any packages would have been changed by the command"
46
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./repo/fix.cjs.js'); }).then((m) => m.command)));
47
+ command.command("clean").description("Delete cache and output directories").action(lazy(() => Promise.resolve().then(function () { return require('./repo/clean.cjs.js'); }).then((m) => m.command)));
48
+ command.command("list-deprecations").description("List deprecations").option("--json", "Output as JSON").action(
49
+ lazy(() => Promise.resolve().then(function () { return require('./repo/list-deprecations.cjs.js'); }).then((m) => m.command))
50
+ );
51
+ command.command("test").allowUnknownOption(true).option(
52
+ "--since <ref>",
53
+ "Only test packages that changed since the specified ref"
54
+ ).option(
55
+ "--successCache",
56
+ "Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
57
+ ).option(
58
+ "--successCacheDir <path>",
59
+ "Set the success cache location, (default: node_modules/.cache/backstage-cli)"
60
+ ).option(
61
+ "--jest-help",
62
+ "Show help for Jest CLI options, which are passed through"
63
+ ).description("Run tests, forwarding args to Jest, defaulting to watch mode").action(lazy(() => Promise.resolve().then(function () { return require('./repo/test.cjs.js'); }).then((m) => m.command)));
64
+ }
65
+ function registerScriptCommand(program) {
66
+ const command = program.command("package [command]").description("Lifecycle scripts for individual packages");
67
+ command.command("start").description("Start a package for local development").option(...configOption).option("--role <name>", "Run the command with an explicit package role").option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
68
+ "--inspect-brk [host]",
69
+ "Enable debugger in Node.js environments, breaking before code starts"
70
+ ).option("--require <path>", "Add a --require argument to the node process").action(lazy(() => Promise.resolve().then(function () { return require('./start/index.cjs.js'); }).then((m) => m.command)));
71
+ command.command("build").description("Build a package for production deployment or publishing").option("--role <name>", "Run the command with an explicit package role").option(
72
+ "--minify",
73
+ "Minify the generated code. Does not apply to app package (app is minified by default)."
74
+ ).option(
75
+ "--skip-build-dependencies",
76
+ "Skip the automatic building of local dependencies. Applies to backend packages only."
77
+ ).option(
78
+ "--stats",
79
+ "If bundle stats are available, write them to the output directory. Applies to app packages only."
80
+ ).option(
81
+ "--config <path>",
82
+ "Config files to load instead of app-config.yaml. Applies to app packages only.",
83
+ (opt, opts) => opts ? [...opts, opt] : [opt],
84
+ Array()
85
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./build/index.cjs.js'); }).then((m) => m.command)));
86
+ command.command("lint [directories...]").option(
87
+ "--format <format>",
88
+ "Lint report output format",
89
+ "eslint-formatter-friendly"
90
+ ).option("--fix", "Attempt to automatically fix violations").option(
91
+ "--max-warnings <number>",
92
+ "Fail if more than this number of warnings (default: 0)"
93
+ ).description("Lint a package").action(lazy(() => Promise.resolve().then(function () { return require('./lint.cjs.js'); }).then((m) => m.default)));
94
+ command.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('./test.cjs.js'); }).then((m) => m.default)));
95
+ command.command("clean").description("Delete cache directories").action(lazy(() => Promise.resolve().then(function () { return require('./clean/clean.cjs.js'); }).then((m) => m.default)));
96
+ command.command("prepack").description("Prepares a package for packaging before publishing").action(lazy(() => Promise.resolve().then(function () { return require('./pack.cjs.js'); }).then((m) => m.pre)));
97
+ command.command("postpack").description("Restores the changes made by the prepack command").action(lazy(() => Promise.resolve().then(function () { return require('./pack.cjs.js'); }).then((m) => m.post)));
98
+ }
99
+ function registerMigrateCommand(program) {
100
+ const command = program.command("migrate [command]").description("Migration utilities");
101
+ command.command("package-roles").description(`Add package role field to packages that don't have it`).action(lazy(() => Promise.resolve().then(function () { return require('./migrate/packageRole.cjs.js'); }).then((m) => m.default)));
102
+ command.command("package-scripts").description("Set package scripts according to each package role").action(
103
+ lazy(() => Promise.resolve().then(function () { return require('./migrate/packageScripts.cjs.js'); }).then((m) => m.command))
104
+ );
105
+ command.command("package-exports").description("Synchronize package subpath export definitions").action(
106
+ lazy(() => Promise.resolve().then(function () { return require('./migrate/packageExports.cjs.js'); }).then((m) => m.command))
107
+ );
108
+ command.command("package-lint-configs").description(
109
+ "Migrates all packages to use @backstage/cli/config/eslint-factory"
110
+ ).action(
111
+ lazy(() => Promise.resolve().then(function () { return require('./migrate/packageLintConfigs.cjs.js'); }).then((m) => m.command))
112
+ );
113
+ command.command("react-router-deps").description(
114
+ "Migrates the react-router dependencies for all packages to be peer dependencies"
115
+ ).action(
116
+ lazy(() => Promise.resolve().then(function () { return require('./migrate/reactRouterDeps.cjs.js'); }).then((m) => m.command))
117
+ );
118
+ }
119
+ function registerCommands(program) {
120
+ program.command("new").storeOptionsAsProperties(false).description(
121
+ "Open up an interactive guide to creating new things in your app"
122
+ ).option(
123
+ "--select <name>",
124
+ "Select the thing you want to be creating upfront"
125
+ ).option(
126
+ "--option <name>=<value>",
127
+ "Pre-fill options for the creation process",
128
+ (opt, arr) => [...arr, opt],
129
+ []
130
+ ).option("--scope <scope>", "The scope to use for new packages").option(
131
+ "--npm-registry <URL>",
132
+ "The package registry to use for new packages"
133
+ ).option(
134
+ "--baseVersion <version>",
135
+ "The version to use for any new packages (default: 0.1.0)"
136
+ ).option(
137
+ "--license <license>",
138
+ "The license to use for any new packages (default: Apache-2.0)"
139
+ ).option("--no-private", "Do not mark new packages as private").action(lazy(() => Promise.resolve().then(function () { return require('./new/new.cjs.js'); }).then((m) => m.default)));
140
+ program.command("config:docs").option(
141
+ "--package <name>",
142
+ "Only include the schema that applies to the given package"
143
+ ).description("Browse the configuration reference documentation").action(lazy(() => Promise.resolve().then(function () { return require('./config/docs.cjs.js'); }).then((m) => m.default)));
144
+ program.command("config:print").option(
145
+ "--package <name>",
146
+ "Only load config schema that applies to the given package"
147
+ ).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(
148
+ "--format <format>",
149
+ "Format to print the configuration in, either json or yaml [yaml]"
150
+ ).option(...configOption).description("Print the app configuration for the current package").action(lazy(() => Promise.resolve().then(function () { return require('./config/print.cjs.js'); }).then((m) => m.default)));
151
+ program.command("config:check").option(
152
+ "--package <name>",
153
+ "Only load config schema that applies to the given package"
154
+ ).option("--lax", "Do not require environment variables to be set").option("--frontend", "Only validate the frontend configuration").option("--deprecated", "Output deprecated configuration settings").option(
155
+ "--strict",
156
+ "Enable strict config validation, forbidding errors and unknown keys"
157
+ ).option(...configOption).description(
158
+ "Validate that the given configuration loads and matches schema"
159
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./config/validate.cjs.js'); }).then((m) => m.default)));
160
+ program.command("config:schema").option(
161
+ "--package <name>",
162
+ "Only output config schema that applies to the given package"
163
+ ).option(
164
+ "--format <format>",
165
+ "Format to print the schema in, either json or yaml [yaml]"
166
+ ).option("--merge", "Print the config schemas merged", true).option("--no-merge", "Print the config schemas not merged").description("Print configuration schema").action(lazy(() => Promise.resolve().then(function () { return require('./config/schema.cjs.js'); }).then((m) => m.default)));
167
+ registerRepoCommand(program);
168
+ registerScriptCommand(program);
169
+ registerMigrateCommand(program);
170
+ program.command("versions:bump").option(
171
+ "--pattern <glob>",
172
+ "Override glob for matching packages to upgrade"
173
+ ).option(
174
+ "--release <version|next|main>",
175
+ "Bump to a specific Backstage release line or version",
176
+ "main"
177
+ ).option("--skip-install", "Skips yarn install step").option("--skip-migrate", "Skips migration of any moved packages").description("Bump Backstage packages to the latest versions").action(lazy(() => Promise.resolve().then(function () { return require('./versions/bump.cjs.js'); }).then((m) => m.default)));
178
+ program.command("versions:migrate").option(
179
+ "--pattern <glob>",
180
+ "Override glob for matching packages to upgrade"
181
+ ).option(
182
+ "--skip-code-changes",
183
+ "Skip code changes and only update package.json files"
184
+ ).description(
185
+ "Migrate any plugins that have been moved to the @backstage-community namespace automatically"
186
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./versions/migrate.cjs.js'); }).then((m) => m.default)));
187
+ program.command("build-workspace <workspace-dir> [packages...]").option(
188
+ "--alwaysYarnPack",
189
+ "Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
190
+ ).description("Builds a temporary dist workspace from the provided packages").action(lazy(() => Promise.resolve().then(function () { return require('./buildWorkspace.cjs.js'); }).then((m) => m.default)));
191
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy(() => Promise.resolve().then(function () { return require('./create-github-app/index.cjs.js'); }).then((m) => m.default)));
192
+ program.command("info").description("Show helpful information for debugging and reporting bugs").action(lazy(() => Promise.resolve().then(function () { return require('./info.cjs.js'); }).then((m) => m.default)));
193
+ program.command("create").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
194
+ program.command("create-plugin").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
195
+ program.command("plugin:diff").allowUnknownOption(true).action(removed("use 'backstage-cli fix' instead"));
196
+ program.command("test").allowUnknownOption(true).action(
197
+ removed(
198
+ "use 'backstage-cli repo test' or 'backstage-cli package test' instead"
199
+ )
200
+ );
201
+ program.command("clean").allowUnknownOption(true).action(removed("use 'backstage-cli package clean' instead"));
202
+ program.command("versions:check").allowUnknownOption(true).action(removed("use 'yarn dedupe' or 'yarn-deduplicate' instead"));
203
+ program.command("install").allowUnknownOption(true).action(removed());
204
+ program.command("onboard").allowUnknownOption(true).action(removed());
205
+ }
206
+ function removed(message) {
207
+ return () => {
208
+ console.error(
209
+ message ? `This command has been removed, ${message}` : "This command has been removed"
210
+ );
211
+ process.exit(1);
212
+ };
213
+ }
214
+ function lazy(getActionFunc) {
215
+ return async (...args) => {
216
+ try {
217
+ const actionFunc = await getActionFunc();
218
+ await actionFunc(...args);
219
+ process.exit(0);
220
+ } catch (error) {
221
+ errors.assertError(error);
222
+ errors$1.exitWithError(error);
223
+ }
224
+ };
225
+ }
226
+
227
+ exports.registerCommands = registerCommands;
228
+ exports.registerMigrateCommand = registerMigrateCommand;
229
+ exports.registerRepoCommand = registerRepoCommand;
230
+ exports.registerScriptCommand = registerScriptCommand;
231
+ //# sourceMappingURL=index.cjs.js.map
@@ -1,21 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-v57xnvgT.cjs.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _package = require('../packages/cli/package.json.cjs.js');
4
6
  var os = require('os');
5
- var run = require('./run-HW3lfDbM.cjs.js');
6
- var yarn = require('./yarn-6FNAgNBK.cjs.js');
7
+ var run = require('../lib/run.cjs.js');
8
+ var paths = require('../lib/paths.cjs.js');
9
+ var Lockfile = require('../lib/versioning/Lockfile.cjs.js');
7
10
  require('minimatch');
8
11
  require('@manypkg/get-packages');
9
12
  require('chalk');
13
+ require('../lib/yarn.cjs.js');
10
14
  var fs = require('fs-extra');
11
- require('commander');
12
- require('semver');
13
- require('@backstage/cli-common');
14
- require('@backstage/errors');
15
- require('child_process');
16
- require('util');
17
- require('@yarnpkg/parsers');
18
- require('@yarnpkg/lockfile');
19
15
 
20
16
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
21
17
 
@@ -25,8 +21,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
25
21
  var info = async () => {
26
22
  await new Promise(async () => {
27
23
  const yarnVersion = await run.runPlain("yarn --version");
28
- const isLocal = fs__default.default.existsSync(index.paths.resolveOwn("./src"));
29
- const backstageFile = index.paths.resolveTargetRoot("backstage.json");
24
+ const isLocal = fs__default.default.existsSync(paths.paths.resolveOwn("./src"));
25
+ const backstageFile = paths.paths.resolveTargetRoot("backstage.json");
30
26
  let backstageVersion = "N/A";
31
27
  if (fs__default.default.existsSync(backstageFile)) {
32
28
  try {
@@ -40,12 +36,12 @@ var info = async () => {
40
36
  console.log(`OS: ${os__default.default.type} ${os__default.default.release} - ${os__default.default.platform}/${os__default.default.arch}`);
41
37
  console.log(`node: ${process.version}`);
42
38
  console.log(`yarn: ${yarnVersion}`);
43
- console.log(`cli: ${index.version$1} (${isLocal ? "local" : "installed"})`);
39
+ console.log(`cli: ${_package.version} (${isLocal ? "local" : "installed"})`);
44
40
  console.log(`backstage: ${backstageVersion}`);
45
41
  console.log();
46
42
  console.log("Dependencies:");
47
- const lockfilePath = index.paths.resolveTargetRoot("yarn.lock");
48
- const lockfile = await yarn.Lockfile.load(lockfilePath);
43
+ const lockfilePath = paths.paths.resolveTargetRoot("yarn.lock");
44
+ const lockfile = await Lockfile.Lockfile.load(lockfilePath);
49
45
  const deps = [...lockfile.keys()].filter((n) => n.startsWith("@backstage/"));
50
46
  const maxLength = Math.max(...deps.map((d) => d.length));
51
47
  for (const dep of deps) {
@@ -56,4 +52,4 @@ var info = async () => {
56
52
  };
57
53
 
58
54
  exports.default = info;
59
- //# sourceMappingURL=info-CB7ln5K_.cjs.js.map
55
+ //# sourceMappingURL=info.cjs.js.map
@@ -1,36 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-v57xnvgT.cjs.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var paths = require('../lib/paths.cjs.js');
4
6
  var eslint = require('eslint');
5
- require('commander');
6
- require('chalk');
7
- require('fs-extra');
8
- require('semver');
9
- require('@backstage/cli-common');
10
- require('@backstage/errors');
11
7
 
12
8
  var lint = async (directories, opts) => {
13
9
  const eslint$1 = new eslint.ESLint({
14
- cwd: index.paths.targetDir,
10
+ cwd: paths.paths.targetDir,
15
11
  fix: opts.fix,
16
12
  extensions: ["js", "jsx", "ts", "tsx", "mjs", "cjs"]
17
13
  });
18
14
  const results = await eslint$1.lintFiles(
19
15
  directories.length ? directories : ["."]
20
16
  );
17
+ const maxWarnings = opts.maxWarnings ?? 0;
18
+ const failed = results.some((r) => r.errorCount > 0) || results.reduce((current, next) => current + next.warningCount, 0) > maxWarnings;
21
19
  if (opts.fix) {
22
20
  await eslint.ESLint.outputFixes(results);
23
21
  }
24
22
  const formatter = await eslint$1.loadFormatter(opts.format);
25
23
  if (opts.format === "eslint-formatter-friendly") {
26
- process.chdir(index.paths.targetRoot);
24
+ process.chdir(paths.paths.targetRoot);
27
25
  }
28
26
  const resultText = formatter.format(results);
29
27
  if (resultText) {
30
28
  console.log(resultText);
29
+ }
30
+ if (failed) {
31
31
  process.exit(1);
32
32
  }
33
33
  };
34
34
 
35
35
  exports.default = lint;
36
- //# sourceMappingURL=lint-6_0f9f26.cjs.js.map
36
+ //# sourceMappingURL=lint.cjs.js.map
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var fix = require('../repo/fix.cjs.js');
4
+
5
+ async function command() {
6
+ console.log(
7
+ "The `migrate package-exports` command is deprecated, use `repo fix` instead."
8
+ );
9
+ const packages = await fix.readFixablePackages();
10
+ for (const pkg of packages) {
11
+ fix.fixPackageExports(pkg);
12
+ }
13
+ await fix.writeFixedPackages(packages);
14
+ }
15
+
16
+ exports.command = command;
17
+ //# sourceMappingURL=packageExports.cjs.js.map