@backstage/cli 0.35.4 → 0.36.0-next.1

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 (108) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/config/jest.js +2 -2
  3. package/dist/index.cjs.js +1 -0
  4. package/dist/modules/build/commands/package/build/command.cjs.js +7 -7
  5. package/dist/modules/build/commands/package/clean.cjs.js +21 -0
  6. package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
  7. package/dist/modules/build/commands/package/prepack.cjs.js +29 -0
  8. package/dist/modules/build/commands/package/start/command.cjs.js +3 -3
  9. package/dist/modules/build/commands/package/start/startBackend.cjs.js +2 -2
  10. package/dist/modules/build/commands/package/start/startFrontend.cjs.js +4 -5
  11. package/dist/modules/build/commands/repo/build.cjs.js +7 -8
  12. package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +10 -7
  13. package/dist/modules/build/commands/repo/start.cjs.js +3 -3
  14. package/dist/modules/build/index.cjs.js +37 -4
  15. package/dist/modules/build/lib/buildBackend.cjs.js +0 -2
  16. package/dist/modules/build/lib/buildFrontend.cjs.js +3 -6
  17. package/dist/modules/build/lib/builder/config.cjs.js +5 -5
  18. package/dist/modules/build/lib/builder/packager.cjs.js +7 -8
  19. package/dist/modules/build/lib/bundler/config.cjs.js +2 -3
  20. package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +2 -2
  21. package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +2 -2
  22. package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +3 -3
  23. package/dist/modules/build/lib/bundler/packageDetection.cjs.js +2 -2
  24. package/dist/modules/build/lib/bundler/paths.cjs.js +8 -6
  25. package/dist/modules/build/lib/bundler/server.cjs.js +11 -11
  26. package/dist/modules/build/lib/config.cjs.js +94 -0
  27. package/dist/{lib → modules/build/lib}/optionsParser.cjs.js +2 -2
  28. package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +10 -10
  29. package/dist/modules/build/lib/packager/productionPack.cjs.js +2 -2
  30. package/dist/{lib → modules/build/lib}/role.cjs.js +2 -2
  31. package/dist/modules/build/lib/runner/runBackend.cjs.js +2 -2
  32. package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +2 -2
  33. package/dist/modules/config/commands/docs.cjs.js +18 -2
  34. package/dist/modules/config/commands/print.cjs.js +38 -11
  35. package/dist/modules/config/commands/schema.cjs.js +22 -4
  36. package/dist/modules/config/commands/validate.cjs.js +37 -7
  37. package/dist/modules/config/index.cjs.js +6 -65
  38. package/dist/modules/config/lib/config.cjs.js +10 -26
  39. package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +2 -2
  40. package/dist/modules/create-github-app/index.cjs.js +1 -1
  41. package/dist/modules/info/commands/info.cjs.js +29 -11
  42. package/dist/modules/info/index.cjs.js +1 -23
  43. package/dist/modules/lint/commands/package/lint.cjs.js +4 -4
  44. package/dist/modules/lint/commands/repo/lint.cjs.js +13 -12
  45. package/dist/modules/lint/index.cjs.js +1 -1
  46. package/dist/modules/lint/lib/optionsParser.cjs.js +37 -0
  47. package/dist/modules/maintenance/commands/repo/fix.cjs.js +8 -11
  48. package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +4 -4
  49. package/dist/modules/maintenance/index.cjs.js +1 -45
  50. package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
  51. package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
  52. package/dist/modules/migrate/commands/packageRole.cjs.js +5 -3
  53. package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
  54. package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
  55. package/dist/modules/migrate/commands/versions/bump.cjs.js +15 -18
  56. package/dist/modules/migrate/index.cjs.js +11 -31
  57. package/dist/modules/new/index.cjs.js +1 -1
  58. package/dist/modules/new/lib/codeowners/codeowners.cjs.js +2 -2
  59. package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +6 -11
  60. package/dist/modules/new/lib/execution/installNewPackage.cjs.js +4 -4
  61. package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +1 -2
  62. package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +2 -2
  63. package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
  64. package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
  65. package/dist/{lib → modules/new/lib}/version.cjs.js +22 -33
  66. package/dist/modules/test/commands/package/test.cjs.js +1 -5
  67. package/dist/modules/test/commands/repo/test.cjs.js +9 -9
  68. package/dist/modules/test/index.cjs.js +4 -2
  69. package/dist/modules/translations/commands/export.cjs.js +127 -0
  70. package/dist/modules/translations/commands/import.cjs.js +164 -0
  71. package/dist/modules/translations/index.cjs.js +24 -0
  72. package/dist/modules/translations/lib/discoverPackages.cjs.js +121 -0
  73. package/dist/modules/translations/lib/extractTranslations.cjs.js +71 -0
  74. package/dist/modules/translations/lib/messageFilePath.cjs.js +43 -0
  75. package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
  76. package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
  77. package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
  78. package/dist/packages/catalog-client/package.json.cjs.js +1 -1
  79. package/dist/packages/cli/package.json.cjs.js +6 -8
  80. package/dist/packages/core-app-api/package.json.cjs.js +1 -1
  81. package/dist/packages/core-components/package.json.cjs.js +1 -1
  82. package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
  83. package/dist/packages/dev-utils/package.json.cjs.js +1 -1
  84. package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
  85. package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
  86. package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
  87. package/dist/packages/test-utils/package.json.cjs.js +1 -1
  88. package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
  89. package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
  90. package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
  91. package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
  92. package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
  93. package/dist/wiring/CliInitializer.cjs.js +12 -5
  94. package/dist/wiring/version.cjs.js +20 -0
  95. package/package.json +34 -36
  96. package/dist/lib/cache/SuccessCache.cjs.js +0 -79
  97. package/dist/lib/parallel.cjs.js +0 -141
  98. package/dist/lib/paths.cjs.js +0 -8
  99. package/dist/lib/versioning/Lockfile.cjs.js +0 -89
  100. package/dist/lib/yarnPlugin.cjs.js +0 -46
  101. package/dist/modules/maintenance/commands/package/clean.cjs.js +0 -19
  102. package/dist/modules/maintenance/commands/package/pack.cjs.js +0 -29
  103. /package/dist/{lib → modules/build/lib}/entryPoints.cjs.js +0 -0
  104. /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
  105. /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
  106. /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
  107. /package/dist/{lib → wiring}/errors.cjs.js +0 -0
  108. /package/dist/{lib → wiring}/lazy.cjs.js +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  var path = require('node:path');
