@backstage/cli 0.32.0-next.1 → 0.32.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 (62) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/bin/backstage-cli-alpha +0 -0
  3. package/config/eslint-factory.js +20 -1
  4. package/dist/commands/index.cjs.js +23 -57
  5. package/dist/lib/errors.cjs.js +1 -1
  6. package/dist/lib/removed.cjs.js +13 -0
  7. package/dist/lib/runner/runBackend.cjs.js +1 -0
  8. package/dist/modules/build/lib/bundler/server.cjs.js +9 -3
  9. package/dist/modules/build/lib/packager/productionPack.cjs.js +6 -6
  10. package/dist/modules/config/lib/config.cjs.js +4 -2
  11. package/dist/{commands → modules/create-github-app/commands}/create-github-app/index.cjs.js +1 -1
  12. package/dist/modules/create-github-app/index.cjs.js +15 -0
  13. package/dist/{commands/new → modules/new/commands}/new.cjs.js +1 -1
  14. package/dist/modules/new/index.cjs.js +35 -0
  15. package/dist/{lib/new → modules/new/lib}/execution/PortableTemplater.cjs.js +5 -5
  16. package/dist/{lib/new → modules/new/lib}/execution/executePortableTemplate.cjs.js +2 -2
  17. package/dist/{lib/new → modules/new/lib}/execution/installNewPackage.cjs.js +2 -2
  18. package/dist/{lib/new → modules/new/lib}/execution/writeTemplateContents.cjs.js +1 -1
  19. package/dist/{lib/new → modules/new/lib}/preparation/collectPortableTemplateInput.cjs.js +2 -2
  20. package/dist/{lib/new → modules/new/lib}/preparation/loadPortableTemplate.cjs.js +1 -1
  21. package/dist/{lib/new → modules/new/lib}/preparation/loadPortableTemplateConfig.cjs.js +1 -1
  22. package/dist/modules/start/commands/package/start/command.cjs.js +22 -0
  23. package/dist/modules/start/commands/package/start/resolveLinkedWorkspace.cjs.js +34 -0
  24. package/dist/{commands → modules/start/commands/package}/start/startBackend.cjs.js +6 -3
  25. package/dist/{commands → modules/start/commands/package}/start/startFrontend.cjs.js +9 -8
  26. package/dist/modules/start/commands/package/start/startPackage.cjs.js +42 -0
  27. package/dist/modules/start/commands/repo/start.cjs.js +150 -0
  28. package/dist/modules/start/index.cjs.js +38 -0
  29. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  30. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  31. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  32. package/dist/packages/cli/package.json.cjs.js +1 -1
  33. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  34. package/dist/packages/core-components/package.json.cjs.js +1 -1
  35. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  36. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  37. package/dist/packages/test-utils/package.json.cjs.js +1 -1
  38. package/dist/packages/theme/package.json.cjs.js +1 -1
  39. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  40. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  41. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  42. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  43. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  44. package/package.json +29 -28
  45. package/templates/backend-plugin/README.md.hbs +1 -1
  46. package/templates/backend-plugin/src/plugin.ts.hbs +2 -4
  47. package/templates/backend-plugin/src/services/TodoListService/createTodoListService.ts +3 -11
  48. package/templates/frontend-plugin/dev/index.tsx.hbs +0 -1
  49. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -1
  50. package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -1
  51. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -1
  52. package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -1
  53. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +17 -18
  54. package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +28 -29
  55. package/dist/commands/start/command.cjs.js +0 -75
  56. /package/dist/{commands → modules/create-github-app/commands}/create-github-app/GithubCreateAppServer.cjs.js +0 -0
  57. /package/dist/{lib/new → modules/new/lib}/createNewPackage.cjs.js +0 -0
  58. /package/dist/{lib/new → modules/new/lib}/defaultTemplates.cjs.js +0 -0
  59. /package/dist/{lib/new → modules/new/lib}/preparation/resolvePackageParams.cjs.js +0 -0
  60. /package/dist/{lib/new → modules/new/lib}/preparation/selectTemplateInteractively.cjs.js +0 -0
  61. /package/dist/{lib/new → modules/new/lib}/types.cjs.js +0 -0
  62. /package/dist/{commands → modules/start/commands/package}/start/index.cjs.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,122 @@
