@backstage/cli 0.35.4-next.2 → 0.35.5-next.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.
- package/CHANGELOG.md +55 -0
- package/dist/index.cjs.js +1 -0
- package/dist/lib/cache/SuccessCache.cjs.js +2 -2
- package/dist/lib/typeDistProject.cjs.js +2 -2
- package/dist/lib/version.cjs.js +4 -3
- package/dist/lib/yarnPlugin.cjs.js +2 -2
- package/dist/modules/build/commands/package/build/command.cjs.js +16 -8
- package/dist/modules/build/commands/package/start/command.cjs.js +3 -3
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +2 -2
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +5 -7
- package/dist/modules/build/commands/repo/build.cjs.js +6 -7
- package/dist/modules/build/commands/repo/start.cjs.js +3 -3
- package/dist/modules/build/index.cjs.js +6 -0
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -2
- package/dist/modules/build/lib/buildFrontend.cjs.js +4 -8
- package/dist/modules/build/lib/builder/config.cjs.js +5 -5
- package/dist/modules/build/lib/builder/packager.cjs.js +7 -8
- package/dist/modules/build/lib/bundler/bundle.cjs.js +9 -2
- package/dist/modules/build/lib/bundler/config.cjs.js +20 -78
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +99 -16
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/paths.cjs.js +8 -6
- package/dist/modules/build/lib/bundler/server.cjs.js +24 -14
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +9 -9
- package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
- package/dist/{lib → modules/build/lib}/role.cjs.js +2 -2
- package/dist/modules/build/lib/runner/runBackend.cjs.js +2 -2
- package/dist/modules/config/lib/config.cjs.js +4 -4
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +2 -2
- package/dist/modules/info/commands/info.cjs.js +4 -5
- package/dist/modules/lint/commands/package/lint.cjs.js +4 -4
- package/dist/modules/lint/commands/repo/lint.cjs.js +8 -9
- package/dist/modules/maintenance/commands/package/clean.cjs.js +4 -4
- package/dist/modules/maintenance/commands/package/pack.cjs.js +5 -5
- package/dist/modules/maintenance/commands/repo/clean.cjs.js +3 -4
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +7 -7
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +4 -4
- package/dist/modules/migrate/commands/packageRole.cjs.js +2 -2
- package/dist/modules/migrate/commands/versions/bump.cjs.js +8 -9
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +2 -2
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +2 -3
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +4 -4
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +1 -2
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +2 -2
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +2 -2
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +2 -2
- package/dist/modules/test/commands/package/test.cjs.js +1 -2
- package/dist/modules/test/commands/repo/test.cjs.js +3 -4
- package/dist/modules/test/index.cjs.js +3 -1
- package/dist/modules/translations/commands/export.cjs.js +104 -0
- package/dist/modules/translations/commands/import.cjs.js +141 -0
- package/dist/modules/translations/index.cjs.js +59 -0
- package/dist/modules/translations/lib/discoverPackages.cjs.js +121 -0
- package/dist/modules/translations/lib/extractTranslations.cjs.js +71 -0
- package/dist/modules/translations/lib/messageFilePath.cjs.js +43 -0
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/catalog-client/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +7 -6
- package/dist/packages/core-app-api/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/test-utils/package.json.cjs.js +1 -1
- package/dist/packages/theme/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
- package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
- package/package.json +28 -27
- package/dist/lib/parallel.cjs.js +0 -141
- package/dist/lib/paths.cjs.js +0 -8
- /package/dist/{lib → modules/build/lib}/entryPoints.cjs.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @backstage/cli
|
|
2
2
|
|
|
3
|
+
## 0.35.5-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 246877a: Updated dependency `bfj` to `^9.0.2`.
|
|
8
|
+
- bba2e49: Internal refactor to use new concurrency utilities from `@backstage/cli-node`.
|
|
9
|
+
- fd50cb3: Added `translations export` and `translations import` commands for managing translation files.
|
|
10
|
+
|
|
11
|
+
The `translations export` command discovers all `TranslationRef` definitions across frontend plugin dependencies and exports their default messages as JSON files. The `translations import` command generates `TranslationResource` wiring code from translated JSON files, ready to be plugged into the app.
|
|
12
|
+
|
|
13
|
+
Both commands support a `--pattern` option for controlling the message file layout, for example `--pattern '{lang}/{id}.json'` for language-based directory grouping.
|
|
14
|
+
|
|
15
|
+
- 6738cf0: build(deps): bump `minimatch` from 9.0.5 to 10.2.1
|
|
16
|
+
- 70fc178: Migrated from deprecated `findPaths` to `targetPaths` and `findOwnPaths` from `@backstage/cli-common`.
|
|
17
|
+
- de62a9d: Upgraded `commander` dependency from `^12.0.0` to `^14.0.3` across all CLI packages.
|
|
18
|
+
- 092b41f: Updated dependency `webpack` to `~5.105.0`.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/cli-common@0.2.0-next.0
|
|
21
|
+
- @backstage/cli-node@0.2.19-next.0
|
|
22
|
+
- @backstage/eslint-plugin@0.2.2-next.0
|
|
23
|
+
- @backstage/integration@1.21.0-next.0
|
|
24
|
+
- @backstage/config-loader@1.10.9-next.0
|
|
25
|
+
- @backstage/catalog-model@1.7.6
|
|
26
|
+
- @backstage/config@1.3.6
|
|
27
|
+
- @backstage/errors@1.2.7
|
|
28
|
+
- @backstage/module-federation-common@0.1.0
|
|
29
|
+
- @backstage/release-manifests@0.0.13
|
|
30
|
+
- @backstage/types@1.2.2
|
|
31
|
+
|
|
32
|
+
## 0.35.4
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- cfd8103: Updated catalog provider module template to use stable catalog extension points from `@backstage/plugin-catalog-node` instead of alpha exports.
|
|
37
|
+
- 20131c5: Added support for CSS exports in package builds. When a package declares a CSS file in its `exports` field (e.g., `"./styles.css": "./src/styles.css"`), the CLI will automatically bundle it during `backstage-cli package build`, resolving any `@import` statements. The export path is rewritten from `src/` to `dist/` at publish time.
|
|
38
|
+
|
|
39
|
+
Fixed `backstage-cli repo fix` to not add `typesVersions` entries for non-script exports like CSS files.
|
|
40
|
+
|
|
41
|
+
- 7455dae: Use node prefix on native imports
|
|
42
|
+
- 6ce4a13: Removed `/alpha` from `scaffolderActionsExtensionPoint` import
|
|
43
|
+
- fdbd404: Removed the `EXPERIMENTAL_MODULE_FEDERATION` environment variable flag, making module federation host support always available during `package start`. The host shared dependencies are now managed through `@backstage/module-federation-common` and injected as a versioned runtime script at build time.
|
|
44
|
+
- fdbd404: Updated `@module-federation/enhanced`, `@module-federation/runtime`, and `@module-federation/sdk` dependencies from `^0.9.0` to `^0.21.6`.
|
|
45
|
+
- 4fc7bf0: Bump to tar v7
|
|
46
|
+
- 5e3ef57: Added support for the new `peerModules` metadata field in `package.json`. This field allows plugin packages to declare modules that should be installed alongside them for cross-plugin integrations. The field is validated by `backstage-cli repo fix --publish`.
|
|
47
|
+
- 122d39c: Completely removed support for the deprecated `app.experimental.packages` configuration. Replace existing usage directly with `app.packages`.
|
|
48
|
+
- 73351c2: Updated dependency `webpack` to `~5.104.0`.
|
|
49
|
+
- 69d880e: Bump to latest zod to ensure it has the latest features
|
|
50
|
+
- Updated dependencies
|
|
51
|
+
- @backstage/integration@1.20.0
|
|
52
|
+
- @backstage/config-loader@1.10.8
|
|
53
|
+
- @backstage/eslint-plugin@0.2.1
|
|
54
|
+
- @backstage/cli-common@0.1.18
|
|
55
|
+
- @backstage/cli-node@0.2.18
|
|
56
|
+
- @backstage/module-federation-common@0.1.0
|
|
57
|
+
|
|
3
58
|
## 0.35.4-next.2
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -13,6 +13,7 @@ var CliInitializer = require('./wiring/CliInitializer.cjs.js');
|
|
|
13
13
|
initializer.add(import('./modules/migrate/index.cjs.js'));
|
|
14
14
|
initializer.add(import('./modules/new/index.cjs.js'));
|
|
15
15
|
initializer.add(import('./modules/test/index.cjs.js'));
|
|
16
|
+
initializer.add(import('./modules/translations/index.cjs.js'));
|
|
16
17
|
await initializer.run();
|
|
17
18
|
})();
|
|
18
19
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var
|
|
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
|
|
|
@@ -18,7 +18,7 @@ class SuccessCache {
|
|
|
18
18
|
* location.
|
|
19
19
|
*/
|
|
20
20
|
static trimPaths(input) {
|
|
21
|
-
return input.replaceAll(
|
|
21
|
+
return input.replaceAll(cliCommon.targetPaths.rootDir, "");
|
|
22
22
|
}
|
|
23
23
|
constructor(name, basePath) {
|
|
24
24
|
this.#path = path.resolve(basePath ?? DEFAULT_CACHE_BASE_PATH, name);
|
|
@@ -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
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
7
|
|
|
8
8
|
const createTypeDistProject = async () => {
|
|
9
9
|
return new tsMorph.Project({
|
|
10
|
-
tsConfigFilePath:
|
|
10
|
+
tsConfigFilePath: cliCommon.targetPaths.resolveRoot("tsconfig.json"),
|
|
11
11
|
skipAddingFilesFromTsConfig: true
|
|
12
12
|
});
|
|
13
13
|
};
|
package/dist/lib/version.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var semver = require('semver');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var _package$k = require('../packages/backend-plugin-api/package.json.cjs.js');
|
|
7
7
|
var _package$j = require('../packages/backend-test-utils/package.json.cjs.js');
|
|
8
8
|
var _package$i = require('../packages/catalog-client/package.json.cjs.js');
|
|
@@ -31,6 +31,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
31
31
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
32
32
|
var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
|
|
33
33
|
|
|
34
|
+
const ownPaths = cliCommon.findOwnPaths(__dirname);
|
|
34
35
|
const packageVersions = {
|
|
35
36
|
"@backstage/backend-defaults": _package$l.version,
|
|
36
37
|
"@backstage/backend-plugin-api": _package$k.version,
|
|
@@ -56,11 +57,11 @@ const packageVersions = {
|
|
|
56
57
|
"@backstage/plugin-catalog-node": _package.version
|
|
57
58
|
};
|
|
58
59
|
function findVersion() {
|
|
59
|
-
const pkgContent = fs__default.default.readFileSync(
|
|
60
|
+
const pkgContent = fs__default.default.readFileSync(ownPaths.resolve("package.json"), "utf8");
|
|
60
61
|
return JSON.parse(pkgContent).version;
|
|
61
62
|
}
|
|
62
63
|
const version = findVersion();
|
|
63
|
-
fs__default.default.pathExistsSync(
|
|
64
|
+
fs__default.default.pathExistsSync(ownPaths.resolve("src"));
|
|
64
65
|
function createPackageVersionProvider(lockfile, options) {
|
|
65
66
|
return (name, versionHint) => {
|
|
66
67
|
const packageVersion = packageVersions[name];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var yaml = require('yaml');
|
|
5
5
|
var z = require('zod');
|
|
6
|
-
var
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ const yarnRcSchema = z__default.default.object({
|
|
|
19
19
|
).optional()
|
|
20
20
|
});
|
|
21
21
|
async function getHasYarnPlugin() {
|
|
22
|
-
const yarnRcPath =
|
|
22
|
+
const yarnRcPath = cliCommon.targetPaths.resolveRoot(".yarnrc.yml");
|
|
23
23
|
const yarnRcContent = await fs__default.default.readFile(yarnRcPath, "utf-8").catch((e) => {
|
|
24
24
|
if (e.code === "ENOENT") {
|
|
25
25
|
return "";
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var packager = require('../../../lib/builder/packager.cjs.js');
|
|
5
5
|
var types = require('../../../lib/builder/types.cjs.js');
|
|
6
|
-
var role = require('
|
|
6
|
+
var role = require('../../../lib/role.cjs.js');
|
|
7
7
|
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var
|
|
8
|
+
var cliCommon = require('@backstage/cli-common');
|
|
9
9
|
var buildFrontend = require('../../../lib/buildFrontend.cjs.js');
|
|
10
10
|
var buildBackend = require('../../../lib/buildBackend.cjs.js');
|
|
11
11
|
var urls = require('../../../lib/urls.cjs.js');
|
|
@@ -24,34 +24,42 @@ async function command(opts) {
|
|
|
24
24
|
if (urls.isValidUrl(arg)) {
|
|
25
25
|
return arg;
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return cliCommon.targetPaths.resolve(arg);
|
|
28
28
|
});
|
|
29
29
|
if (role$1 === "frontend") {
|
|
30
30
|
return buildFrontend.buildFrontend({
|
|
31
|
-
targetDir:
|
|
31
|
+
targetDir: cliCommon.targetPaths.dir,
|
|
32
32
|
configPaths,
|
|
33
33
|
writeStats: Boolean(opts.stats),
|
|
34
34
|
webpack
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
return buildBackend.buildBackend({
|
|
38
|
-
targetDir:
|
|
38
|
+
targetDir: cliCommon.targetPaths.dir,
|
|
39
39
|
configPaths,
|
|
40
40
|
skipBuildDependencies: Boolean(opts.skipBuildDependencies),
|
|
41
41
|
minify: Boolean(opts.minify)
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
let isModuleFederationRemote = void 0;
|
|
44
45
|
if (role$1 === "frontend-dynamic-container") {
|
|
45
46
|
console.log(
|
|
46
47
|
chalk__default.default.yellow(
|
|
47
48
|
`\u26A0\uFE0F WARNING: The 'frontend-dynamic-container' package role is experimental and will receive immediate breaking changes in the future.`
|
|
48
49
|
)
|
|
49
50
|
);
|
|
51
|
+
isModuleFederationRemote = true;
|
|
52
|
+
}
|
|
53
|
+
if (opts.moduleFederation) {
|
|
54
|
+
isModuleFederationRemote = true;
|
|
55
|
+
}
|
|
56
|
+
if (isModuleFederationRemote) {
|
|
57
|
+
console.log("Building package as a module federation remote");
|
|
50
58
|
return buildFrontend.buildFrontend({
|
|
51
|
-
targetDir:
|
|
59
|
+
targetDir: cliCommon.targetPaths.dir,
|
|
52
60
|
configPaths: [],
|
|
53
61
|
writeStats: Boolean(opts.stats),
|
|
54
|
-
isModuleFederationRemote
|
|
62
|
+
isModuleFederationRemote,
|
|
55
63
|
webpack
|
|
56
64
|
});
|
|
57
65
|
}
|
|
@@ -67,7 +75,7 @@ async function command(opts) {
|
|
|
67
75
|
outputs.add(types.Output.types);
|
|
68
76
|
}
|
|
69
77
|
const packageJson = await fs__default.default.readJson(
|
|
70
|
-
|
|
78
|
+
cliCommon.targetPaths.resolve("package.json")
|
|
71
79
|
);
|
|
72
80
|
return packager.buildPackage({
|
|
73
81
|
outputs,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var startPackage = require('./startPackage.cjs.js');
|
|
4
4
|
var resolveLinkedWorkspace = require('./resolveLinkedWorkspace.cjs.js');
|
|
5
|
-
var role = require('
|
|
6
|
-
var
|
|
5
|
+
var role = require('../../../lib/role.cjs.js');
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
7
|
|
|
8
8
|
async function command(opts) {
|
|
9
9
|
await startPackage.startPackage({
|
|
10
10
|
role: await role.findRoleFromCommand(opts),
|
|
11
11
|
entrypoint: opts.entrypoint,
|
|
12
|
-
targetDir:
|
|
12
|
+
targetDir: cliCommon.targetPaths.dir,
|
|
13
13
|
configPaths: opts.config,
|
|
14
14
|
checksEnabled: Boolean(opts.check),
|
|
15
15
|
linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(opts.link),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var runBackend = require('../../../lib/runner/runBackend.cjs.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -22,7 +22,7 @@ async function startBackend(options) {
|
|
|
22
22
|
}
|
|
23
23
|
async function startBackendPlugin(options) {
|
|
24
24
|
const hasDevIndexEntry = await fs__default.default.pathExists(
|
|
25
|
-
path.resolve(options.targetDir ??
|
|
25
|
+
path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "dev/index.ts")
|
|
26
26
|
);
|
|
27
27
|
if (!hasDevIndexEntry) {
|
|
28
28
|
console.warn(
|
|
@@ -11,9 +11,8 @@ require('ts-checker-rspack-plugin');
|
|
|
11
11
|
require('html-webpack-plugin');
|
|
12
12
|
require('react-dev-utils/ModuleScopePlugin');
|
|
13
13
|
require('@module-federation/enhanced/rspack');
|
|
14
|
-
var paths = require('../../../../../lib/paths.cjs.js');
|
|
15
14
|
require('lodash/pickBy');
|
|
16
|
-
require('@backstage/cli-common');
|
|
15
|
+
var cliCommon = require('@backstage/cli-common');
|
|
17
16
|
require('../../../../../lib/version.cjs.js');
|
|
18
17
|
var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
|
|
19
18
|
require('@manypkg/get-packages');
|
|
@@ -24,7 +23,7 @@ var server = require('../../../lib/bundler/server.cjs.js');
|
|
|
24
23
|
|
|
25
24
|
async function startFrontend(options) {
|
|
26
25
|
const packageJson = await fs.readJson(
|
|
27
|
-
path.resolve(options.targetDir ??
|
|
26
|
+
path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "package.json")
|
|
28
27
|
);
|
|
29
28
|
if (!hasReactDomClient.hasReactDomClient()) {
|
|
30
29
|
console.warn(
|
|
@@ -39,11 +38,10 @@ async function startFrontend(options) {
|
|
|
39
38
|
verifyVersions: options.verifyVersions,
|
|
40
39
|
skipOpenBrowser: options.skipOpenBrowser,
|
|
41
40
|
linkedWorkspace: options.linkedWorkspace,
|
|
42
|
-
|
|
41
|
+
moduleFederationRemote: options.isModuleFederationRemote ? await moduleFederation.getModuleFederationRemoteOptions(
|
|
43
42
|
packageJson,
|
|
44
|
-
path.resolve(
|
|
45
|
-
|
|
46
|
-
)
|
|
43
|
+
path.resolve(cliCommon.targetPaths.dir)
|
|
44
|
+
) : void 0
|
|
47
45
|
});
|
|
48
46
|
await waitForExit();
|
|
49
47
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var path = require('node:path');
|
|
5
5
|
var packager = require('../../lib/builder/packager.cjs.js');
|
|
6
|
-
var
|
|
6
|
+
var cliCommon = require('@backstage/cli-common');
|
|
7
7
|
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var parallel = require('../../../../lib/parallel.cjs.js');
|
|
9
8
|
var buildFrontend = require('../../lib/buildFrontend.cjs.js');
|
|
10
9
|
var buildBackend = require('../../lib/buildBackend.cjs.js');
|
|
11
10
|
var optionsParser = require('../../../../lib/optionsParser.cjs.js');
|
|
@@ -61,7 +60,7 @@ async function command(opts, cmd) {
|
|
|
61
60
|
targetDir: pkg.dir,
|
|
62
61
|
packageJson: pkg.packageJson,
|
|
63
62
|
outputs,
|
|
64
|
-
logPrefix: `${chalk__default.default.cyan(path.relative(
|
|
63
|
+
logPrefix: `${chalk__default.default.cyan(path.relative(cliCommon.targetPaths.rootDir, pkg.dir))}: `,
|
|
65
64
|
workspacePackages: packages,
|
|
66
65
|
minify: opts.minify ?? buildOptions.minify
|
|
67
66
|
};
|
|
@@ -70,9 +69,9 @@ async function command(opts, cmd) {
|
|
|
70
69
|
await packager.buildPackages(options);
|
|
71
70
|
if (opts.all) {
|
|
72
71
|
console.log("Building apps");
|
|
73
|
-
await
|
|
72
|
+
await cliNode.runConcurrentTasks({
|
|
74
73
|
items: apps,
|
|
75
|
-
|
|
74
|
+
concurrencyFactor: 1 / 2,
|
|
76
75
|
worker: async (pkg) => {
|
|
77
76
|
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
78
77
|
if (!buildOptions) {
|
|
@@ -90,9 +89,9 @@ async function command(opts, cmd) {
|
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
console.log("Building backends");
|
|
93
|
-
await
|
|
92
|
+
await cliNode.runConcurrentTasks({
|
|
94
93
|
items: backends,
|
|
95
|
-
|
|
94
|
+
concurrencyFactor: 1 / 2,
|
|
96
95
|
worker: async (pkg) => {
|
|
97
96
|
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
98
97
|
if (!buildOptions) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var cliNode = require('@backstage/cli-node');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var
|
|
5
|
+
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var resolveLinkedWorkspace = require('../package/start/resolveLinkedWorkspace.cjs.js');
|
|
7
7
|
var startPackage = require('../package/start/startPackage.cjs.js');
|
|
8
8
|
var node_util = require('node:util');
|
|
@@ -47,7 +47,7 @@ async function findTargetPackages(namesOrPaths, pluginIds) {
|
|
|
47
47
|
(pkg) => nameOrPath === pkg.packageJson.name
|
|
48
48
|
);
|
|
49
49
|
if (!matchingPackage) {
|
|
50
|
-
const absPath =
|
|
50
|
+
const absPath = cliCommon.targetPaths.resolveRoot(nameOrPath);
|
|
51
51
|
matchingPackage = packages.find(
|
|
52
52
|
(pkg) => path.relative(pkg.dir, absPath) === ""
|
|
53
53
|
);
|
|
@@ -65,7 +65,7 @@ async function findTargetPackages(namesOrPaths, pluginIds) {
|
|
|
65
65
|
(pkg) => pkg.packageJson.backstage?.role === role
|
|
66
66
|
);
|
|
67
67
|
if (matchingPackages.length > 1) {
|
|
68
|
-
const expectedPath =
|
|
68
|
+
const expectedPath = cliCommon.targetPaths.resolveRoot(
|
|
69
69
|
role === "frontend" ? "packages/app" : "packages/backend"
|
|
70
70
|
);
|
|
71
71
|
const matchByPath = matchingPackages.find(
|
|
@@ -22,6 +22,9 @@ function registerPackageCommands(command) {
|
|
|
22
22
|
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
23
23
|
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
24
24
|
Array()
|
|
25
|
+
).option(
|
|
26
|
+
"--module-federation",
|
|
27
|
+
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
25
28
|
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
26
29
|
}
|
|
27
30
|
const buildPlugin = factory.createCliPlugin({
|
|
@@ -49,6 +52,9 @@ const buildPlugin = factory.createCliPlugin({
|
|
|
49
52
|
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
50
53
|
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
51
54
|
Array()
|
|
55
|
+
).option(
|
|
56
|
+
"--module-federation",
|
|
57
|
+
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
52
58
|
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
53
59
|
await defaultCommand.parseAsync(args, { from: "user" });
|
|
54
60
|
}
|
|
@@ -5,7 +5,6 @@ var fs = require('fs-extra');
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var tar = require('tar');
|
|
7
7
|
var createDistWorkspace = require('./packager/createDistWorkspace.cjs.js');
|
|
8
|
-
var parallel = require('../../../lib/parallel.cjs.js');
|
|
9
8
|
var packager = require('./builder/packager.cjs.js');
|
|
10
9
|
var types = require('./builder/types.cjs.js');
|
|
11
10
|
var cliNode = require('@backstage/cli-node');
|
|
@@ -53,7 +52,6 @@ async function buildBackend(options) {
|
|
|
53
52
|
configPaths,
|
|
54
53
|
buildDependencies: !skipBuildDependencies,
|
|
55
54
|
buildExcludes: [pkg.name],
|
|
56
|
-
parallelism: parallel.getEnvironmentParallelism(),
|
|
57
55
|
skeleton: SKELETON_FILE,
|
|
58
56
|
minify
|
|
59
57
|
});
|
|
@@ -8,7 +8,7 @@ require('chalk');
|
|
|
8
8
|
require('react-dev-utils/openBrowser');
|
|
9
9
|
require('@rspack/core');
|
|
10
10
|
require('@rspack/dev-server');
|
|
11
|
-
require('
|
|
11
|
+
require('@backstage/cli-common');
|
|
12
12
|
var config = require('../../config/lib/config.cjs.js');
|
|
13
13
|
require('eslint-rspack-plugin');
|
|
14
14
|
require('ts-checker-rspack-plugin');
|
|
@@ -16,12 +16,10 @@ require('html-webpack-plugin');
|
|
|
16
16
|
require('react-dev-utils/ModuleScopePlugin');
|
|
17
17
|
require('@module-federation/enhanced/rspack');
|
|
18
18
|
require('lodash/pickBy');
|
|
19
|
-
require('@backstage/cli-common');
|
|
20
19
|
require('../../../lib/version.cjs.js');
|
|
21
20
|
require('yn');
|
|
22
21
|
require('@manypkg/get-packages');
|
|
23
22
|
require('./bundler/packageDetection.cjs.js');
|
|
24
|
-
var parallel = require('../../../lib/parallel.cjs.js');
|
|
25
23
|
|
|
26
24
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
27
25
|
|
|
@@ -35,13 +33,11 @@ async function buildFrontend(options) {
|
|
|
35
33
|
await bundle.buildBundle({
|
|
36
34
|
targetDir,
|
|
37
35
|
entry: "src/index",
|
|
38
|
-
parallelism: parallel.getEnvironmentParallelism(),
|
|
39
36
|
statsJsonEnabled: writeStats,
|
|
40
|
-
|
|
37
|
+
moduleFederationRemote: options.isModuleFederationRemote ? await moduleFederation.getModuleFederationRemoteOptions(
|
|
41
38
|
packageJson,
|
|
42
|
-
path.resolve(targetDir)
|
|
43
|
-
|
|
44
|
-
),
|
|
39
|
+
path.resolve(targetDir)
|
|
40
|
+
) : void 0,
|
|
45
41
|
...await config.loadCliConfig({
|
|
46
42
|
args: configPaths,
|
|
47
43
|
fromPackage: packageJson.name
|
|
@@ -13,8 +13,8 @@ var json = require('@rollup/plugin-json');
|
|
|
13
13
|
var yaml = require('@rollup/plugin-yaml');
|
|
14
14
|
var plugins = require('./plugins.cjs.js');
|
|
15
15
|
var types = require('./types.cjs.js');
|
|
16
|
-
var
|
|
17
|
-
var entryPoints = require('
|
|
16
|
+
var cliCommon = require('@backstage/cli-common');
|
|
17
|
+
var entryPoints = require('../entryPoints.cjs.js');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
20
|
|
|
@@ -85,7 +85,7 @@ function multiOutputFormat() {
|
|
|
85
85
|
}
|
|
86
86
|
async function makeRollupConfigs(options) {
|
|
87
87
|
const configs = new Array();
|
|
88
|
-
const targetDir = options.targetDir ??
|
|
88
|
+
const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
|
|
89
89
|
let targetPkg = options.packageJson;
|
|
90
90
|
if (!targetPkg) {
|
|
91
91
|
const packagePath = path.resolve(targetDir, "package.json");
|
|
@@ -219,9 +219,9 @@ async function makeRollupConfigs(options) {
|
|
|
219
219
|
const input = Object.fromEntries(
|
|
220
220
|
scriptEntryPoints.map((e) => [
|
|
221
221
|
e.name,
|
|
222
|
-
|
|
222
|
+
cliCommon.targetPaths.resolveRoot(
|
|
223
223
|
"dist-types",
|
|
224
|
-
path.relative(
|
|
224
|
+
path.relative(cliCommon.targetPaths.rootDir, targetDir),
|
|
225
225
|
e.path.replace(/\.(?:ts|tsx)$/, ".d.ts")
|
|
226
226
|
)
|
|
227
227
|
])
|
|
@@ -4,11 +4,10 @@ var fs = require('fs-extra');
|
|
|
4
4
|
var rollup = require('rollup');
|
|
5
5
|
var chalk = require('chalk');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var
|
|
7
|
+
var cliCommon = require('@backstage/cli-common');
|
|
8
8
|
var config = require('./config.cjs.js');
|
|
9
9
|
var types = require('./types.cjs.js');
|
|
10
10
|
var cliNode = require('@backstage/cli-node');
|
|
11
|
-
var parallel = require('../../../../lib/parallel.cjs.js');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
13
|
|
|
@@ -26,7 +25,7 @@ function formatErrorMessage(error) {
|
|
|
26
25
|
`;
|
|
27
26
|
for (const { text, location } of error.errors) {
|
|
28
27
|
const { line, column } = location;
|
|
29
|
-
const path$1 = path.relative(
|
|
28
|
+
const path$1 = path.relative(cliCommon.targetPaths.dir, error.id);
|
|
30
29
|
const loc = chalk__default.default.cyan(`${path$1}:${line}:${column}`);
|
|
31
30
|
if (text === 'Unexpected "<"' && error.id.endsWith(".js")) {
|
|
32
31
|
msg += `${loc}: ${text}, JavaScript files with JSX should use a .jsx extension`;
|
|
@@ -41,12 +40,12 @@ function formatErrorMessage(error) {
|
|
|
41
40
|
}
|
|
42
41
|
} else {
|
|
43
42
|
if (error.loc) {
|
|
44
|
-
const file = `${
|
|
43
|
+
const file = `${cliCommon.targetPaths.resolve(error.loc.file || error.id)}`;
|
|
45
44
|
const pos = `${error.loc.line}:${error.loc.column}`;
|
|
46
45
|
msg += `${file} [${pos}]
|
|
47
46
|
`;
|
|
48
47
|
} else if (error.id) {
|
|
49
|
-
msg += `${
|
|
48
|
+
msg += `${cliCommon.targetPaths.resolve(error.id)}
|
|
50
49
|
`;
|
|
51
50
|
}
|
|
52
51
|
msg += `${error}
|
|
@@ -78,7 +77,7 @@ async function rollupBuild(config) {
|
|
|
78
77
|
const buildPackage = async (options) => {
|
|
79
78
|
try {
|
|
80
79
|
const { resolutions } = await fs__default.default.readJson(
|
|
81
|
-
|
|
80
|
+
cliCommon.targetPaths.resolveRoot("package.json")
|
|
82
81
|
);
|
|
83
82
|
if (resolutions?.esbuild) {
|
|
84
83
|
console.warn(
|
|
@@ -90,7 +89,7 @@ const buildPackage = async (options) => {
|
|
|
90
89
|
} catch {
|
|
91
90
|
}
|
|
92
91
|
const rollupConfigs = await config.makeRollupConfigs(options);
|
|
93
|
-
const targetDir = options.targetDir ??
|
|
92
|
+
const targetDir = options.targetDir ?? cliCommon.targetPaths.dir;
|
|
94
93
|
await fs__default.default.remove(path.resolve(targetDir, "dist"));
|
|
95
94
|
const buildTasks = rollupConfigs.map(rollupBuild);
|
|
96
95
|
await Promise.all(buildTasks);
|
|
@@ -104,7 +103,7 @@ const buildPackages = async (options) => {
|
|
|
104
103
|
options.map(({ targetDir }) => fs__default.default.remove(path.resolve(targetDir, "dist")))
|
|
105
104
|
);
|
|
106
105
|
const buildTasks = rollupConfigs.flat().map((opts) => () => rollupBuild(opts));
|
|
107
|
-
await
|
|
106
|
+
await cliNode.runConcurrentTasks({
|
|
108
107
|
items: buildTasks,
|
|
109
108
|
worker: async (task) => task()
|
|
110
109
|
});
|
|
@@ -10,6 +10,7 @@ var config = require('./config.cjs.js');
|
|
|
10
10
|
var paths = require('./paths.cjs.js');
|
|
11
11
|
var chalk = require('chalk');
|
|
12
12
|
var packageDetection = require('./packageDetection.cjs.js');
|
|
13
|
+
var moduleFederation = require('./moduleFederation.cjs.js');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
16
|
|
|
@@ -39,17 +40,23 @@ async function buildBundle(options) {
|
|
|
39
40
|
getFrontendAppConfigs: () => options.frontendAppConfigs
|
|
40
41
|
};
|
|
41
42
|
const configs = [];
|
|
42
|
-
if (options.
|
|
43
|
+
if (options.moduleFederationRemote) {
|
|
43
44
|
configs.push(await config.createConfig(paths$1, commonConfigOptions));
|
|
44
45
|
} else {
|
|
45
46
|
const detectedModulesEntryPoint = await packageDetection.createDetectedModulesEntryPoint({
|
|
46
47
|
config: options.fullConfig,
|
|
47
48
|
targetPath: paths$1.targetPath
|
|
48
49
|
});
|
|
50
|
+
const moduleFederationSharedDependenciesEntryPoint = await moduleFederation.createRuntimeSharedDependenciesEntryPoint({
|
|
51
|
+
targetPath: paths$1.targetPath
|
|
52
|
+
});
|
|
49
53
|
configs.push(
|
|
50
54
|
await config.createConfig(paths$1, {
|
|
51
55
|
...commonConfigOptions,
|
|
52
|
-
additionalEntryPoints:
|
|
56
|
+
additionalEntryPoints: [
|
|
57
|
+
...detectedModulesEntryPoint,
|
|
58
|
+
...moduleFederationSharedDependenciesEntryPoint
|
|
59
|
+
],
|
|
53
60
|
appMode: publicPaths ? "protected" : "public"
|
|
54
61
|
})
|
|
55
62
|
);
|