4
4
  var getPackages = require('@manypkg/get-packages');
5
- var paths = require('../../../../lib/paths.cjs.js');
5
+ var cliCommon = require('@backstage/cli-common');
6
6
 
7
7
  async function createWorkspaceLinkingPlugins(bundler, workspace) {
8
8
  const { packages: linkedPackages, root: linkedRoot } = await getPackages.getPackages(
@@ -23,7 +23,7 @@ async function createWorkspaceLinkingPlugins(bundler, workspace) {
23
23
  /^react(?:-router)?(?:-dom)?$/,
24
24
  (resource) => {
25
25
  if (!path.relative(linkedRoot.dir, resource.context).startsWith("..")) {
26
- resource.context = paths.paths.targetDir;
26
+ resource.context = cliCommon.targetPaths.dir;
27
27
  }
28
28
  }
29
29
  )
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var entryPoints = require('../../../../lib/entryPoints.cjs.js');
4
- var typeDistProject = require('../../../../lib/typeDistProject.cjs.js');
3
+ var entryPoints = require('../entryPoints.cjs.js');
4
+ var typeDistProject = require('../typeDistProject.cjs.js');
5
5
  var moduleFederationCommon = require('@backstage/module-federation-common');
6
- var path = require('path');
6
+ var path = require('node:path');
7
7
  var fs = require('fs-extra');
8
8
  var chokidar = require('chokidar');
9
9
  var PQueue = require('p-queue');
@@ -5,7 +5,7 @@ var chokidar = require('chokidar');
5
5
  var fs = require('fs-extra');
6
6
  var PQueue = require('p-queue');
7
7
  var path = require('node:path');
8
- var paths = require('../../../../lib/paths.cjs.js');
8
+ var cliCommon = require('@backstage/cli-common');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
11
 
@@ -96,7 +96,7 @@ async function createDetectedModulesEntryPoint(options) {
96
96
  return [];
97
97
  }
98
98
  const legacyDetectedModulesPath = path.join(
99
- paths.paths.targetRoot,
99
+ cliCommon.targetPaths.rootDir,
100
100
  "node_modules",
101
101
  `${DETECTED_MODULES_MODULE_NAME}.js`
102
102
  );
@@ -2,14 +2,14 @@
2
2
 
3
3
  var fs = require('fs-extra');
4
4
  var path = require('node:path');
5
- var paths = require('../../../../lib/paths.cjs.js');
5
+ var cliCommon = require('@backstage/cli-common');
6
6
 
7
7
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
8
 
9
9
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
10
10
 
11
11
  function resolveBundlingPaths(options) {
12
- const { entry, targetDir = paths.paths.targetDir } = options;
12
+ const { entry, targetDir = cliCommon.targetPaths.dir } = options;
13
13
  const resolveTargetModule = (pathString) => {
14
14
  for (const ext of ["mjs", "js", "ts", "tsx", "jsx"]) {
15
15
  const filePath = path.resolve(targetDir, `${pathString}.${ext}`);
@@ -26,7 +26,9 @@ function resolveBundlingPaths(options) {
26
26
  } else {
27
27
  targetHtml = path.resolve(targetDir, `${entry}.html`);
28
28
  if (!fs__default.default.pathExistsSync(targetHtml)) {
29
- targetHtml = paths.paths.resolveOwn("templates/serve_index.html");
29
+ targetHtml = cliCommon.findOwnPaths(__dirname).resolve(
30
+ "templates/serve_index.html"
31
+ );
30
32
  }
31
33
  }
32
34
  const targetRunFile = path.resolve(targetDir, "src/run.ts");
@@ -41,10 +43,10 @@ function resolveBundlingPaths(options) {
41
43
  targetSrc: path.resolve(targetDir, "src"),
42
44
  targetDev: path.resolve(targetDir, "dev"),
43
45
  targetEntry: resolveTargetModule(entry),
44
- targetTsConfig: paths.paths.resolveTargetRoot("tsconfig.json"),
46
+ targetTsConfig: cliCommon.targetPaths.resolveRoot("tsconfig.json"),
45
47
  targetPackageJson: path.resolve(targetDir, "package.json"),
46
- rootNodeModules: paths.paths.resolveTargetRoot("node_modules"),
47
- root: paths.paths.targetRoot
48
+ rootNodeModules: cliCommon.targetPaths.resolveRoot("node_modules"),
49
+ root: cliCommon.targetPaths.rootDir
48
50
  };
49
51
  }
50
52
  async function resolveOptionalBundlingPaths(options) {
@@ -6,8 +6,8 @@ var path = require('node:path');
6
6
  var openBrowser = require('react-dev-utils/openBrowser');
7
7
  var core = require('@rspack/core');
8
8
  var devServer = require('@rspack/dev-server');
9
- var paths$1 = require('../../../../lib/paths.cjs.js');
10
- var config = require('../../../config/lib/config.cjs.js');
9
+ var cliCommon = require('@backstage/cli-common');
10
+ var config = require('../config.cjs.js');
11
11
  var config$1 = require('./config.cjs.js');
12
12
  var packageDetection = require('./packageDetection.cjs.js');
13
13
  var paths = require('./paths.cjs.js');
@@ -20,8 +20,8 @@ var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
20
20
  var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
21
21
 
22
22
  async function serveBundle(options) {
23
- const paths$2 = paths.resolveBundlingPaths(options);
24
- const targetPkg = await fs__default.default.readJson(paths$2.targetPackageJson);
23
+ const paths$1 = paths.resolveBundlingPaths(options);
24
+ const targetPkg = await fs__default.default.readJson(paths$1.targetPackageJson);
25
25
  if (options.verifyVersions) {
26
26
  if (targetPkg.dependencies?.["react-router"]?.includes("beta") || targetPkg.dependencies?.["react-router-dom"]?.includes("beta")) {
27
27
  console.warn(
@@ -35,7 +35,7 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
35
35
  }
36
36
  checkReactVersion();
37
37
  const { name } = await fs__default.default.readJson(
38
- path.resolve(options.targetDir ?? paths$1.paths.targetDir, "package.json")
38
+ path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "package.json")
39
39
  );
40
40
  let devServer$1 = void 0;
41
41
  let latestFrontendAppConfigs = [];
@@ -86,13 +86,13 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
86
86
  );
87
87
  const detectedModulesEntryPoint = await packageDetection.createDetectedModulesEntryPoint({
88
88
  config: fullConfig,
89
- targetPath: paths$2.targetPath,
89
+ targetPath: paths$1.targetPath,
90
90
  watch() {
91
91
  triggerReload();
92
92
  }
93
93
  });
94
94
  const moduleFederationSharedDependenciesEntryPoint = await moduleFederation.createRuntimeSharedDependenciesEntryPoint({
95
- targetPath: paths$2.targetPath,
95
+ targetPath: paths$1.targetPath,
96
96
  watch() {
97
97
  triggerReload();
98
98
  }
@@ -109,7 +109,7 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
109
109
  return latestFrontendAppConfigs;
110
110
  }
111
111
  };
112
- const config$2 = await config$1.createConfig(paths$2, {
112
+ const config$2 = await config$1.createConfig(paths$1, {
113
113
  ...commonConfigOptions,
114
114
  additionalEntryPoints: [
115
115
  ...detectedModulesEntryPoint,
@@ -141,9 +141,9 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
141
141
  publicPath: config$2.output?.publicPath,
142
142
  stats: "errors-warnings"
143
143
  },
144
- static: paths$2.targetPublic ? {
144
+ static: paths$1.targetPublic ? {
145
145
  publicPath: config$2.output?.publicPath,
146
- directory: paths$2.targetPublic
146
+ directory: paths$1.targetPublic
147
147
  } : void 0,
148
148
  historyApiFallback: options.moduleFederationRemote ? false : {
149
149
  // Paths with dots should still use the history fallback.
@@ -208,7 +208,7 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
208
208
  function checkReactVersion() {
209
209
  try {
210
210
  const reactPkgPath = require.resolve("react/package.json", {
211
- paths: [paths$1.paths.targetRoot]
211
+ paths: [cliCommon.targetPaths.rootDir]
212
212
  });
213
213
  const reactPkg = require(reactPkgPath);
214
214
  if (reactPkg.version.startsWith("16.")) {
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ var configLoader = require('@backstage/config-loader');
4
+ var config = require('@backstage/config');
5
+ var cliCommon = require('@backstage/cli-common');
6
+ var getPackages = require('@manypkg/get-packages');
7
+ var cliNode = require('@backstage/cli-node');
8
+ var path = require('node:path');
9
+
10
+ async function loadCliConfig(options) {
11
+ const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
12
+ const { packages } = await getPackages.getPackages(targetDir);
13
+ let localPackageNames;
14
+ if (options.fromPackage) {
15
+ if (packages.length) {
16
+ const graph = cliNode.PackageGraph.fromPackages(packages);
17
+ localPackageNames = Array.from(
18
+ graph.collectPackageNames([options.fromPackage], (node) => {
19
+ if (node.name === "@backstage/cli") {
20
+ return void 0;
21
+ }
22
+ return node.localDependencies.keys();
23
+ })
24
+ );
25
+ } else {
26
+ localPackageNames = [options.fromPackage];
27
+ }
28
+ } else {
29
+ localPackageNames = packages.map((p) => p.packageJson.name);
30
+ }
31
+ const schema = await configLoader.loadConfigSchema({
32
+ dependencies: localPackageNames,
33
+ packagePaths: [cliCommon.targetPaths.resolveRoot("package.json")]
34
+ });
35
+ const source = configLoader.ConfigSources.default({
36
+ allowMissingDefaultConfig: true,
37
+ watch: Boolean(options.watch),
38
+ rootDir: cliCommon.targetPaths.rootDir,
39
+ argv: options.args.flatMap((t) => ["--config", path.resolve(targetDir, t)])
40
+ });
41
+ const appConfigs = await new Promise((resolve, reject) => {
42
+ async function loadConfigReaderLoop() {
43
+ let loaded = false;
44
+ try {
45
+ const abortController = new AbortController();
46
+ for await (const { configs } of source.readConfigData({
47
+ signal: abortController.signal
48
+ })) {
49
+ if (loaded) {
50
+ const newFrontendAppConfigs = schema.process(configs, {
51
+ visibility: ["frontend"],
52
+ withFilteredKeys: options.withFilteredKeys,
53
+ ignoreSchemaErrors: true
54
+ });
55
+ options.watch?.(newFrontendAppConfigs);
56
+ } else {
57
+ resolve(configs);
58
+ loaded = true;
59
+ if (!options.watch) {
60
+ abortController.abort();
61
+ }
62
+ }
63
+ }
64
+ } catch (error) {
65
+ if (loaded) {
66
+ console.error(`Failed to reload configuration, ${error}`);
67
+ } else {
68
+ reject(error);
69
+ }
70
+ }
71
+ }
72
+ loadConfigReaderLoop();
73
+ });
74
+ const configurationLoadedMessage = appConfigs.length ? `Loaded config from ${appConfigs.map((c) => c.context).join(", ")}` : `No configuration files found, running without config`;
75
+ process.stderr.write(`${configurationLoadedMessage}
76
+ `);
77
+ const frontendAppConfigs = schema.process(appConfigs, {
78
+ visibility: ["frontend"],
79
+ withFilteredKeys: options.withFilteredKeys,
80
+ ignoreSchemaErrors: true
81
+ });
82
+ const frontendConfig = config.ConfigReader.fromConfigs(frontendAppConfigs);
83
+ const fullConfig = config.ConfigReader.fromConfigs(appConfigs);
84
+ return {
85
+ schema,
86
+ appConfigs,
87
+ frontendConfig,
88
+ frontendAppConfigs,
89
+ fullConfig
90
+ };
91
+ }
92
+
93
+ exports.loadCliConfig = loadCliConfig;
94
+ //# sourceMappingURL=config.cjs.js.map
@@ -27,8 +27,8 @@ function createScriptOptionsParser(anyCmd, commandPath) {
27
27
  cmd._storeOptionsAsProperties = false;
28
28
  cmd._optionValues = result;
29
29
  cmd.parseOptions(argsStr.split(" "));
30
- cmd._storeOptionsAsProperties = currentOpts;
31
- cmd._optionValues = currentStore;
30
+ cmd._optionValues = currentOpts;
31
+ cmd._storeOptionsAsProperties = currentStore;
32
32
  return result;
33
33
  };
34
34
  }
@@ -6,15 +6,13 @@ var path = require('node:path');
6
6
  var os = require('node:os');
7
7
  var tar = require('tar');
8
8
  var partition = require('lodash/partition');
9
- var paths = require('../../../../lib/paths.cjs.js');
10
9
  var cliCommon = require('@backstage/cli-common');
11
10
  var _package = require('../../../../packages/cli/package.json.cjs.js');
12
11
  var packager = require('../builder/packager.cjs.js');
13
12
  var types = require('../builder/types.cjs.js');
14
13
  var productionPack = require('./productionPack.cjs.js');
15
14
  var cliNode = require('@backstage/cli-node');
16
- var parallel = require('../../../../lib/parallel.cjs.js');
17
- var typeDistProject = require('../../../../lib/typeDistProject.cjs.js');
15
+ var typeDistProject = require('../typeDistProject.cjs.js');
18
16
 
19
17
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
20
18
 
@@ -111,7 +109,9 @@ async function createDistWorkspace(packageNames, options = {}) {
111
109
  targetDir: pkg.dir,
112
110
  packageJson: pkg.packageJson,
113
111
  outputs,
114
- logPrefix: `${chalk__default.default.cyan(path.relative(paths.paths.targetRoot, pkg.dir))}: `,
112
+ logPrefix: `${chalk__default.default.cyan(
113
+ path.relative(cliCommon.targetPaths.rootDir, pkg.dir)
114
+ )}: `,
115
115
  minify: options.minify,
116
116
  workspacePackages: packages
117
117
  });
@@ -119,7 +119,7 @@ async function createDistWorkspace(packageNames, options = {}) {
119
119
  }
120
120
  await packager.buildPackages(standardBuilds);
121
121
  if (customBuild.length > 0) {
122
- await parallel.runParallelWorkers({
122
+ await cliNode.runConcurrentTasks({
123
123
  items: customBuild,
124
124
  worker: async ({ name, dir, args }) => {
125
125
  await cliCommon.run(["yarn", "run", "build", ...args || []], {
@@ -141,11 +141,11 @@ async function createDistWorkspace(packageNames, options = {}) {
141
141
  for (const file of files) {
142
142
  const src = typeof file === "string" ? file : file.src;
143
143
  const dest = typeof file === "string" ? file : file.dest;
144
- await fs__default.default.copy(paths.paths.resolveTargetRoot(src), path.resolve(targetDir, dest));
144
+ await fs__default.default.copy(cliCommon.targetPaths.resolveRoot(src), path.resolve(targetDir, dest));
145
145
  }
146
146
  if (options.skeleton) {
147
147
  const skeletonFiles = targets.map((target) => {
148
- const dir = path.relative(paths.paths.targetRoot, target.dir);
148
+ const dir = path.relative(cliCommon.targetPaths.rootDir, target.dir);
149
149
  return path.join(dir, "package.json");
150
150
  }).sort();
151
151
  await tar__namespace.create(
@@ -175,7 +175,7 @@ async function moveToDistWorkspace(workspaceDir, localPackages, alwaysPack, enab
175
175
  await Promise.all(
176
176
  fastPackPackages.map(async (target) => {
177
177
  console.log(`Moving ${target.name} into dist workspace`);
178
- const outputDir = path.relative(paths.paths.targetRoot, target.dir);
178
+ const outputDir = path.relative(cliCommon.targetPaths.rootDir, target.dir);
179
179
  const absoluteOutputPath = path.resolve(workspaceDir, outputDir);
180
180
  await productionPack.productionPack({
181
181
  packageDir: target.dir,
@@ -190,7 +190,7 @@ async function moveToDistWorkspace(workspaceDir, localPackages, alwaysPack, enab
190
190
  await cliCommon.run(["yarn", "pack", "--filename", archivePath], {
191
191
  cwd: target.dir
192
192
  }).waitForExit();
193
- const outputDir = path.relative(paths.paths.targetRoot, target.dir);
193
+ const outputDir = path.relative(cliCommon.targetPaths.rootDir, target.dir);
194
194
  const absoluteOutputPath = path.resolve(workspaceDir, outputDir);
195
195
  await fs__default.default.ensureDir(absoluteOutputPath);
196
196
  await tar__namespace.extract({
@@ -223,7 +223,7 @@ async function moveToDistWorkspace(workspaceDir, localPackages, alwaysPack, enab
223
223
  for (const target of unsafePackages) {
224
224
  await pack(target, `temp-package.tgz`);
225
225
  }
226
- await parallel.runParallelWorkers({
226
+ await cliNode.runConcurrentTasks({
227
227
  items: safePackages.map((target, index) => ({ target, index })),
228
228
  worker: async ({ target, index }) => {
229
229
  await pack(target, `temp-package-${index}.tgz`);
@@ -3,8 +3,8 @@
3
3
  var fs = require('fs-extra');
4
4
  var npmPackList = require('npm-packlist');
5
5
  var path = require('node:path');
6
- var entryPoints = require('../../../../lib/entryPoints.cjs.js');
7
- var typeDistProject = require('../../../../lib/typeDistProject.cjs.js');
6
+ var entryPoints = require('../entryPoints.cjs.js');
7
+ var typeDistProject = require('../typeDistProject.cjs.js');
8
8
 
9
9
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
10
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs-extra');
4
- var paths = require('./paths.cjs.js');
4
+ var cliCommon = require('@backstage/cli-common');
5
5
  var cliNode = require('@backstage/cli-node');
6
6
 
7
7
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -12,7 +12,7 @@ async function findRoleFromCommand(opts) {
12
12
  if (opts.role) {
13
13
  return cliNode.PackageRoles.getRoleInfo(opts.role)?.role;
14
14
  }
15
- const pkg = await fs__default.default.readJson(paths.paths.resolveTarget("package.json"));
15
+ const pkg = await fs__default.default.readJson(cliCommon.targetPaths.resolve("package.json"));
16
16
  const info = cliNode.PackageRoles.getRoleFromPackage(pkg);
17
17
  if (!info) {
18
18
  throw new Error(`Target package must have 'backstage.role' set`);
@@ -7,7 +7,7 @@ var ServerDataStore = require('../ipc/ServerDataStore.cjs.js');
7
7
  var debounce = require('lodash/debounce');
8
8
  var node_url = require('node:url');
9
9
  var path = require('node:path');
10
- var paths = require('../../../../lib/paths.cjs.js');
10
+ var cliCommon = require('@backstage/cli-common');
11
11
  var spawn = require('cross-spawn');
12
12
 
13
13
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
@@ -86,7 +86,7 @@ async function runBackend(options) {
86
86
  ...process.env,
87
87
  BACKSTAGE_CLI_LINKED_WORKSPACE: options.linkedWorkspace,
88
88
  BACKSTAGE_CLI_CHANNEL: "1",
89
- ESBK_TSCONFIG_PATH: paths.paths.resolveTargetRoot("tsconfig.json")
89
+ ESBK_TSCONFIG_PATH: cliCommon.targetPaths.resolveRoot("tsconfig.json")
90
90
  },
91
91
  serialization: "advanced"
92
92
  }
@@ -3,11 +3,11 @@
3
3
  var cliNode = require('@backstage/cli-node');
4
4
  var path = require('node:path');
5
5
  var tsMorph = require('ts-morph');
6
- var paths = require('./paths.cjs.js');
6
+ var cliCommon = require('@backstage/cli-common');
7
7
 
8
8
  const createTypeDistProject = async () => {
9
9
  return new tsMorph.Project({
10
- tsConfigFilePath: paths.paths.resolveTargetRoot("tsconfig.json"),
10
+ tsConfigFilePath: cliCommon.targetPaths.resolveRoot("tsconfig.json"),
11
11
  skipAddingFilesFromTsConfig: true
12
12
  });
13
13
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var configLoader = require('@backstage/config-loader');
6
7
  var openBrowser = require('react-dev-utils/openBrowser');
7
8
  var chalk = require('chalk');
@@ -13,10 +14,25 @@ var openBrowser__default = /*#__PURE__*/_interopDefaultCompat(openBrowser);
13
14
  var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
14
15
 
15
16
  const DOCS_URL = "https://config.backstage.io";
16
- var docs = async (opts) => {
17
+ var docs = async ({ args, info }) => {
18
+ const {
19
+ flags: { package: pkg }
20
+ } = cleye.cli(
21
+ {
22
+ help: info,
23
+ flags: {
24
+ package: {
25
+ type: String,
26
+ description: "Only include the schema that applies to the given package"
27
+ }
28
+ }
29
+ },
30
+ void 0,
31
+ args
32
+ );
17
33
  const { schema: appSchemas } = await config.loadCliConfig({
18
34
  args: [],
19
- fromPackage: opts.package,
35
+ fromPackage: pkg,
20
36
  mockEnv: true
21
37
  });
22
38
  const schema = configLoader.mergeConfigSchemas(
@@ -2,20 +2,47 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var yaml = require('yaml');
6
7
  var config$1 = require('@backstage/config');
7
8
  var config = require('../lib/config.cjs.js');
8
9
 
9
- var print = async (opts) => {
10
+ var print = async ({ args, info }) => {
11
+ const {
12
+ flags: { config: config$1, lax, frontend, withSecrets, format, package: pkg }
13
+ } = cleye.cli(
14
+ {
15
+ help: info,
16
+ flags: {
17
+ package: { type: String, description: "Package to print config for" },
18
+ lax: {
19
+ type: Boolean,
20
+ description: "Do not require environment variables to be set"
21
+ },
22
+ frontend: { type: Boolean, description: "Only print frontend config" },
23
+ withSecrets: {
24
+ type: Boolean,
25
+ description: "Include secrets in the output"
26
+ },
27
+ format: { type: String, description: "Output format (yaml or json)" },
28
+ config: {
29
+ type: [String],
30
+ description: "Config files to load instead of app-config.yaml"
31
+ }
32
+ }
33
+ },
34
+ void 0,
35
+ args
36
+ );
10
37
  const { schema, appConfigs } = await config.loadCliConfig({
11
- args: opts.config,
12
- fromPackage: opts.package,
13
- mockEnv: opts.lax,
14
- fullVisibility: !opts.frontend
38
+ args: config$1,
39
+ fromPackage: pkg,
40
+ mockEnv: lax,
41
+ fullVisibility: !frontend
15
42
  });
16
- const visibility = getVisibilityOption(opts);
43
+ const visibility = getVisibilityOption(frontend, withSecrets);
17
44
  const data = serializeConfigData(appConfigs, schema, visibility);
18
- if (opts.format === "json") {
45
+ if (format === "json") {
19
46
  process.stdout.write(`${JSON.stringify(data, null, 2)}
20
47
  `);
21
48
  } else {
@@ -23,13 +50,13 @@ var print = async (opts) => {
23
50
  `);
24
51
  }
25
52
  };
26
- function getVisibilityOption(opts) {
27
- if (opts.frontend && opts.withSecrets) {
53
+ function getVisibilityOption(frontend, withSecrets) {
54
+ if (frontend && withSecrets) {
28
55
  throw new Error("Not allowed to combine frontend and secret config");
29
56
  }
30
- if (opts.frontend) {
57
+ if (frontend) {
31
58
  return "frontend";
32
- } else if (opts.withSecrets) {
59
+ } else if (withSecrets) {
33
60
  return "secret";
34
61
  }
35
62
  return "backend";
@@ -2,18 +2,36 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var yaml = require('yaml');
6
7
  var config = require('../lib/config.cjs.js');
7
8
  var configLoader = require('@backstage/config-loader');
8
9
 
9
- var schema = async (opts) => {
10
+ var schema = async ({ args, info }) => {
11
+ const {
12
+ flags: { merge, format, package: pkg }
13
+ } = cleye.cli(
14
+ {
15
+ help: info,
16
+ flags: {
17
+ package: { type: String, description: "Package to print schema for" },
18
+ format: { type: String, description: "Output format (yaml or json)" },
19
+ merge: {
20
+ type: Boolean,
21
+ description: "Merge all schemas into a single schema"
22
+ }
23
+ }
24
+ },
25
+ void 0,
26
+ args
27
+ );
10
28
  const { schema } = await config.loadCliConfig({
11
29
  args: [],
12
- fromPackage: opts.package,
30
+ fromPackage: pkg,
13
31
  mockEnv: true
14
32
  });
15
33
  let configSchema;
16
- if (opts.merge) {
34
+ if (merge) {
17
35
  configSchema = configLoader.mergeConfigSchemas(
18
36
  schema.serialize().schemas.map(
19
37
  (_) => _.value
@@ -24,7 +42,7 @@ var schema = async (opts) => {
24
42
  } else {
25
43
  configSchema = schema.serialize();
26
44
  }
27
- if (opts.format === "json") {
45
+ if (format === "json") {
28
46
  process.stdout.write(`${JSON.stringify(configSchema, null, 2)}
29
47
  `);
30
48
  } else {
@@ -2,16 +2,46 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var cleye = require('cleye');
5
6
  var config = require('../lib/config.cjs.js');
6
7
 
7
- var validate = async (opts) => {
8
+ var validate = async ({ args, info }) => {
9
+ const {
10
+ flags: { config: config$1, lax, frontend, deprecated, strict, package: pkg }
11
+ } = cleye.cli(
12
+ {
13
+ help: info,
14
+ flags: {
15
+ package: {
16
+ type: String,
17
+ description: "Package to validate config for"
18
+ },
19
+ lax: {
20
+ type: Boolean,
21
+ description: "Do not require environment variables to be set"
22
+ },
23
+ frontend: {
24
+ type: Boolean,
25
+ description: "Only validate frontend config"
26
+ },
27
+ deprecated: { type: Boolean, description: "Output deprecated keys" },
28
+ strict: { type: Boolean, description: "Enable strict validation" },
29
+ config: {
30
+ type: [String],
31
+ description: "Config files to load instead of app-config.yaml"
32
+ }
33
+ }
34
+ },
35
+ void 0,
36
+ args
37
+ );
8
38
  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
39
+ args: config$1,
40
+ fromPackage: pkg,
41
+ mockEnv: lax,
42
+ fullVisibility: !frontend,
43
+ withDeprecatedKeys: deprecated,
44
+ strict
15
45
  });
16
46
  };
17
47