@backstage/cli 0.36.0-next.1 → 0.36.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 +110 -0
- package/config/eslint-factory.js +1 -0
- package/config/getJestEnvironment.js +7 -29
- package/config/jest-environment-jsdom/index.js +9 -43
- package/config/jest.js +7 -401
- package/config/jestCacheResultProcessor.cjs +10 -6
- package/config/jestCachingModuleLoader.js +11 -19
- package/config/jestFileTransform.js +11 -28
- package/config/jestRejectNetworkRequests.js +10 -53
- package/config/jestSucraseTransform.js +10 -70
- package/config/jestSwcTransform.js +10 -27
- package/config/jestYamlTransform.js +11 -24
- package/config/nodeTransform.cjs +10 -70
- package/config/nodeTransformHooks.mjs +4 -278
- package/config/webpack-public-path.js +10 -14
- package/dist/cli-internal/src/InternalCliModule.cjs.js +11 -0
- package/dist/cli-internal/src/InternalCommandNode.cjs.js +25 -0
- package/dist/cli-internal/src/knownPluginPackages.cjs.js +40 -0
- package/dist/index.cjs.js +21 -10
- package/dist/wiring/CliInitializer.cjs.js +61 -20
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +27 -154
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -24
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -89
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -8
- package/dist/modules/build/commands/package/clean.cjs.js +0 -21
- package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
- package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
- package/dist/modules/build/commands/package/start/command.cjs.js +0 -23
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -8
- package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
- package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
- package/dist/modules/build/commands/repo/build.cjs.js +0 -114
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -150
- package/dist/modules/build/index.cjs.js +0 -192
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
- package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
- package/dist/modules/build/lib/builder/config.cjs.js +0 -257
- package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
- package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
- package/dist/modules/build/lib/builder/types.cjs.js +0 -10
- package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
- package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
- package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
- package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
- package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
- package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
- package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
- package/dist/modules/build/lib/config.cjs.js +0 -94
- package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
- package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
- package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
- package/dist/modules/build/lib/optionsParser.cjs.js +0 -37
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
- package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
- package/dist/modules/build/lib/publishing.cjs.js +0 -40
- package/dist/modules/build/lib/role.cjs.js +0 -24
- package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
- package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
- package/dist/modules/build/lib/urls.cjs.js +0 -13
- package/dist/modules/config/commands/docs.cjs.js +0 -62
- package/dist/modules/config/commands/print.cjs.js +0 -80
- package/dist/modules/config/commands/schema.cjs.js +0 -55
- package/dist/modules/config/commands/validate.cjs.js +0 -49
- package/dist/modules/config/index.cjs.js +0 -51
- package/dist/modules/config/lib/config.cjs.js +0 -94
- package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -115
- package/dist/modules/create-github-app/index.cjs.js +0 -27
- package/dist/modules/info/commands/info.cjs.js +0 -181
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -46
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -212
- package/dist/modules/lint/index.cjs.js +0 -82
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -37
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -400
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -74
- package/dist/modules/maintenance/index.cjs.js +0 -42
- package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
- package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
- package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
- package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -373
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -112
- package/dist/modules/migrate/index.cjs.js +0 -82
- package/dist/modules/migrate/lib/utils.cjs.js +0 -44
- package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
- package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
- package/dist/modules/new/commands/new.cjs.js +0 -60
- package/dist/modules/new/index.cjs.js +0 -68
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
- package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
- package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
- package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
- package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
- package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
- package/dist/modules/new/lib/tasks.cjs.js +0 -51
- package/dist/modules/new/lib/types.cjs.js +0 -19
- package/dist/modules/new/lib/version.cjs.js +0 -91
- package/dist/modules/test/commands/package/test.cjs.js +0 -65
- package/dist/modules/test/commands/repo/test.cjs.js +0 -288
- package/dist/modules/test/index.cjs.js +0 -54
- package/dist/modules/translations/commands/export.cjs.js +0 -127
- package/dist/modules/translations/commands/import.cjs.js +0 -164
- package/dist/modules/translations/index.cjs.js +0 -24
- package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
- package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
- package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
- package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/catalog-client/package.json.cjs.js +0 -6
- package/dist/packages/cli/package.json.cjs.js +0 -156
- package/dist/packages/config/package.json.cjs.js +0 -6
- package/dist/packages/core-app-api/package.json.cjs.js +0 -6
- package/dist/packages/core-components/package.json.cjs.js +0 -6
- package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/dev-utils/package.json.cjs.js +0 -6
- package/dist/packages/errors/package.json.cjs.js +0 -6
- package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
- package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/test-utils/package.json.cjs.js +0 -6
- package/dist/packages/theme/package.json.cjs.js +0 -6
- package/dist/packages/types/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
- package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
- package/dist/wiring/CommandRegistry.cjs.js +0 -14
- package/dist/wiring/factory.cjs.js +0 -15
- package/dist/wiring/lazy.cjs.js +0 -22
- package/dist/wiring/types.cjs.js +0 -11
- package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin/README.md.hbs +0 -28
- package/templates/backend-plugin/dev/index.ts.hbs +0 -60
- package/templates/backend-plugin/package.json.hbs +0 -44
- package/templates/backend-plugin/portable-template.yaml +0 -5
- package/templates/backend-plugin/src/index.ts.hbs +0 -1
- package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
- package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
- package/templates/backend-plugin/src/router.test.ts +0 -67
- package/templates/backend-plugin/src/router.ts +0 -51
- package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
- package/templates/backend-plugin/src/setupTests.ts +0 -1
- package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin-module/README.md.hbs +0 -5
- package/templates/backend-plugin-module/package.json.hbs +0 -34
- package/templates/backend-plugin-module/portable-template.yaml +0 -5
- package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
- package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
- package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
- package/templates/catalog-provider-module/README.md.hbs +0 -5
- package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
- package/templates/catalog-provider-module/package.json.hbs +0 -36
- package/templates/catalog-provider-module/portable-template.yaml +0 -9
- package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
- package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
- package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
- package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/frontend-plugin/README.md.hbs +0 -13
- package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
- package/templates/frontend-plugin/package.json.hbs +0 -54
- package/templates/frontend-plugin/portable-template.yaml +0 -6
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
- package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
- package/templates/frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin/README.md.hbs +0 -20
- package/templates/new-frontend-plugin/dev/index.tsx +0 -10
- package/templates/new-frontend-plugin/package.json.hbs +0 -49
- package/templates/new-frontend-plugin/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
- package/templates/new-frontend-plugin/src/routes.ts +0 -3
- package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
- package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
- package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
- package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
- package/templates/node-library/.eslintrc.js.hbs +0 -1
- package/templates/node-library/README.md.hbs +0 -12
- package/templates/node-library/package.json.hbs +0 -29
- package/templates/node-library/portable-template.yaml +0 -3
- package/templates/node-library/src/index.ts.hbs +0 -1
- package/templates/node-library/src/setupTests.ts +0 -1
- package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-common-library/README.md.hbs +0 -5
- package/templates/plugin-common-library/package.json.hbs +0 -31
- package/templates/plugin-common-library/portable-template.yaml +0 -3
- package/templates/plugin-common-library/src/index.ts.hbs +0 -19
- package/templates/plugin-common-library/src/setupTests.ts +0 -1
- package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-node-library/README.md.hbs +0 -5
- package/templates/plugin-node-library/package.json.hbs +0 -30
- package/templates/plugin-node-library/portable-template.yaml +0 -3
- package/templates/plugin-node-library/src/index.ts.hbs +0 -18
- package/templates/plugin-node-library/src/setupTests.ts +0 -1
- package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-web-library/README.md.hbs +0 -5
- package/templates/plugin-web-library/package.json.hbs +0 -42
- package/templates/plugin-web-library/portable-template.yaml +0 -3
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
- package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
- package/templates/plugin-web-library/src/components/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
- package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
- package/templates/plugin-web-library/src/index.ts.hbs +0 -12
- package/templates/plugin-web-library/src/setupTests.ts +0 -1
- package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
- package/templates/scaffolder-backend-module/README.md.hbs +0 -5
- package/templates/scaffolder-backend-module/package.json.hbs +0 -36
- package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
- package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
- package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
- package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
- package/templates/scaffolder-backend-module/src/module.ts +0 -21
- package/templates/web-library/.eslintrc.js.hbs +0 -1
- package/templates/web-library/README.md.hbs +0 -12
- package/templates/web-library/package.json.hbs +0 -30
- package/templates/web-library/portable-template.yaml +0 -3
- package/templates/web-library/src/index.ts.hbs +0 -1
- package/templates/web-library/src/setupTests.ts +0 -1
- /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var errors = require('@backstage/errors');
|
|
4
|
-
var fs = require('fs-extra');
|
|
5
|
-
var posix = require('node: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,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
|
-
var path = require('node:path');
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
var runBackend = require('../../../lib/runner/runBackend.cjs.js');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
11
|
-
|
|
12
|
-
async function startBackend(options) {
|
|
13
|
-
const waitForExit = await runBackend.runBackend({
|
|
14
|
-
targetDir: options.targetDir,
|
|
15
|
-
entry: "src/index",
|
|
16
|
-
inspectEnabled: options.inspectEnabled,
|
|
17
|
-
inspectBrkEnabled: options.inspectBrkEnabled,
|
|
18
|
-
linkedWorkspace: options.linkedWorkspace,
|
|
19
|
-
require: options.require
|
|
20
|
-
});
|
|
21
|
-
await waitForExit();
|
|
22
|
-
}
|
|
23
|
-
async function startBackendPlugin(options) {
|
|
24
|
-
const hasDevIndexEntry = await fs__default.default.pathExists(
|
|
25
|
-
path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "dev/index.ts")
|
|
26
|
-
);
|
|
27
|
-
if (!hasDevIndexEntry) {
|
|
28
|
-
console.warn(
|
|
29
|
-
`The 'dev' directory is missing. Please create a proper dev/index.ts in order to start the plugin.`
|
|
30
|
-
);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const waitForExit = await runBackend.runBackend({
|
|
34
|
-
targetDir: options.targetDir,
|
|
35
|
-
entry: "dev/index",
|
|
36
|
-
inspectEnabled: options.inspectEnabled,
|
|
37
|
-
inspectBrkEnabled: options.inspectBrkEnabled,
|
|
38
|
-
require: options.require,
|
|
39
|
-
linkedWorkspace: options.linkedWorkspace
|
|
40
|
-
});
|
|
41
|
-
await waitForExit();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
exports.startBackend = startBackend;
|
|
45
|
-
exports.startBackendPlugin = startBackendPlugin;
|
|
46
|
-
//# sourceMappingURL=startBackend.cjs.js.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
|
-
var path = require('node:path');
|
|
5
|
-
require('yn');
|
|
6
|
-
require('@rspack/core');
|
|
7
|
-
require('react-dev-utils/FileSizeReporter');
|
|
8
|
-
require('react-dev-utils/formatWebpackMessages');
|
|
9
|
-
require('eslint-rspack-plugin');
|
|
10
|
-
require('ts-checker-rspack-plugin');
|
|
11
|
-
require('html-webpack-plugin');
|
|
12
|
-
require('react-dev-utils/ModuleScopePlugin');
|
|
13
|
-
require('@module-federation/enhanced/rspack');
|
|
14
|
-
require('lodash/pickBy');
|
|
15
|
-
var cliCommon = require('@backstage/cli-common');
|
|
16
|
-
require('../../../../../wiring/version.cjs.js');
|
|
17
|
-
var hasReactDomClient = require('../../../lib/bundler/hasReactDomClient.cjs.js');
|
|
18
|
-
require('@manypkg/get-packages');
|
|
19
|
-
require('chalk');
|
|
20
|
-
require('../../../lib/bundler/packageDetection.cjs.js');
|
|
21
|
-
var moduleFederation = require('../../../lib/bundler/moduleFederation.cjs.js');
|
|
22
|
-
var server = require('../../../lib/bundler/server.cjs.js');
|
|
23
|
-
|
|
24
|
-
async function startFrontend(options) {
|
|
25
|
-
const packageJson = await fs.readJson(
|
|
26
|
-
path.resolve(options.targetDir ?? cliCommon.targetPaths.dir, "package.json")
|
|
27
|
-
);
|
|
28
|
-
if (!hasReactDomClient.hasReactDomClient()) {
|
|
29
|
-
console.warn(
|
|
30
|
-
"React 17 is now deprecated! Please follow the Backstage migration guide to update to React 18: https://backstage.io/docs/tutorials/react18-migration/"
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
const waitForExit = await server.serveBundle({
|
|
34
|
-
entry: options.entry,
|
|
35
|
-
targetDir: options.targetDir,
|
|
36
|
-
checksEnabled: options.checksEnabled,
|
|
37
|
-
configPaths: options.configPaths,
|
|
38
|
-
verifyVersions: options.verifyVersions,
|
|
39
|
-
skipOpenBrowser: options.skipOpenBrowser,
|
|
40
|
-
linkedWorkspace: options.linkedWorkspace,
|
|
41
|
-
moduleFederationRemote: options.isModuleFederationRemote ? await moduleFederation.getModuleFederationRemoteOptions(
|
|
42
|
-
packageJson,
|
|
43
|
-
path.resolve(cliCommon.targetPaths.dir)
|
|
44
|
-
) : void 0
|
|
45
|
-
});
|
|
46
|
-
await waitForExit();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.startFrontend = startFrontend;
|
|
50
|
-
//# sourceMappingURL=startFrontend.cjs.js.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var startBackend = require('./startBackend.cjs.js');
|
|
4
|
-
var startFrontend = require('./startFrontend.cjs.js');
|
|
5
|
-
var path = require('node:path');
|
|
6
|
-
var glob = require('glob');
|
|
7
|
-
|
|
8
|
-
function resolveEntryPath(entrypoint = "dev", targetDir) {
|
|
9
|
-
const { dir: entryDir, name: entryName } = path.parse(entrypoint);
|
|
10
|
-
const [entryFile] = glob.glob.sync(`${path.resolve(targetDir, entryDir, entryName)}.*`);
|
|
11
|
-
if (entryFile) {
|
|
12
|
-
return path.join(entryDir, entryName);
|
|
13
|
-
}
|
|
14
|
-
return path.join(entryDir, entryName, "index");
|
|
15
|
-
}
|
|
16
|
-
async function startPackage(options) {
|
|
17
|
-
switch (options.role) {
|
|
18
|
-
case "backend":
|
|
19
|
-
return startBackend.startBackend(options);
|
|
20
|
-
case "backend-plugin":
|
|
21
|
-
case "backend-plugin-module":
|
|
22
|
-
case "node-library":
|
|
23
|
-
return startBackend.startBackendPlugin(options);
|
|
24
|
-
case "frontend":
|
|
25
|
-
return startFrontend.startFrontend({
|
|
26
|
-
...options,
|
|
27
|
-
entry: "src/index",
|
|
28
|
-
verifyVersions: true
|
|
29
|
-
});
|
|
30
|
-
case "web-library":
|
|
31
|
-
case "frontend-plugin":
|
|
32
|
-
case "frontend-plugin-module":
|
|
33
|
-
return startFrontend.startFrontend({
|
|
34
|
-
...options,
|
|
35
|
-
entry: resolveEntryPath(options.entrypoint, options.targetDir)
|
|
36
|
-
});
|
|
37
|
-
case "frontend-dynamic-container":
|
|
38
|
-
return startFrontend.startFrontend({
|
|
39
|
-
entry: "src/index",
|
|
40
|
-
...options,
|
|
41
|
-
skipOpenBrowser: true,
|
|
42
|
-
isModuleFederationRemote: true
|
|
43
|
-
});
|
|
44
|
-
default:
|
|
45
|
-
throw new Error(
|
|
46
|
-
`Start command is not supported for package role '${options.role}'`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.resolveEntryPath = resolveEntryPath;
|
|
52
|
-
exports.startPackage = startPackage;
|
|
53
|
-
//# sourceMappingURL=startPackage.cjs.js.map
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chalk = require('chalk');
|
|
4
|
-
var path = require('node:path');
|
|
5
|
-
var packager = require('../../lib/builder/packager.cjs.js');
|
|
6
|
-
var cliCommon = require('@backstage/cli-common');
|
|
7
|
-
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var buildFrontend = require('../../lib/buildFrontend.cjs.js');
|
|
9
|
-
var buildBackend = require('../../lib/buildBackend.cjs.js');
|
|
10
|
-
var optionsParser = require('../../lib/optionsParser.cjs.js');
|
|
11
|
-
|
|
12
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
15
|
-
|
|
16
|
-
async function command(opts, cmd) {
|
|
17
|
-
let packages = await cliNode.PackageGraph.listTargetPackages();
|
|
18
|
-
const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
|
|
19
|
-
if (opts.since) {
|
|
20
|
-
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
21
|
-
const changedPackages = await graph.listChangedPackages({
|
|
22
|
-
ref: opts.since,
|
|
23
|
-
analyzeLockfile: true
|
|
24
|
-
});
|
|
25
|
-
const withDevDependents = graph.collectPackageNames(
|
|
26
|
-
changedPackages.map((pkg) => pkg.name),
|
|
27
|
-
(pkg) => pkg.localDevDependents.keys()
|
|
28
|
-
);
|
|
29
|
-
packages = Array.from(withDevDependents).map((name) => graph.get(name));
|
|
30
|
-
}
|
|
31
|
-
const apps = new Array();
|
|
32
|
-
const backends = new Array();
|
|
33
|
-
const parseBuildScript = optionsParser.createScriptOptionsParser(cmd, ["package", "build"]);
|
|
34
|
-
const options = packages.flatMap((pkg) => {
|
|
35
|
-
const role = pkg.packageJson.backstage?.role ?? cliNode.PackageRoles.detectRoleFromPackage(pkg.packageJson);
|
|
36
|
-
if (!role) {
|
|
37
|
-
console.warn(`Ignored ${pkg.packageJson.name} because it has no role`);
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
if (role === "frontend") {
|
|
41
|
-
apps.push(pkg);
|
|
42
|
-
return [];
|
|
43
|
-
} else if (role === "backend") {
|
|
44
|
-
backends.push(pkg);
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
const outputs = packager.getOutputsForRole(role);
|
|
48
|
-
if (outputs.size === 0) {
|
|
49
|
-
console.warn(`Ignored ${pkg.packageJson.name} because it has no output`);
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
53
|
-
if (!buildOptions) {
|
|
54
|
-
console.warn(
|
|
55
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
56
|
-
);
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
targetDir: pkg.dir,
|
|
61
|
-
packageJson: pkg.packageJson,
|
|
62
|
-
outputs,
|
|
63
|
-
logPrefix: `${chalk__default.default.cyan(path.relative(cliCommon.targetPaths.rootDir, pkg.dir))}: `,
|
|
64
|
-
workspacePackages: packages,
|
|
65
|
-
minify: opts.minify ?? buildOptions.minify
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
console.log("Building packages");
|
|
69
|
-
await packager.buildPackages(options);
|
|
70
|
-
if (opts.all) {
|
|
71
|
-
console.log("Building apps");
|
|
72
|
-
await cliNode.runConcurrentTasks({
|
|
73
|
-
items: apps,
|
|
74
|
-
concurrencyFactor: 1 / 2,
|
|
75
|
-
worker: async (pkg) => {
|
|
76
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
77
|
-
if (!buildOptions) {
|
|
78
|
-
console.warn(
|
|
79
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
80
|
-
);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
await buildFrontend.buildFrontend({
|
|
84
|
-
targetDir: pkg.dir,
|
|
85
|
-
configPaths: buildOptions.config ?? [],
|
|
86
|
-
writeStats: Boolean(buildOptions.stats),
|
|
87
|
-
webpack
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
console.log("Building backends");
|
|
92
|
-
await cliNode.runConcurrentTasks({
|
|
93
|
-
items: backends,
|
|
94
|
-
concurrencyFactor: 1 / 2,
|
|
95
|
-
worker: async (pkg) => {
|
|
96
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
97
|
-
if (!buildOptions) {
|
|
98
|
-
console.warn(
|
|
99
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
100
|
-
);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
await buildBackend.buildBackend({
|
|
104
|
-
targetDir: pkg.dir,
|
|
105
|
-
skipBuildDependencies: true,
|
|
106
|
-
minify: opts.minify ?? buildOptions.minify
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
exports.command = command;
|
|
114
|
-
//# sourceMappingURL=build.cjs.js.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var fs = require('fs-extra');
|
|
7
|
-
var path = require('node:path');
|
|
8
|
-
var cliNode = require('@backstage/cli-node');
|
|
9
|
-
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
|
-
|
|
15
|
-
var clean = async ({ args, info }) => {
|
|
16
|
-
cleye.cli({ help: info }, void 0, args);
|
|
17
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
18
|
-
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist"));
|
|
19
|
-
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("dist-types"));
|
|
20
|
-
await fs__default.default.remove(cliCommon.targetPaths.resolveRoot("coverage"));
|
|
21
|
-
await Promise.all(
|
|
22
|
-
Array.from(Array(10), async () => {
|
|
23
|
-
while (packages.length > 0) {
|
|
24
|
-
const pkg = packages.pop();
|
|
25
|
-
const cleanScript = pkg.packageJson.scripts?.clean;
|
|
26
|
-
if (cleanScript === "backstage-cli clean" || cleanScript === "backstage-cli package clean") {
|
|
27
|
-
await fs__default.default.remove(path.resolve(pkg.dir, "dist"));
|
|
28
|
-
await fs__default.default.remove(path.resolve(pkg.dir, "dist-types"));
|
|
29
|
-
await fs__default.default.remove(path.resolve(pkg.dir, "coverage"));
|
|
30
|
-
} else if (cleanScript) {
|
|
31
|
-
await cliCommon.run(["yarn", "run", "clean"], {
|
|
32
|
-
cwd: pkg.dir
|
|
33
|
-
}).waitForExit();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.default = clean;
|
|
41
|
-
//# sourceMappingURL=clean.cjs.js.map
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var cliNode = require('@backstage/cli-node');
|
|
4
|
-
var path = require('node:path');
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
var resolveLinkedWorkspace = require('../package/start/resolveLinkedWorkspace.cjs.js');
|
|
7
|
-
var startPackage = require('../package/start/startPackage.cjs.js');
|
|
8
|
-
var node_util = require('node:util');
|
|
9
|
-
|
|
10
|
-
const ACCEPTED_PACKAGE_ROLES = [
|
|
11
|
-
"frontend",
|
|
12
|
-
"backend",
|
|
13
|
-
"frontend-plugin",
|
|
14
|
-
"backend-plugin"
|
|
15
|
-
];
|
|
16
|
-
async function command(namesOrPaths, options) {
|
|
17
|
-
const targetPackages = await findTargetPackages(namesOrPaths, options.plugin);
|
|
18
|
-
const packageOptions = await resolvePackageOptions(targetPackages, options);
|
|
19
|
-
if (packageOptions.length === 0) {
|
|
20
|
-
console.log("No packages found to start");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
console.log(
|
|
24
|
-
`Starting ${packageOptions.map(({ pkg }) => pkg.packageJson.name).join(", ")}`
|
|
25
|
-
);
|
|
26
|
-
await Promise.all(packageOptions.map((entry) => startPackage.startPackage(entry.options)));
|
|
27
|
-
}
|
|
28
|
-
async function findTargetPackages(namesOrPaths, pluginIds) {
|
|
29
|
-
const targetPackages = new Array();
|
|
30
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
31
|
-
for (const pluginId of pluginIds) {
|
|
32
|
-
const matchingPackages = packages.filter((pkg) => {
|
|
33
|
-
return pluginId === pkg.packageJson.backstage?.pluginId && ACCEPTED_PACKAGE_ROLES.includes(pkg.packageJson.backstage.role);
|
|
34
|
-
});
|
|
35
|
-
if (matchingPackages.length === 0) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Unable to find any plugin packages with plugin ID '${pluginId}'. Make sure backstage.pluginId is set in your package.json files by running 'yarn fix --publish'.`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
targetPackages.push(...matchingPackages);
|
|
41
|
-
}
|
|
42
|
-
if (targetPackages.length > 0) {
|
|
43
|
-
return targetPackages;
|
|
44
|
-
}
|
|
45
|
-
for (const nameOrPath of namesOrPaths) {
|
|
46
|
-
let matchingPackage = packages.find(
|
|
47
|
-
(pkg) => nameOrPath === pkg.packageJson.name
|
|
48
|
-
);
|
|
49
|
-
if (!matchingPackage) {
|
|
50
|
-
const absPath = cliCommon.targetPaths.resolveRoot(nameOrPath);
|
|
51
|
-
matchingPackage = packages.find(
|
|
52
|
-
(pkg) => path.relative(pkg.dir, absPath) === ""
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
if (!matchingPackage) {
|
|
56
|
-
throw new Error(`Unable to find package by name '${nameOrPath}'`);
|
|
57
|
-
}
|
|
58
|
-
targetPackages.push(matchingPackage);
|
|
59
|
-
}
|
|
60
|
-
if (targetPackages.length > 0) {
|
|
61
|
-
return targetPackages;
|
|
62
|
-
}
|
|
63
|
-
for (const role of ["frontend", "backend"]) {
|
|
64
|
-
const matchingPackages = packages.filter(
|
|
65
|
-
(pkg) => pkg.packageJson.backstage?.role === role
|
|
66
|
-
);
|
|
67
|
-
if (matchingPackages.length > 1) {
|
|
68
|
-
const expectedPath = cliCommon.targetPaths.resolveRoot(
|
|
69
|
-
role === "frontend" ? "packages/app" : "packages/backend"
|
|
70
|
-
);
|
|
71
|
-
const matchByPath = matchingPackages.find(
|
|
72
|
-
(pkg) => path.relative(expectedPath, pkg.dir) === ""
|
|
73
|
-
);
|
|
74
|
-
if (matchByPath) {
|
|
75
|
-
targetPackages.push(matchByPath);
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Found multiple packages with role '${role}' but none of the use the default path '${expectedPath}',choose which packages you want to run by passing the package names explicitly as arguments, for example 'yarn backstage-cli repo start my-app my-backend'.`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
targetPackages.push(...matchingPackages);
|
|
83
|
-
}
|
|
84
|
-
if (targetPackages.length > 0) {
|
|
85
|
-
return targetPackages;
|
|
86
|
-
}
|
|
87
|
-
for (const role of ["frontend-plugin", "backend-plugin"]) {
|
|
88
|
-
const matchingPackages = packages.filter(
|
|
89
|
-
(pkg) => pkg.packageJson.backstage?.role === role
|
|
90
|
-
);
|
|
91
|
-
if (matchingPackages.length > 1) {
|
|
92
|
-
throw new Error(
|
|
93
|
-
`Found multiple packages with role '${role}', please choose which packages you want to run by passing the package names explicitly as arguments, for example 'yarn backstage-cli repo start my-plugin my-plugin-backend'.`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
targetPackages.push(...matchingPackages);
|
|
97
|
-
}
|
|
98
|
-
if (targetPackages.length > 0) {
|
|
99
|
-
return targetPackages;
|
|
100
|
-
}
|
|
101
|
-
throw new Error(
|
|
102
|
-
`Unable to find any packages with role 'frontend', 'backend', 'frontend-plugin', or 'backend-plugin'.`
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
async function resolvePackageOptions(targetPackages, options) {
|
|
106
|
-
const linkedWorkspace = await resolveLinkedWorkspace.resolveLinkedWorkspace(options.link);
|
|
107
|
-
return targetPackages.flatMap((pkg) => {
|
|
108
|
-
const startScript = pkg.packageJson.scripts?.start;
|
|
109
|
-
if (!startScript) {
|
|
110
|
-
console.log(
|
|
111
|
-
`No start script found for package ${pkg.packageJson.name}, skipping...`
|
|
112
|
-
);
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
const { values: parsedOpts } = node_util.parseArgs({
|
|
116
|
-
args: startScript.split(" "),
|
|
117
|
-
strict: false,
|
|
118
|
-
options: {
|
|
119
|
-
config: {
|
|
120
|
-
type: "string",
|
|
121
|
-
multiple: true
|
|
122
|
-
},
|
|
123
|
-
require: {
|
|
124
|
-
type: "string"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const parsedRequire = typeof parsedOpts.require === "string" ? parsedOpts.require : void 0;
|
|
129
|
-
const parsedConfig = parsedOpts.config?.filter((c) => typeof c === "string") ?? [];
|
|
130
|
-
return [
|
|
131
|
-
{
|
|
132
|
-
pkg,
|
|
133
|
-
options: {
|
|
134
|
-
role: pkg.packageJson.backstage?.role,
|
|
135
|
-
targetDir: pkg.dir,
|
|
136
|
-
configPaths: options.config.length > 0 ? options.config : parsedConfig,
|
|
137
|
-
checksEnabled: false,
|
|
138
|
-
linkedWorkspace,
|
|
139
|
-
inspectEnabled: options.inspect,
|
|
140
|
-
inspectBrkEnabled: options.inspectBrk,
|
|
141
|
-
require: options.require ?? parsedRequire
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
];
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
exports.command = command;
|
|
149
|
-
exports.findTargetPackages = findTargetPackages;
|
|
150
|
-
//# sourceMappingURL=start.cjs.js.map
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var commander = require('commander');
|
|
6
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
7
|
-
var lazy = require('../../wiring/lazy.cjs.js');
|
|
8
|
-
|
|
9
|
-
const configOption = [
|
|
10
|
-
"--config <path>",
|
|
11
|
-
"Config files to load instead of app-config.yaml",
|
|
12
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
13
|
-
Array()
|
|
14
|
-
];
|
|
15
|
-
function registerPackageCommands(command) {
|
|
16
|
-
command.command("build").description("Build a package for production deployment or publishing").option("--role <name>", "Run the command with an explicit package role").option(
|
|
17
|
-
"--minify",
|
|
18
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
19
|
-
).option(
|
|
20
|
-
"--skip-build-dependencies",
|
|
21
|
-
"Skip the automatic building of local dependencies. Applies to backend packages only."
|
|
22
|
-
).option(
|
|
23
|
-
"--stats",
|
|
24
|
-
"If bundle stats are available, write them to the output directory. Applies to app packages only."
|
|
25
|
-
).option(
|
|
26
|
-
"--config <path>",
|
|
27
|
-
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
28
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
29
|
-
Array()
|
|
30
|
-
).option(
|
|
31
|
-
"--module-federation",
|
|
32
|
-
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
33
|
-
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
34
|
-
}
|
|
35
|
-
const buildPlugin = factory.createCliPlugin({
|
|
36
|
-
pluginId: "build",
|
|
37
|
-
init: async (reg) => {
|
|
38
|
-
reg.addCommand({
|
|
39
|
-
path: ["package", "build"],
|
|
40
|
-
description: "Build a package for production deployment or publishing",
|
|
41
|
-
execute: async ({ args }) => {
|
|
42
|
-
const command = new commander.Command();
|
|
43
|
-
const defaultCommand = command.option(
|
|
44
|
-
"--role <name>",
|
|
45
|
-
"Run the command with an explicit package role"
|
|
46
|
-
).option(
|
|
47
|
-
"--minify",
|
|
48
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
49
|
-
).option(
|
|
50
|
-
"--skip-build-dependencies",
|
|
51
|
-
"Skip the automatic building of local dependencies. Applies to backend packages only."
|
|
52
|
-
).option(
|
|
53
|
-
"--stats",
|
|
54
|
-
"If bundle stats are available, write them to the output directory. Applies to app packages only."
|
|
55
|
-
).option(
|
|
56
|
-
"--config <path>",
|
|
57
|
-
"Config files to load instead of app-config.yaml. Applies to app packages only.",
|
|
58
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
59
|
-
Array()
|
|
60
|
-
).option(
|
|
61
|
-
"--module-federation",
|
|
62
|
-
"Build a package as a module federation remote. Applies to frontend plugin packages only."
|
|
63
|
-
).action(lazy.lazy(() => import('./commands/package/build/index.cjs.js'), "command"));
|
|
64
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
reg.addCommand({
|
|
68
|
-
path: ["repo", "build"],
|
|
69
|
-
description: "Build packages in the project, excluding bundled app and backend packages.",
|
|
70
|
-
execute: async ({ args }) => {
|
|
71
|
-
const command = new commander.Command();
|
|
72
|
-
registerPackageCommands(command.command("package"));
|
|
73
|
-
const defaultCommand = command.option(
|
|
74
|
-
"--all",
|
|
75
|
-
"Build all packages, including bundled app and backend packages."
|
|
76
|
-
).option(
|
|
77
|
-
"--since <ref>",
|
|
78
|
-
"Only build packages and their dev dependents that changed since the specified ref"
|
|
79
|
-
).option(
|
|
80
|
-
"--minify",
|
|
81
|
-
"Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
82
|
-
).action(lazy.lazy(() => import('./commands/repo/build.cjs.js'), "command"));
|
|
83
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
reg.addCommand({
|
|
87
|
-
path: ["package", "start"],
|
|
88
|
-
description: "Start a package for local development",
|
|
89
|
-
execute: async ({ args }) => {
|
|
90
|
-
const command = new commander.Command();
|
|
91
|
-
const defaultCommand = command.option(...configOption).option(
|
|
92
|
-
"--role <name>",
|
|
93
|
-
"Run the command with an explicit package role"
|
|
94
|
-
).option("--check", "Enable type checking and linting if available").option("--inspect [host]", "Enable debugger in Node.js environments").option(
|
|
95
|
-
"--inspect-brk [host]",
|
|
96
|
-
"Enable debugger in Node.js environments, breaking before code starts"
|
|
97
|
-
).option(
|
|
98
|
-
"--require <path...>",
|
|
99
|
-
"Add a --require argument to the node process"
|
|
100
|
-
).option(
|
|
101
|
-
"--link <path>",
|
|
102
|
-
"Link an external workspace for module resolution"
|
|
103
|
-
).option(
|
|
104
|
-
"--entrypoint <path>",
|
|
105
|
-
'The entrypoint to start from, relative to the package root. Can point to either a file (without extension) or a directory (in which case the index file in that directory is used). Defaults to "dev"'
|
|
106
|
-
).action(lazy.lazy(() => import('./commands/package/start/index.cjs.js'), "command"));
|
|
107
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
reg.addCommand({
|
|
111
|
-
path: ["repo", "start"],
|
|
112
|
-
description: "Starts packages in the repo for local development",
|
|
113
|
-
execute: async ({ args }) => {
|
|
114
|
-
const command = new commander.Command();
|
|
115
|
-
const defaultCommand = command.argument(
|
|
116
|
-
"[packageNameOrPath...]",
|
|
117
|
-
"Run the specified package instead of the defaults."
|
|
118
|
-
).option(
|
|
119
|
-
"--plugin <pluginId>",
|
|
120
|
-
"Start the dev entry-point for any matching plugin package in the repo",
|
|
121
|
-
(opt, opts) => opts ? [...opts, opt] : [opt],
|
|
122
|
-
Array()
|
|
123
|
-
).option(...configOption).option(
|
|
124
|
-
"--inspect [host]",
|
|
125
|
-
"Enable debugger in Node.js environments. Applies to backend package only"
|
|
126
|
-
).option(
|
|
127
|
-
"--inspect-brk [host]",
|
|
128
|
-
"Enable debugger in Node.js environments, breaking before code starts. Applies to backend package only"
|
|
129
|
-
).option(
|
|
130
|
-
"--require <path...>",
|
|
131
|
-
"Add a --require argument to the node process. Applies to backend package only"
|
|
132
|
-
).option(
|
|
133
|
-
"--link <path>",
|
|
134
|
-
"Link an external workspace for module resolution"
|
|
135
|
-
).action(
|
|
136
|
-
lazy.lazy(() => import('./commands/repo/start.cjs.js'), "command")
|
|
137
|
-
);
|
|
138
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
reg.addCommand({
|
|
142
|
-
path: ["package", "clean"],
|
|
143
|
-
description: "Delete cache directories",
|
|
144
|
-
execute: {
|
|
145
|
-
loader: () => import('./commands/package/clean.cjs.js')
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
reg.addCommand({
|
|
149
|
-
path: ["package", "prepack"],
|
|
150
|
-
description: "Prepares a package for packaging before publishing",
|
|
151
|
-
execute: {
|
|
152
|
-
loader: () => import('./commands/package/prepack.cjs.js')
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
reg.addCommand({
|
|
156
|
-
path: ["package", "postpack"],
|
|
157
|
-
description: "Restores the changes made by the prepack command",
|
|
158
|
-
execute: {
|
|
159
|
-
loader: () => import('./commands/package/postpack.cjs.js')
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
reg.addCommand({
|
|
163
|
-
path: ["repo", "clean"],
|
|
164
|
-
description: "Delete cache and output directories",
|
|
165
|
-
execute: {
|
|
166
|
-
loader: () => import('./commands/repo/clean.cjs.js')
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
reg.addCommand({
|
|
170
|
-
path: ["build-workspace"],
|
|
171
|
-
description: "Builds a temporary dist workspace from the provided packages",
|
|
172
|
-
execute: async ({ args }) => {
|
|
173
|
-
const command = new commander.Command();
|
|
174
|
-
const defaultCommand = command.arguments("<workspace-dir> [packages...]").addOption(
|
|
175
|
-
new commander.Option(
|
|
176
|
-
"--alwaysYarnPack",
|
|
177
|
-
"Alias for --alwaysPack for backwards compatibility."
|
|
178
|
-
).implies({ alwaysPack: true }).hideHelp(true)
|
|
179
|
-
).option(
|
|
180
|
-
"--alwaysPack",
|
|
181
|
-
"Force workspace output to be a result of running `yarn pack` on each package (warning: very slow)"
|
|
182
|
-
).action(lazy.lazy(() => import('./commands/buildWorkspace.cjs.js'), "default"));
|
|
183
|
-
await defaultCommand.parseAsync(args, { from: "user" });
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
exports.buildPlugin = buildPlugin;
|
|
190
|
-
exports.default = buildPlugin;
|
|
191
|
-
exports.registerPackageCommands = registerPackageCommands;
|
|
192
|
-
//# sourceMappingURL=index.cjs.js.map
|