1
1
  # @backstage/cli
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a47fd39: Removes default React imports from template files, aligning with the requirements for the upcoming React 19 migration. Introduces a new ESLint rule to disallow `import React from 'react'` and `import * as React from 'react'`.
8
+
9
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
10
+
11
+ - 65b584c: Internal update to move the `new` and `create-github-app` to their own module.
12
+ - c7254ae: Internal update to move the `clean`, `pre/postpack` and `fix` commands into their own separate module.
13
+
14
+ ### Patch Changes
15
+
16
+ - 4ea76f7: Bump @module-federation/enhanced ^0.9.0 to fix GHSA-593f-38f6-jp5m
17
+ - 87a5cb4: Fixed an issue causing the `repo lint` command to fail when the `--max-warnings` option was used.
18
+ - 6969f79: Avoid trailing `/*` when automatically adding imports for package with multiple entry points.
19
+ - 98b7131: Update the `to do` plugin template to stop using the deprecated catalog alpha service reference.
20
+ If you start seeing the `should create TODO item with catalog information` test failing, you have two options to fix this:
21
+ Update the test to mock the legacy alpha catalog service, or migrate the `TODO` plugin backend to use the new catalog service reference.
22
+ We recommend the second option, see [this](https://github.com/backstage/backstage/pull/29450/files/267115d0436009443ca68ac84e7dcc646c9c938d#diff-47e01aeb12dd55fab9e697f810be21a8d08d39c37df1b078f6d0894f9bad5a1b) pull request for an example of how to do the migration.
23
+ - d5c4fed: make certificate strings optional for Dev environments
24
+ - d83f3f4: Resolved a problem where the `start` command did not correctly handle multiple `--require` flags, ensuring all specified modules are now properly loaded.
25
+ - d2091c6: Added a new `repo start` command to replace the existing pattern of using `yarn dev` scripts. The `repo start` command runs the app and/or backend package in the repo by default, but will also fall back to running other individual frontend or backend packages or even plugin dev entry points if the can be uniquely selected.
26
+
27
+ The goal of this change is to reduce the number of different necessary scripts and align on `yarn start` being the only command needed for local development, similar to how `repo test` handles testing in the repo. It also opens up for more powerful options, like the `--plugin <pluginId>` flag that runs the dev entry point of the selected plugin.
28
+
29
+ The new script is installed as follows, replacing the existing `yarn start` script:
30
+
31
+ ```json
32
+ {
33
+ "scripts": {
34
+ "start": "backstage-cli repo start"
35
+ }
36
+ }
37
+ ```
38
+
39
+ In order to help users migrate in existing projects, it is recommended to add the following scripts to the root `package.json`:
40
+
41
+ ```json
42
+ {
43
+ "scripts": {
44
+ "dev": "echo \"Use 'yarn start' instead\"",
45
+ "start-backend": "echo \"Use 'yarn start backend' instead\""
46
+ }
47
+ }
48
+ ```
49
+
50
+ For more information, run `yarn start --help` once the new command is installed.
51
+
52
+ - 918c883: Included a reference to the JSX transform guide in the warning about using the default React import.
53
+ - Updated dependencies
54
+ - @backstage/integration@1.16.3
55
+ - @backstage/catalog-model@1.7.3
56
+ - @backstage/cli-common@0.1.15
57
+ - @backstage/cli-node@0.2.13
58
+ - @backstage/config@1.3.2
59
+ - @backstage/config-loader@1.10.0
60
+ - @backstage/errors@1.2.7
61
+ - @backstage/eslint-plugin@0.1.10
62
+ - @backstage/release-manifests@0.0.12
63
+ - @backstage/types@1.2.1
64
+
65
+ ## 0.32.0-next.2
66
+
67
+ ### Minor Changes
68
+
69
+ - a47fd39: Removes default React imports from template files, aligning with the requirements for the upcoming React 19 migration. Introduces a new ESLint rule to disallow `import React from 'react'` and `import * as React from 'react'`.
70
+
71
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
72
+
73
+ ### Patch Changes
74
+
75
+ - 6969f79: Avoid trailing `/*` when automatically adding imports for package with multiple entry points.
76
+ - 98b7131: Update the `to do` plugin template to stop using the deprecated catalog alpha service reference.
77
+ If you start seeing the `should create TODO item with catalog information` test failing, you have two options to fix this:
78
+ Update the test to mock the legacy alpha catalog service, or migrate the `TODO` plugin backend to use the new catalog service reference.
79
+ We recommend the second option, see [this](https://github.com/backstage/backstage/pull/29450/files/267115d0436009443ca68ac84e7dcc646c9c938d#diff-47e01aeb12dd55fab9e697f810be21a8d08d39c37df1b078f6d0894f9bad5a1b) pull request for an example of how to do the migration.
80
+ - d5c4fed: make certificate strings optional for Dev environments
81
+ - d2091c6: Added a new `repo start` command to replace the existing pattern of using `yarn dev` scripts. The `repo start` command runs the app and/or backend package in the repo by default, but will also fall back to running other individual frontend or backend packages or even plugin dev entry points if the can be uniquely selected.
82
+
83
+ The goal of this change is to reduce the number of different necessary scripts and align on `yarn start` being the only command needed for local development, similar to how `repo test` handles testing in the repo. It also opens up for more powerful options, like the `--plugin <pluginId>` flag that runs the dev entry point of the selected plugin.
84
+
85
+ The new script is installed as follows, replacing the existing `yarn start` script:
86
+
87
+ ```json
88
+ {
89
+ "scripts": {
90
+ "start": "backstage-cli repo start"
91
+ }
92
+ }
93
+ ```
94
+
95
+ In order to help users migrate in existing projects, it is recommended to add the following scripts to the root `package.json`:
96
+
97
+ ```json
98
+ {
99
+ "scripts": {
100
+ "dev": "echo \"Use 'yarn start' instead\"",
101
+ "start-backend": "echo \"Use 'yarn start backend' instead\""
102
+ }
103
+ }
104
+ ```
105
+
106
+ For more information, run `yarn start --help` once the new command is installed.
107
+
108
+ - Updated dependencies
109
+ - @backstage/catalog-model@1.7.3
110
+ - @backstage/cli-common@0.1.15
111
+ - @backstage/cli-node@0.2.13
112
+ - @backstage/config@1.3.2
113
+ - @backstage/config-loader@1.10.0
114
+ - @backstage/errors@1.2.7
115
+ - @backstage/eslint-plugin@0.1.10
116
+ - @backstage/integration@1.16.3-next.0
117
+ - @backstage/release-manifests@0.0.12
118
+ - @backstage/types@1.2.1
119
+
3
120
  ## 0.32.0-next.1
4
121
 
5
122
  ### Patch Changes
File without changes
@@ -243,8 +243,27 @@ function createConfigForRole(dir, role, extraConfig = {}) {
243
243
  '@mui/*/*/*',
244
244
  ...(extraConfig.restrictedImportPatterns ?? []),
245
245
  ],
246
+ rules: {
247
+ 'react/react-in-jsx-scope': 'off',
248
+ 'no-restricted-syntax': [
249
+ 'warn',
250
+ {
251
+ message:
252
+ 'React default imports are deprecated. Follow the https://backstage.io/docs/tutorials/jsx-transform-migration migration guide for details.',
253
+ selector:
254
+ "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
255
+ },
256
+ {
257
+ message:
258
+ 'React default imports are deprecated. Follow the https://backstage.io/docs/tutorials/jsx-transform-migration migration guide for details. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.',
259
+ selector:
260
+ "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)",
261
+ },
262
+ ],
263
+ ...extraConfig.rules,
264
+ },
246
265
  tsRules: {
247
- 'react/prop-types': 0,
266
+ 'react/prop-types': 'off',
248
267
  ...extraConfig.tsRules,
249
268
  },
250
269
  });
