@backstage/cli 0.36.0-next.2 → 0.36.1-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 +108 -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 -11
- package/dist/wiring/CliInitializer.cjs.js +61 -30
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +23 -156
- package/dist/modules/auth/commands/list.cjs.js +0 -23
- package/dist/modules/auth/commands/login.cjs.js +0 -316
- package/dist/modules/auth/commands/logout.cjs.js +0 -55
- package/dist/modules/auth/commands/printToken.cjs.js +0 -41
- package/dist/modules/auth/commands/select.cjs.js +0 -32
- package/dist/modules/auth/commands/show.cjs.js +0 -59
- package/dist/modules/auth/index.cjs.js +0 -44
- package/dist/modules/auth/lib/auth.cjs.js +0 -60
- package/dist/modules/auth/lib/http.cjs.js +0 -26
- package/dist/modules/auth/lib/localServer.cjs.js +0 -80
- package/dist/modules/auth/lib/pkce.cjs.js +0 -23
- package/dist/modules/auth/lib/prompt.cjs.js +0 -44
- package/dist/modules/auth/lib/secretStore.cjs.js +0 -81
- package/dist/modules/auth/lib/storage.cjs.js +0 -152
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -53
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -136
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -10
- 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 -80
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -10
- 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 -149
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -199
- package/dist/modules/build/index.cjs.js +0 -68
- 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 -22
- 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 -63
- package/dist/modules/config/commands/print.cjs.js +0 -81
- package/dist/modules/config/commands/schema.cjs.js +0 -56
- package/dist/modules/config/commands/validate.cjs.js +0 -50
- 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 -126
- package/dist/modules/create-github-app/index.cjs.js +0 -19
- package/dist/modules/info/commands/info.cjs.js +0 -182
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -78
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -282
- package/dist/modules/lint/index.cjs.js +0 -24
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -426
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -90
- package/dist/modules/maintenance/index.cjs.js +0 -24
- 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 -403
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -133
- package/dist/modules/migrate/index.cjs.js +0 -59
- 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 -115
- package/dist/modules/new/index.cjs.js +0 -40
- 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 -59
- package/dist/modules/test/commands/repo/test.cjs.js +0 -299
- package/dist/modules/test/index.cjs.js +0 -24
- package/dist/modules/translations/commands/export.cjs.js +0 -128
- package/dist/modules/translations/commands/import.cjs.js +0 -165
- 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 -159
- 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/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,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var startPackage = require('./startPackage.cjs.js');
|
|
7
|
-
var resolveLinkedWorkspace = require('./resolveLinkedWorkspace.cjs.js');
|
|
8
|
-
var role = require('../../../lib/role.cjs.js');
|
|
9
|
-
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
|
|
11
|
-
var command = async ({ args, info }) => {
|
|
12
|
-
const {
|
|
13
|
-
flags: {
|
|
14
|
-
config,
|
|
15
|
-
role: role$1,
|
|
16
|
-
check,
|
|
17
|
-
require: requirePath,
|
|
18
|
-
link,
|
|
19
|
-
entrypoint,
|
|
20
|
-
inspect,
|
|
21
|
-
inspectBrk
|
|
22
|
-
}
|
|
23
|
-
} = cleye.cli(
|
|
24
|
-
{
|
|
25
|
-
help: info,
|
|
26
|
-
booleanFlagNegation: true,
|
|
27
|
-
flags: {
|
|
28
|
-
config: {
|
|
29
|
-
type: [String],
|
|
30
|
-
description: "Config files to load instead of app-config.yaml",
|
|
31
|
-
default: []
|
|
32
|
-
},
|
|
33
|
-
role: {
|
|
34
|
-
type: String,
|
|
35
|
-
description: "Run the command with an explicit package role"
|
|
36
|
-
},
|
|
37
|
-
check: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
description: "Enable type checking and linting if available"
|
|
40
|
-
},
|
|
41
|
-
require: {
|
|
42
|
-
type: String,
|
|
43
|
-
description: "Add a --require argument to the node process"
|
|
44
|
-
},
|
|
45
|
-
link: {
|
|
46
|
-
type: String,
|
|
47
|
-
description: "Link an external workspace for module resolution"
|
|
48
|
-
},
|
|
49
|
-
entrypoint: {
|
|
50
|
-
type: String,
|
|
51
|
-
description: '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"'
|
|
52
|
-
},
|
|
53
|
-
inspect: {
|
|
54
|
-
type: String,
|
|
55
|
-
description: "Enable the Node.js inspector, optionally at a specific host:port"
|
|
56
|
-
},
|
|
57
|
-
inspectBrk: {
|
|
58
|
-
type: String,
|
|
59
|
-
description: "Enable the Node.js inspector and break before user code starts"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
void 0,
|
|
64
|
-
args
|
|
65
|
-
);
|
|
66
|
-
await startPackage.startPackage({
|
|
67
|
-
role: await role.findRoleFromCommand({ role: role$1 }),
|
|
68
|
-
entrypoint,
|
|
69
|
-
targetDir: cliCommon.targetPaths.dir,
|
|
70
|
-
configPaths: config,
|
|
71
|
-
checksEnabled: Boolean(check),
|
|
72
|
-
linkedWorkspace: await resolveLinkedWorkspace.resolveLinkedWorkspace(link),
|
|
73
|
-
inspectEnabled: inspect || (inspect === "" ? true : void 0),
|
|
74
|
-
inspectBrkEnabled: inspectBrk || (inspectBrk === "" ? true : void 0),
|
|
75
|
-
require: requirePath
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
exports.default = command;
|
|
80
|
-
//# sourceMappingURL=command.cjs.js.map
|
|
@@ -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,149 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var chalk = require('chalk');
|
|
6
|
-
var cleye = require('cleye');
|
|
7
|
-
var path = require('node:path');
|
|
8
|
-
var packager = require('../../lib/builder/packager.cjs.js');
|
|
9
|
-
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
var cliNode = require('@backstage/cli-node');
|
|
11
|
-
var buildFrontend = require('../../lib/buildFrontend.cjs.js');
|
|
12
|
-
var buildBackend = require('../../lib/buildBackend.cjs.js');
|
|
13
|
-
var optionsParser = require('../../lib/optionsParser.cjs.js');
|
|
14
|
-
|
|
15
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
|
-
|
|
17
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
18
|
-
|
|
19
|
-
var build = async ({ args, info }) => {
|
|
20
|
-
const {
|
|
21
|
-
flags: { all, since, minify }
|
|
22
|
-
} = cleye.cli(
|
|
23
|
-
{
|
|
24
|
-
help: info,
|
|
25
|
-
booleanFlagNegation: true,
|
|
26
|
-
flags: {
|
|
27
|
-
all: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
description: "Build all packages, including bundled app and backend packages."
|
|
30
|
-
},
|
|
31
|
-
since: {
|
|
32
|
-
type: String,
|
|
33
|
-
description: "Only build packages and their dev dependents that changed since the specified ref"
|
|
34
|
-
},
|
|
35
|
-
minify: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
description: "Minify the generated code. Does not apply to app package (app is minified by default)."
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
void 0,
|
|
42
|
-
args
|
|
43
|
-
);
|
|
44
|
-
let packages = await cliNode.PackageGraph.listTargetPackages();
|
|
45
|
-
const webpack = process.env.LEGACY_WEBPACK_BUILD ? require("webpack") : void 0;
|
|
46
|
-
if (since) {
|
|
47
|
-
const graph = cliNode.PackageGraph.fromPackages(packages);
|
|
48
|
-
const changedPackages = await graph.listChangedPackages({
|
|
49
|
-
ref: since,
|
|
50
|
-
analyzeLockfile: true
|
|
51
|
-
});
|
|
52
|
-
const withDevDependents = graph.collectPackageNames(
|
|
53
|
-
changedPackages.map((pkg) => pkg.name),
|
|
54
|
-
(pkg) => pkg.localDevDependents.keys()
|
|
55
|
-
);
|
|
56
|
-
packages = Array.from(withDevDependents).map((name) => graph.get(name));
|
|
57
|
-
}
|
|
58
|
-
const apps = new Array();
|
|
59
|
-
const backends = new Array();
|
|
60
|
-
const parseBuildScript = optionsParser.createScriptOptionsParser(["package", "build"], {
|
|
61
|
-
role: { type: "string" },
|
|
62
|
-
minify: { type: "boolean" },
|
|
63
|
-
"skip-build-dependencies": { type: "boolean" },
|
|
64
|
-
stats: { type: "boolean" },
|
|
65
|
-
config: { type: "string", multiple: true },
|
|
66
|
-
"module-federation": { type: "boolean" }
|
|
67
|
-
});
|
|
68
|
-
const options = packages.flatMap((pkg) => {
|
|
69
|
-
const role = pkg.packageJson.backstage?.role ?? cliNode.PackageRoles.detectRoleFromPackage(pkg.packageJson);
|
|
70
|
-
if (!role) {
|
|
71
|
-
console.warn(`Ignored ${pkg.packageJson.name} because it has no role`);
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
if (role === "frontend") {
|
|
75
|
-
apps.push(pkg);
|
|
76
|
-
return [];
|
|
77
|
-
} else if (role === "backend") {
|
|
78
|
-
backends.push(pkg);
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
const outputs = packager.getOutputsForRole(role);
|
|
82
|
-
if (outputs.size === 0) {
|
|
83
|
-
console.warn(`Ignored ${pkg.packageJson.name} because it has no output`);
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
87
|
-
if (!buildOptions) {
|
|
88
|
-
console.warn(
|
|
89
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
90
|
-
);
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
targetDir: pkg.dir,
|
|
95
|
-
packageJson: pkg.packageJson,
|
|
96
|
-
outputs,
|
|
97
|
-
logPrefix: `${chalk__default.default.cyan(path.relative(cliCommon.targetPaths.rootDir, pkg.dir))}: `,
|
|
98
|
-
workspacePackages: packages,
|
|
99
|
-
minify: minify ?? Boolean(buildOptions.minify)
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
console.log("Building packages");
|
|
103
|
-
await packager.buildPackages(options);
|
|
104
|
-
if (all) {
|
|
105
|
-
console.log("Building apps");
|
|
106
|
-
await cliNode.runConcurrentTasks({
|
|
107
|
-
items: apps,
|
|
108
|
-
concurrencyFactor: 1 / 2,
|
|
109
|
-
worker: async (pkg) => {
|
|
110
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
111
|
-
if (!buildOptions) {
|
|
112
|
-
console.warn(
|
|
113
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
114
|
-
);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const configPaths = buildOptions.config;
|
|
118
|
-
await buildFrontend.buildFrontend({
|
|
119
|
-
targetDir: pkg.dir,
|
|
120
|
-
configPaths: Array.isArray(configPaths) ? configPaths : [],
|
|
121
|
-
writeStats: Boolean(buildOptions.stats),
|
|
122
|
-
webpack
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
console.log("Building backends");
|
|
127
|
-
await cliNode.runConcurrentTasks({
|
|
128
|
-
items: backends,
|
|
129
|
-
concurrencyFactor: 1 / 2,
|
|
130
|
-
worker: async (pkg) => {
|
|
131
|
-
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
|
132
|
-
if (!buildOptions) {
|
|
133
|
-
console.warn(
|
|
134
|
-
`Ignored ${pkg.packageJson.name} because it does not have a matching build script`
|
|
135
|
-
);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
await buildBackend.buildBackend({
|
|
139
|
-
targetDir: pkg.dir,
|
|
140
|
-
skipBuildDependencies: true,
|
|
141
|
-
minify: minify ?? Boolean(buildOptions.minify)
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
exports.default = build;
|
|
149
|
-
//# 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, booleanFlagNegation: true }, 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,199 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cliNode = require('@backstage/cli-node');
|
|
6
|
-
var path = require('node:path');
|
|
7
|
-
var cliCommon = require('@backstage/cli-common');
|
|
8
|
-
var cleye = require('cleye');
|
|
9
|
-
var resolveLinkedWorkspace = require('../package/start/resolveLinkedWorkspace.cjs.js');
|
|
10
|
-
var startPackage = require('../package/start/startPackage.cjs.js');
|
|
11
|
-
var node_util = require('node:util');
|
|
12
|
-
|
|
13
|
-
const ACCEPTED_PACKAGE_ROLES = [
|
|
14
|
-
"frontend",
|
|
15
|
-
"backend",
|
|
16
|
-
"frontend-plugin",
|
|
17
|
-
"backend-plugin"
|
|
18
|
-
];
|
|
19
|
-
var start = async ({ args, info }) => {
|
|
20
|
-
const {
|
|
21
|
-
flags: { plugin, config, require: requirePath, link, inspect, inspectBrk },
|
|
22
|
-
_: namesOrPaths
|
|
23
|
-
} = cleye.cli(
|
|
24
|
-
{
|
|
25
|
-
help: { ...info, usage: `${info.usage} [packages...]` },
|
|
26
|
-
booleanFlagNegation: true,
|
|
27
|
-
parameters: ["[packages...]"],
|
|
28
|
-
flags: {
|
|
29
|
-
plugin: {
|
|
30
|
-
type: [String],
|
|
31
|
-
description: "Start the dev entry-point for any matching plugin package in the repo",
|
|
32
|
-
default: []
|
|
33
|
-
},
|
|
34
|
-
config: {
|
|
35
|
-
type: [String],
|
|
36
|
-
description: "Config files to load instead of app-config.yaml",
|
|
37
|
-
default: []
|
|
38
|
-
},
|
|
39
|
-
require: {
|
|
40
|
-
type: String,
|
|
41
|
-
description: "Add a --require argument to the node process. Applies to backend package only"
|
|
42
|
-
},
|
|
43
|
-
link: {
|
|
44
|
-
type: String,
|
|
45
|
-
description: "Link an external workspace for module resolution"
|
|
46
|
-
},
|
|
47
|
-
inspect: {
|
|
48
|
-
type: String,
|
|
49
|
-
description: "Enable the Node.js inspector, optionally at a specific host:port"
|
|
50
|
-
},
|
|
51
|
-
inspectBrk: {
|
|
52
|
-
type: String,
|
|
53
|
-
description: "Enable the Node.js inspector and break before user code starts"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
void 0,
|
|
58
|
-
args
|
|
59
|
-
);
|
|
60
|
-
const targetPackages = await findTargetPackages(namesOrPaths, plugin);
|
|
61
|
-
const packageOptions = await resolvePackageOptions(targetPackages, {
|
|
62
|
-
config,
|
|
63
|
-
inspect: inspect || (inspect === "" ? true : void 0),
|
|
64
|
-
inspectBrk: inspectBrk || (inspectBrk === "" ? true : void 0),
|
|
65
|
-
require: requirePath,
|
|
66
|
-
link
|
|
67
|
-
});
|
|
68
|
-
if (packageOptions.length === 0) {
|
|
69
|
-
console.log("No packages found to start");
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
console.log(
|
|
73
|
-
`Starting ${packageOptions.map(({ pkg }) => pkg.packageJson.name).join(", ")}`
|
|
74
|
-
);
|
|
75
|
-
await Promise.all(packageOptions.map((entry) => startPackage.startPackage(entry.options)));
|
|
76
|
-
};
|
|
77
|
-
async function findTargetPackages(namesOrPaths, pluginIds) {
|
|
78
|
-
const targetPackages = new Array();
|
|
79
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
80
|
-
for (const pluginId of pluginIds) {
|
|
81
|
-
const matchingPackages = packages.filter((pkg) => {
|
|
82
|
-
return pluginId === pkg.packageJson.backstage?.pluginId && ACCEPTED_PACKAGE_ROLES.includes(pkg.packageJson.backstage.role);
|
|
83
|
-
});
|
|
84
|
-
if (matchingPackages.length === 0) {
|
|
85
|
-
throw new Error(
|
|
86
|
-
`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'.`
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
targetPackages.push(...matchingPackages);
|
|
90
|
-
}
|
|
91
|
-
if (targetPackages.length > 0) {
|
|
92
|
-
return targetPackages;
|
|
93
|
-
}
|
|
94
|
-
for (const nameOrPath of namesOrPaths) {
|
|
95
|
-
let matchingPackage = packages.find(
|
|
96
|
-
(pkg) => nameOrPath === pkg.packageJson.name
|
|
97
|
-
);
|
|
98
|
-
if (!matchingPackage) {
|
|
99
|
-
const absPath = cliCommon.targetPaths.resolveRoot(nameOrPath);
|
|
100
|
-
matchingPackage = packages.find(
|
|
101
|
-
(pkg) => path.relative(pkg.dir, absPath) === ""
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
if (!matchingPackage) {
|
|
105
|
-
throw new Error(`Unable to find package by name '${nameOrPath}'`);
|
|
106
|
-
}
|
|
107
|
-
targetPackages.push(matchingPackage);
|
|
108
|
-
}
|
|
109
|
-
if (targetPackages.length > 0) {
|
|
110
|
-
return targetPackages;
|
|
111
|
-
}
|
|
112
|
-
for (const role of ["frontend", "backend"]) {
|
|
113
|
-
const matchingPackages = packages.filter(
|
|
114
|
-
(pkg) => pkg.packageJson.backstage?.role === role
|
|
115
|
-
);
|
|
116
|
-
if (matchingPackages.length > 1) {
|
|
117
|
-
const expectedPath = cliCommon.targetPaths.resolveRoot(
|
|
118
|
-
role === "frontend" ? "packages/app" : "packages/backend"
|
|
119
|
-
);
|
|
120
|
-
const matchByPath = matchingPackages.find(
|
|
121
|
-
(pkg) => path.relative(expectedPath, pkg.dir) === ""
|
|
122
|
-
);
|
|
123
|
-
if (matchByPath) {
|
|
124
|
-
targetPackages.push(matchByPath);
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
throw new Error(
|
|
128
|
-
`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'.`
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
targetPackages.push(...matchingPackages);
|
|
132
|
-
}
|
|
133
|
-
if (targetPackages.length > 0) {
|
|
134
|
-
return targetPackages;
|
|
135
|
-
}
|
|
136
|
-
for (const role of ["frontend-plugin", "backend-plugin"]) {
|
|
137
|
-
const matchingPackages = packages.filter(
|
|
138
|
-
(pkg) => pkg.packageJson.backstage?.role === role
|
|
139
|
-
);
|
|
140
|
-
if (matchingPackages.length > 1) {
|
|
141
|
-
throw new Error(
|
|
142
|
-
`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'.`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
targetPackages.push(...matchingPackages);
|
|
146
|
-
}
|
|
147
|
-
if (targetPackages.length > 0) {
|
|
148
|
-
return targetPackages;
|
|
149
|
-
}
|
|
150
|
-
throw new Error(
|
|
151
|
-
`Unable to find any packages with role 'frontend', 'backend', 'frontend-plugin', or 'backend-plugin'.`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
async function resolvePackageOptions(targetPackages, options) {
|
|
155
|
-
const linkedWorkspace = await resolveLinkedWorkspace.resolveLinkedWorkspace(options.link);
|
|
156
|
-
return targetPackages.flatMap((pkg) => {
|
|
157
|
-
const startScript = pkg.packageJson.scripts?.start;
|
|
158
|
-
if (!startScript) {
|
|
159
|
-
console.log(
|
|
160
|
-
`No start script found for package ${pkg.packageJson.name}, skipping...`
|
|
161
|
-
);
|
|
162
|
-
return [];
|
|
163
|
-
}
|
|
164
|
-
const { values: parsedOpts } = node_util.parseArgs({
|
|
165
|
-
args: startScript.split(" "),
|
|
166
|
-
strict: false,
|
|
167
|
-
options: {
|
|
168
|
-
config: {
|
|
169
|
-
type: "string",
|
|
170
|
-
multiple: true
|
|
171
|
-
},
|
|
172
|
-
require: {
|
|
173
|
-
type: "string"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
const parsedRequire = typeof parsedOpts.require === "string" ? parsedOpts.require : void 0;
|
|
178
|
-
const parsedConfig = parsedOpts.config?.filter((c) => typeof c === "string") ?? [];
|
|
179
|
-
return [
|
|
180
|
-
{
|
|
181
|
-
pkg,
|
|
182
|
-
options: {
|
|
183
|
-
role: pkg.packageJson.backstage?.role,
|
|
184
|
-
targetDir: pkg.dir,
|
|
185
|
-
configPaths: options.config.length > 0 ? options.config : parsedConfig,
|
|
186
|
-
checksEnabled: false,
|
|
187
|
-
linkedWorkspace,
|
|
188
|
-
inspectEnabled: options.inspect,
|
|
189
|
-
inspectBrkEnabled: options.inspectBrk,
|
|
190
|
-
require: options.require ?? parsedRequire
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
];
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
exports.default = start;
|
|
198
|
-
exports.findTargetPackages = findTargetPackages;
|
|
199
|
-
//# sourceMappingURL=start.cjs.js.map
|