@@ -1,86 +1,52 @@
1
1
  'use strict';
2
2
 
3
- var lazy = require('../lib/lazy.cjs.js');
4
3
  var index = require('../modules/config/index.cjs.js');
5
4
  var index$2 = require('../modules/build/index.cjs.js');
5
+ var index$6 = require('../modules/start/index.cjs.js');
6
6
  var index$3 = require('../modules/info/index.cjs.js');
7
7
  var index$1 = require('../modules/migrate/index.cjs.js');
8
- var index$4 = require('../modules/test/index.cjs.js');
9
- var index$5 = require('../modules/lint/index.cjs.js');
10
- var index$6 = require('../modules/maintenance/index.cjs.js');
8
+ var index$7 = require('../modules/test/index.cjs.js');
9
+ var index$8 = require('../modules/lint/index.cjs.js');
10
+ var index$9 = require('../modules/maintenance/index.cjs.js');
11
+ var removed = require('../lib/removed.cjs.js');
12
+ var index$4 = require('../modules/new/index.cjs.js');
13
+ var index$5 = require('../modules/create-github-app/index.cjs.js');
11
14
 
12
15
  function registerRepoCommand(program) {
13
16
  const command = program.command("repo [command]").description("Command that run across an entire Backstage project");
14
- index$2.registerRepoCommands(command);
15
- index$4.registerRepoCommands(command);
16
- index$5.registerRepoCommands(command);
17
17
  index$6.registerRepoCommands(command);
18
+ index$2.registerRepoCommands(command);
19
+ index$7.registerRepoCommands(command);
20
+ index$8.registerRepoCommands(command);
21
+ index$9.registerRepoCommands(command);
18
22
  }
19
23
  function registerScriptCommand(program) {
20
24
  const command = program.command("package [command]").description("Lifecycle scripts for individual packages");
21
- command.command("start").description("Start a package for local development").option(...index.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(
22
- "--inspect-brk [host]",
23
- "Enable debugger in Node.js environments, breaking before code starts"
24
- ).option(
25
- "--require <path...>",
26
- "Add a --require argument to the node process"
27
- ).option("--link <path>", "Link an external workspace for module resolution").action(lazy.lazy(() => import('./start/index.cjs.js'), "command"));
28
- index$2.registerPackageCommands(command);
29
- index$4.registerPackageCommands(command);
30
25
  index$6.registerPackageCommands(command);
31
- index$5.registerPackageCommands(command);
26
+ index$2.registerPackageCommands(command);
27
+ index$7.registerPackageCommands(command);
28
+ index$9.registerPackageCommands(command);
29
+ index$8.registerPackageCommands(command);
32
30
  }
33
31
  function registerCommands(program) {
34
- program.command("new").storeOptionsAsProperties(false).description(
35
- "Open up an interactive guide to creating new things in your app"
36
- ).option(
37
- "--select <name>",
38
- "Select the thing you want to be creating upfront"
39
- ).option(
40
- "--option <name>=<value>",
41
- "Pre-fill options for the creation process",
42
- (opt, arr) => [...arr, opt],
43
- []
44
- ).option(
45
- "--skip-install",
46
- `Skips running 'yarn install' and 'yarn lint --fix'`
47
- ).option("--scope <scope>", "The scope to use for new packages").option(
48
- "--npm-registry <URL>",
49
- "The package registry to use for new packages"
50
- ).option(
51
- "--baseVersion <version>",
52
- "The version to use for any new packages (default: 0.1.0)"
53
- ).option(
54
- "--license <license>",
55
- "The license to use for any new packages (default: Apache-2.0)"
56
- ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => import('./new/new.cjs.js'), "default"));
57
32
  index.registerCommands(program);
58
33
  registerRepoCommand(program);
59
34
  registerScriptCommand(program);
60
35
  index$1.registerCommands(program);
61
36
  index$2.registerCommands(program);
62
37
  index$3.registerCommands(program);
63
- program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(lazy.lazy(() => import('./create-github-app/index.cjs.js'), "default"));
64
- program.command("create").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
65
- program.command("create-plugin").allowUnknownOption(true).action(removed("use 'backstage-cli new' instead"));
66
- program.command("plugin:diff").allowUnknownOption(true).action(removed("use 'backstage-cli fix' instead"));
38
+ index$4.registerCommands(program);
39
+ index$5.registerCommands(program);
40
+ program.command("plugin:diff").allowUnknownOption(true).action(removed.removed("use 'backstage-cli fix' instead"));
67
41
  program.command("test").allowUnknownOption(true).action(
68
- removed(
42
+ removed.removed(
69
43
  "use 'backstage-cli repo test' or 'backstage-cli package test' instead"
70
44
  )
71
45
  );
72
- program.command("clean").allowUnknownOption(true).action(removed("use 'backstage-cli package clean' instead"));
73
- program.command("versions:check").allowUnknownOption(true).action(removed("use 'yarn dedupe' or 'yarn-deduplicate' instead"));
74
- program.command("install").allowUnknownOption(true).action(removed());
75
- program.command("onboard").allowUnknownOption(true).action(removed());
76
- }
77
- function removed(message) {
78
- return () => {
79
- console.error(
80
- message ? `This command has been removed, ${message}` : "This command has been removed"
81
- );
82
- process.exit(1);
83
- };
46
+ program.command("clean").allowUnknownOption(true).action(removed.removed("use 'backstage-cli package clean' instead"));
47
+ program.command("versions:check").allowUnknownOption(true).action(removed.removed("use 'yarn dedupe' or 'yarn-deduplicate' instead"));
48
+ program.command("install").allowUnknownOption(true).action(removed.removed());
49
+ program.command("onboard").allowUnknownOption(true).action(removed.removed());
84
50
  }
85
51
 
86
52
  exports.registerCommands = registerCommands;
@@ -29,7 +29,7 @@ ${chalk__default.default.red(error.message)}
29
29
  process.exit(error.code);
30
30
  } else {
31
31
  process.stderr.write(`
32
- ${chalk__default.default.red(`${error}`)}
32
+ ${chalk__default.default.red(`${error.stack}`)}
33
33
 
34
34
  `);
35
35
  process.exit(1);
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ function removed(message) {
4
+ return () => {
5
+ console.error(
6
+ message ? `This command has been removed, ${message}` : "This command has been removed"
7
+ );
8
+ process.exit(1);
9
+ };
10
+ }
11
+
12
+ exports.removed = removed;
13
+ //# sourceMappingURL=removed.cjs.js.map
@@ -78,6 +78,7 @@ async function runBackend(options) {
78
78
  [...loaderArgs, ...optionArgs, options.entry, ...userArgs],
79
79
  {
80
80
  stdio: ["ignore", "inherit", "inherit", "ipc"],
81
+ cwd: options.targetDir,
81
82
  env: {
82
83
  ...process.env,
83
84
  BACKSTAGE_CLI_LINKED_WORKSPACE: options.linkedWorkspace,
@@ -2,6 +2,7 @@
2
2
 
3
3
  var chalk = require('chalk');
4
4
  var fs = require('fs-extra');
5
+ var path = require('path');
5
6
  var openBrowser = require('react-dev-utils/openBrowser');
6
7
  var webpack = require('webpack');
7
8
  var WebpackDevServer = require('webpack-dev-server');
@@ -34,7 +35,9 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
34
35
  }
35
36
  }
36
37
  checkReactVersion();
37
- const { name } = await fs__default.default.readJson(paths$1.paths.resolveTarget("package.json"));
38
+ const { name } = await fs__default.default.readJson(
39
+ path.resolve(options.targetDir ?? paths$1.paths.targetDir, "package.json")
40
+ );
38
41
  let webpackServer = void 0;
39
42
  let latestFrontendAppConfigs = [];
40
43
  const triggerReload = () => {
@@ -50,6 +53,7 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
50
53
  };
51
54
  const cliConfig = await config.loadCliConfig({
52
55
  args: options.configPaths,
56
+ targetDir: options.targetDir,
53
57
  fromPackage: name,
54
58
  withFilteredKeys: true,
55
59
  watch(appConfigs) {
@@ -145,8 +149,10 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
145
149
  server: url.protocol === "https:" ? {
146
150
  type: "https",
147
151
  options: {
148
- cert: fullConfig.getString("app.https.certificate.cert"),
149
- key: fullConfig.getString("app.https.certificate.key")
152
+ cert: fullConfig.getOptionalString(
153
+ "app.https.certificate.cert"
154
+ ),
155
+ key: fullConfig.getOptionalString("app.https.certificate.key")
150
156
  }
151
157
  } : {},
152
158
  host,
@@ -106,8 +106,11 @@ async function rewriteEntryPoints(pkg, packageDir, featureDetectionProject) {
106
106
  if (!pkg.typesVersions) {
107
107
  pkg.typesVersions = { "*": {} };
108
108
  }
109
- const mount = entryPoint.name === "index" ? "*" : entryPoint.name;
110
- pkg.typesVersions["*"][mount] = [`dist/${entryPoint.name}.d.ts`];
109
+ if (entryPoint.name !== "index") {
110
+ pkg.typesVersions["*"][entryPoint.name] = [
111
+ `dist/${entryPoint.name}.d.ts`
112
+ ];
113
+ }
111
114
  }
112
115
  exp.default = exp.require ?? exp.import;
113
116
  if (exp.types && featureDetectionProject) {
@@ -140,10 +143,7 @@ async function rewriteEntryPoints(pkg, packageDir, featureDetectionProject) {
140
143
  }
141
144
  }
142
145
  if (pkg.typesVersions?.["*"]) {
143
- const keys = Object.keys(pkg.typesVersions["*"]);
144
- if (keys.length === 1 && keys[0] === "*") {
145
- delete pkg.typesVersions;
146
- }
146
+ pkg.typesVersions["*"]["package.json"] = ["package.json"];
147
147
  }
148
148
  if (pkg.exports) {
149
149
  pkg.exports = outputExports;
@@ -5,9 +5,11 @@ var config = require('@backstage/config');
5
5
  var paths = require('../../../lib/paths.cjs.js');
6
6
  var getPackages = require('@manypkg/get-packages');
7
7
  var cliNode = require('@backstage/cli-node');
8
+ var path = require('path');
8
9
 
9
10
  async function loadCliConfig(options) {
10
- const { packages } = await getPackages.getPackages(paths.paths.targetDir);
11
+ const targetDir = options.targetDir ?? paths.paths.targetDir;
12
+ const { packages } = await getPackages.getPackages(targetDir);
11
13
  let localPackageNames;
12
14
  if (options.fromPackage) {
13
15
  if (packages.length) {
@@ -37,7 +39,7 @@ async function loadCliConfig(options) {
37
39
  substitutionFunc: options.mockEnv ? async (name) => process.env[name] || "x" : void 0,
38
40
  watch: Boolean(options.watch),
39
41
  rootDir: paths.paths.targetRoot,
40
- argv: options.args.flatMap((t) => ["--config", paths.paths.resolveTarget(t)])
42
+ argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
41
43
  });
42
44
  const appConfigs = await new Promise((resolve, reject) => {
43
45
  async function loadConfigReaderLoop() {
@@ -6,7 +6,7 @@ var fs = require('fs-extra');
6
6
  var chalk = require('chalk');
7
7
  var yaml = require('yaml');
8
8
  var inquirer = require('inquirer');
9
- var paths = require('../../lib/paths.cjs.js');
9
+ var paths = require('../../../../lib/paths.cjs.js');
10
10
  var GithubCreateAppServer = require('./GithubCreateAppServer.cjs.js');
11
11
  var openBrowser = require('react-dev-utils/openBrowser');
12
12
 
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var lazy = require('../../lib/lazy.cjs.js');
4
+
5
+ function registerCommands(program) {
6
+ program.command("create-github-app <github-org>").description("Create new GitHub App in your organization.").action(
7
+ lazy.lazy(
8
+ () => import('./commands/create-github-app/index.cjs.js'),
9
+ "default"
10
+ )
11
+ );
12
+ }
13
+
14
+ exports.registerCommands = registerCommands;
15
+ //# sourceMappingURL=index.cjs.js.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createNewPackage = require('../../lib/new/createNewPackage.cjs.js');
5
+ var createNewPackage = require('../lib/createNewPackage.cjs.js');
6
6
 
7
7
  var _new = async (opts) => {
8
8
  const {
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var lazy = require('../../lib/lazy.cjs.js');
4
+ var removed = require('../../lib/removed.cjs.js');
5
+
6
+ function registerCommands(program) {
7
+ program.command("new").storeOptionsAsProperties(false).description(
8
+ "Open up an interactive guide to creating new things in your app"
9
+ ).option(
10
+ "--select <name>",
11
+ "Select the thing you want to be creating upfront"
12
+ ).option(
13
+ "--option <name>=<value>",
14
+ "Pre-fill options for the creation process",
15
+ (opt, arr) => [...arr, opt],
16
+ []
17
+ ).option(
18
+ "--skip-install",
19
+ `Skips running 'yarn install' and 'yarn lint --fix'`
20
+ ).option("--scope <scope>", "The scope to use for new packages").option(
21
+ "--npm-registry <URL>",
22
+ "The package registry to use for new packages"
23
+ ).option(
24
+ "--baseVersion <version>",
25
+ "The version to use for any new packages (default: 0.1.0)"
26
+ ).option(
27
+ "--license <license>",
28
+ "The license to use for any new packages (default: Apache-2.0)"
29
+ ).option("--no-private", "Do not mark new packages as private").action(lazy.lazy(() => import('./commands/new.cjs.js'), "default"));
30
+ program.command("create").allowUnknownOption(true).action(removed.removed("use 'backstage-cli new' instead"));
31
+ program.command("create-plugin").allowUnknownOption(true).action(removed.removed("use 'backstage-cli new' instead"));
32
+ }
33
+
34
+ exports.registerCommands = registerCommands;
35
+ //# sourceMappingURL=index.cjs.js.map
@@ -9,14 +9,14 @@ var startCase = require('lodash/startCase');
9
9
  var upperCase = require('lodash/upperCase');
10
10
  var upperFirst = require('lodash/upperFirst');
11
11
  var lowerFirst = require('lodash/lowerFirst');
12
- var Lockfile = require('../../versioning/Lockfile.cjs.js');
12
+ var Lockfile = require('../../../../lib/versioning/Lockfile.cjs.js');
13
13
  require('minimatch');
14
14
  require('@manypkg/get-packages');
15
15
  require('chalk');
16
- require('../../yarn.cjs.js');
17
- require('../../run.cjs.js');
18
- var paths = require('../../paths.cjs.js');
19
- var version = require('../../version.cjs.js');
16
+ require('../../../../lib/yarn.cjs.js');
17
+ require('../../../../lib/run.cjs.js');
18
+ var paths = require('../../../../lib/paths.cjs.js');
19
+ var version = require('../../../../lib/version.cjs.js');
20
20
 
21
21
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
22
22
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var errors = require('@backstage/errors');
4
- var codeowners = require('../../codeowners/codeowners.cjs.js');
5
- var tasks = require('../../tasks.cjs.js');
4
+ var codeowners = require('../../../../lib/codeowners/codeowners.cjs.js');
5
+ var tasks = require('../../../../lib/tasks.cjs.js');
6
6
  var installNewPackage = require('./installNewPackage.cjs.js');
7
7
  var writeTemplateContents = require('./writeTemplateContents.cjs.js');
8
8
 
@@ -3,8 +3,8 @@
3
3
  var fs = require('fs-extra');
4
4
  var upperFirst = require('lodash/upperFirst');
5
5
  var camelCase = require('lodash/camelCase');
6
- var paths = require('../../paths.cjs.js');
7
- var tasks = require('../../tasks.cjs.js');
6
+ var paths = require('../../../../lib/paths.cjs.js');
7
+ var tasks = require('../../../../lib/tasks.cjs.js');
8
8
 
9
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  var fs = require('fs-extra');
4
4
  var path = require('path');
5
- var paths = require('../../paths.cjs.js');
5
+ var paths = require('../../../../lib/paths.cjs.js');
6
6
  var errors = require('@backstage/errors');
7
7
  var cliNode = require('@backstage/cli-node');
8
8
  var PortableTemplater = require('./PortableTemplater.cjs.js');
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var inquirer = require('inquirer');
4
- var codeowners = require('../../codeowners/codeowners.cjs.js');
5
- var paths = require('../../paths.cjs.js');
4
+ var codeowners = require('../../../../lib/codeowners/codeowners.cjs.js');
5
+ var paths = require('../../../../lib/paths.cjs.js');
6
6
  var resolvePackageParams = require('./resolvePackageParams.cjs.js');
7
7
 
8
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -6,7 +6,7 @@ var recursiveReaddir = require('recursive-readdir');
6
6
  var path = require('path');
7
7
  var node_path = require('node:path');
8
8
  var yaml = require('yaml');
9
- var paths = require('../../paths.cjs.js');
9
+ var paths = require('../../../../lib/paths.cjs.js');
10
10
  var types = require('../types.cjs.js');
11
11
  var errors = require('@backstage/errors');
12
12
  var zodValidationError = require('zod-validation-error');
@@ -2,7 +2,7 @@
2
2
 
3
3
  var fs = require('fs-extra');
4
4
  var node_path = require('node:path');
5
- var paths = require('../../paths.cjs.js');
5
+ var paths = require('../../../../lib/paths.cjs.js');
6
6
  var defaultTemplates = require('../defaultTemplates.cjs.js');
7
7
  var types = require('../types.cjs.js');
8
8
  var yaml = require('yaml');
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var startPackage = require('./startPackage.cjs.js');
4
+ var resolveLinkedWorkspace = require('./resolveLinkedWorkspace.cjs.js');
5
+ var role = require('../../../../../lib/role.cjs.js');
6
+ var paths = require('../../../../../lib/paths.cjs.js');
7
+
8
+ async function command(opts) {
9
+ await startPackage.startPackage({
10
+ role: await role.findRoleFromCommand(opts),
11
+ targetDir: paths.paths.targetDir,
12
+ configPaths: opts.config,
13
+ checksEnabled: Boolean(opts.check),
14
+ linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(opts.link),
15
+ inspectEnabled: opts.inspect,
16
+ inspectBrkEnabled: opts.inspectBrk,
17
+ require: opts.require
18
+ });
19
+ }
20
+
21
+ exports.command = command;
22
+ //# sourceMappingURL=command.cjs.js.map
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var errors = require('@backstage/errors');
4
+ var fs = require('fs-extra');
5
+ var posix = require('path/posix');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
+
11
+ async function resolveLinkedWorkspace(linkPath) {
12
+ if (!linkPath) {
13
+ return void 0;
14
+ }
15
+ const dir = posix.resolve(linkPath);
16
+ if (!fs__default.default.pathExistsSync(dir)) {
17
+ throw new Error(`Invalid workspace link, directory does not exist: ${dir}`);
18
+ }
19
+ const pkgJson = await fs__default.default.readJson(posix.resolve(dir, "package.json")).catch((error) => {
20
+ throw new errors.ForwardedError(
21
+ "Failed to read package.json in linked workspace",
22
+ error
23
+ );
24
+ });
25
+ if (!pkgJson.workspaces) {
26
+ throw new Error(
27
+ `Invalid workspace link, directory is not a workspace: ${dir}`
28
+ );
29
+ }
30
+ return dir;
31
+ }
32
+
33
+ exports.resolveLinkedWorkspace = resolveLinkedWorkspace;
34
+ //# sourceMappingURL=resolveLinkedWorkspace.cjs.js.map
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs-extra');
4
- var paths = require('../../lib/paths.cjs.js');
5
- var runBackend = require('../../lib/runner/runBackend.cjs.js');
4
+ var path = require('path');
5
+ var paths = require('../../../../../lib/paths.cjs.js');
6
+ var runBackend = require('../../../../../lib/runner/runBackend.cjs.js');
6
7
 
7
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
9
 
@@ -10,6 +11,7 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
11
 
11
12
  async function startBackend(options) {
12
13
  const waitForExit = await runBackend.runBackend({
14
+ targetDir: options.targetDir,
13
15
  entry: "src/index",
14
16
  inspectEnabled: options.inspectEnabled,
15
17
  inspectBrkEnabled: options.inspectBrkEnabled,
@@ -20,7 +22,7 @@ async function startBackend(options) {
20
22
  }
21
23
  async function startBackendPlugin(options) {
22
24
  const hasDevIndexEntry = await fs__default.default.pathExists(
23
- paths.paths.resolveTarget("dev", "index.ts")
25
+ path.resolve(options.targetDir ?? paths.paths.targetDir, "dev/index.ts")
24
26
  );
25
27
  if (!hasDevIndexEntry) {
26
28
  console.warn(
@@ -29,6 +31,7 @@ async function startBackendPlugin(options) {
29
31
  return;
30
32
  }
31
33
  const waitForExit = await runBackend.runBackend({
34
+ targetDir: options.targetDir,
32
35
  entry: "dev/index",
33
36
  inspectEnabled: options.inspectEnabled,
34
37
  inspectBrkEnabled: options.inspectBrkEnabled,