@backstage/cli 0.36.0-next.2 → 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 +95 -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 +27 -160
- 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,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chalk = require('chalk');
|
|
4
|
-
var ora = require('ora');
|
|
5
|
-
|
|
6
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var chalk__default = /*#__PURE__*/_interopDefaultCompat(chalk);
|
|
9
|
-
var ora__default = /*#__PURE__*/_interopDefaultCompat(ora);
|
|
10
|
-
|
|
11
|
-
const TASK_NAME_MAX_LENGTH = 14;
|
|
12
|
-
class Task {
|
|
13
|
-
static log(name = "") {
|
|
14
|
-
process.stderr.write(`${chalk__default.default.green(name)}
|
|
15
|
-
`);
|
|
16
|
-
}
|
|
17
|
-
static error(message = "") {
|
|
18
|
-
process.stderr.write(`
|
|
19
|
-
${chalk__default.default.red(message)}
|
|
20
|
-
|
|
21
|
-
`);
|
|
22
|
-
}
|
|
23
|
-
static section(name) {
|
|
24
|
-
const title = chalk__default.default.green(`${name}:`);
|
|
25
|
-
process.stderr.write(`
|
|
26
|
-
${title}
|
|
27
|
-
`);
|
|
28
|
-
}
|
|
29
|
-
static exit(code = 0) {
|
|
30
|
-
process.exit(code);
|
|
31
|
-
}
|
|
32
|
-
static async forItem(task, item, taskFunc) {
|
|
33
|
-
const paddedTask = chalk__default.default.green(task.padEnd(TASK_NAME_MAX_LENGTH));
|
|
34
|
-
const spinner = ora__default.default({
|
|
35
|
-
prefixText: chalk__default.default.green(` ${paddedTask}${chalk__default.default.cyan(item)}`),
|
|
36
|
-
spinner: "arc",
|
|
37
|
-
color: "green"
|
|
38
|
-
}).start();
|
|
39
|
-
try {
|
|
40
|
-
const result = await taskFunc();
|
|
41
|
-
spinner.succeed();
|
|
42
|
-
return result;
|
|
43
|
-
} catch (error) {
|
|
44
|
-
spinner.fail();
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
exports.Task = Task;
|
|
51
|
-
//# sourceMappingURL=tasks.cjs.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const TEMPLATE_FILE_NAME = "portable-template.yaml";
|
|
4
|
-
const TEMPLATE_ROLES = [
|
|
5
|
-
"web-library",
|
|
6
|
-
"node-library",
|
|
7
|
-
"common-library",
|
|
8
|
-
"plugin-web-library",
|
|
9
|
-
"plugin-node-library",
|
|
10
|
-
"plugin-common-library",
|
|
11
|
-
"frontend-plugin",
|
|
12
|
-
"frontend-plugin-module",
|
|
13
|
-
"backend-plugin",
|
|
14
|
-
"backend-plugin-module"
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
exports.TEMPLATE_FILE_NAME = TEMPLATE_FILE_NAME;
|
|
18
|
-
exports.TEMPLATE_ROLES = TEMPLATE_ROLES;
|
|
19
|
-
//# sourceMappingURL=types.cjs.js.map
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var semver = require('semver');
|
|
4
|
-
var _package$k = require('../../../packages/backend-plugin-api/package.json.cjs.js');
|
|
5
|
-
var _package$j = require('../../../packages/backend-test-utils/package.json.cjs.js');
|
|
6
|
-
var _package$i = require('../../../packages/catalog-client/package.json.cjs.js');
|
|
7
|
-
var _package$h = require('../../../packages/cli/package.json.cjs.js');
|
|
8
|
-
var _package$g = require('../../../packages/config/package.json.cjs.js');
|
|
9
|
-
var _package$f = require('../../../packages/core-app-api/package.json.cjs.js');
|
|
10
|
-
var _package$e = require('../../../packages/core-components/package.json.cjs.js');
|
|
11
|
-
var _package$d = require('../../../packages/core-plugin-api/package.json.cjs.js');
|
|
12
|
-
var _package$c = require('../../../packages/dev-utils/package.json.cjs.js');
|
|
13
|
-
var _package$b = require('../../../packages/errors/package.json.cjs.js');
|
|
14
|
-
var _package$a = require('../../../packages/frontend-defaults/package.json.cjs.js');
|
|
15
|
-
var _package$9 = require('../../../packages/frontend-plugin-api/package.json.cjs.js');
|
|
16
|
-
var _package$8 = require('../../../packages/frontend-test-utils/package.json.cjs.js');
|
|
17
|
-
var _package$7 = require('../../../packages/test-utils/package.json.cjs.js');
|
|
18
|
-
var _package$4 = require('../../../plugins/scaffolder-node/package.json.cjs.js');
|
|
19
|
-
var _package$3 = require('../../../plugins/scaffolder-node-test-utils/package.json.cjs.js');
|
|
20
|
-
var _package$2 = require('../../../plugins/auth-backend/package.json.cjs.js');
|
|
21
|
-
var _package$1 = require('../../../plugins/auth-backend-module-guest-provider/package.json.cjs.js');
|
|
22
|
-
var _package = require('../../../plugins/catalog-node/package.json.cjs.js');
|
|
23
|
-
var _package$6 = require('../../../packages/theme/package.json.cjs.js');
|
|
24
|
-
var _package$5 = require('../../../packages/types/package.json.cjs.js');
|
|
25
|
-
var _package$l = require('../../../packages/backend-defaults/package.json.cjs.js');
|
|
26
|
-
|
|
27
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
28
|
-
|
|
29
|
-
var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
|
|
30
|
-
|
|
31
|
-
const packageVersions = {
|
|
32
|
-
"@backstage/backend-defaults": _package$l.version,
|
|
33
|
-
"@backstage/backend-plugin-api": _package$k.version,
|
|
34
|
-
"@backstage/backend-test-utils": _package$j.version,
|
|
35
|
-
"@backstage/catalog-client": _package$i.version,
|
|
36
|
-
"@backstage/cli": _package$h.version,
|
|
37
|
-
"@backstage/config": _package$g.version,
|
|
38
|
-
"@backstage/core-app-api": _package$f.version,
|
|
39
|
-
"@backstage/core-components": _package$e.version,
|
|
40
|
-
"@backstage/core-plugin-api": _package$d.version,
|
|
41
|
-
"@backstage/dev-utils": _package$c.version,
|
|
42
|
-
"@backstage/errors": _package$b.version,
|
|
43
|
-
"@backstage/frontend-defaults": _package$a.version,
|
|
44
|
-
"@backstage/frontend-plugin-api": _package$9.version,
|
|
45
|
-
"@backstage/frontend-test-utils": _package$8.version,
|
|
46
|
-
"@backstage/test-utils": _package$7.version,
|
|
47
|
-
"@backstage/theme": _package$6.version,
|
|
48
|
-
"@backstage/types": _package$5.version,
|
|
49
|
-
"@backstage/plugin-scaffolder-node": _package$4.version,
|
|
50
|
-
"@backstage/plugin-scaffolder-node-test-utils": _package$3.version,
|
|
51
|
-
"@backstage/plugin-auth-backend": _package$2.version,
|
|
52
|
-
"@backstage/plugin-auth-backend-module-guest-provider": _package$1.version,
|
|
53
|
-
"@backstage/plugin-catalog-node": _package.version
|
|
54
|
-
};
|
|
55
|
-
function createPackageVersionProvider(lockfile, options) {
|
|
56
|
-
return (name, versionHint) => {
|
|
57
|
-
const packageVersion = packageVersions[name];
|
|
58
|
-
const lockfileEntries = lockfile?.get(name);
|
|
59
|
-
const lockfileEntry = lockfileEntries?.find(
|
|
60
|
-
(entry) => entry.range.startsWith("workspace:")
|
|
61
|
-
);
|
|
62
|
-
if (lockfileEntry) {
|
|
63
|
-
return "workspace:^";
|
|
64
|
-
}
|
|
65
|
-
if (options?.preferBackstageProtocol && name.startsWith("@backstage/")) {
|
|
66
|
-
return "backstage:^";
|
|
67
|
-
}
|
|
68
|
-
const targetVersion = versionHint || packageVersion;
|
|
69
|
-
if (!targetVersion) {
|
|
70
|
-
throw new Error(`No version available for package ${name}`);
|
|
71
|
-
}
|
|
72
|
-
const validRanges = lockfileEntries?.filter(
|
|
73
|
-
(entry) => semver__default.default.satisfies(targetVersion, entry.range)
|
|
74
|
-
);
|
|
75
|
-
const highestRange = validRanges?.slice(-1)[0];
|
|
76
|
-
if (highestRange?.range) {
|
|
77
|
-
return highestRange?.range;
|
|
78
|
-
}
|
|
79
|
-
if (packageVersion) {
|
|
80
|
-
return `^${packageVersion}`;
|
|
81
|
-
}
|
|
82
|
-
if (semver__default.default.parse(versionHint)?.prerelease.length) {
|
|
83
|
-
return versionHint;
|
|
84
|
-
}
|
|
85
|
-
return versionHint?.match(/^[\d\.]+$/) ? `^${versionHint}` : versionHint;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
exports.createPackageVersionProvider = createPackageVersionProvider;
|
|
90
|
-
exports.packageVersions = packageVersions;
|
|
91
|
-
//# sourceMappingURL=version.cjs.js.map
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cliCommon = require('@backstage/cli-common');
|
|
6
|
-
|
|
7
|
-
function includesAnyOf(hayStack, ...needles) {
|
|
8
|
-
for (const needle of needles) {
|
|
9
|
-
if (hayStack.includes(needle)) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
var test = async ({ args }) => {
|
|
16
|
-
if (!includesAnyOf(args, "-c", "--config")) {
|
|
17
|
-
args.push("--config", cliCommon.findOwnPaths(__dirname).resolve("config/jest.js"));
|
|
18
|
-
}
|
|
19
|
-
if (!includesAnyOf(args, "--no-passWithNoTests", "--passWithNoTests=false")) {
|
|
20
|
-
args.push("--passWithNoTests");
|
|
21
|
-
}
|
|
22
|
-
if (!process.env.CI && !args.includes("--coverage") && // explicitly no watching
|
|
23
|
-
!includesAnyOf(args, "--no-watch", "--watch=false", "--watchAll=false") && // already watching
|
|
24
|
-
!includesAnyOf(args, "--watch", "--watchAll")) {
|
|
25
|
-
const isGitRepo = () => cliCommon.runCheck(["git", "rev-parse", "--is-inside-work-tree"]);
|
|
26
|
-
const isMercurialRepo = () => cliCommon.runCheck(["hg", "--cwd", ".", "root"]);
|
|
27
|
-
if (await isGitRepo() || await isMercurialRepo()) {
|
|
28
|
-
args.push("--watch");
|
|
29
|
-
} else {
|
|
30
|
-
args.push("--watchAll");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (!process.env.NODE_ENV) {
|
|
34
|
-
process.env.NODE_ENV = "test";
|
|
35
|
-
}
|
|
36
|
-
if (!process.env.TZ) {
|
|
37
|
-
process.env.TZ = "UTC";
|
|
38
|
-
}
|
|
39
|
-
if (!process.env.NODE_OPTIONS?.includes("--node-snapshot")) {
|
|
40
|
-
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : ""}--no-node-snapshot`;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
require.resolve("jest");
|
|
44
|
-
} catch {
|
|
45
|
-
console.error(
|
|
46
|
-
[
|
|
47
|
-
"No Jest installation found in this project.",
|
|
48
|
-
"",
|
|
49
|
-
"To support opt-in migration to Jest v30, the Backstage CLI now expects Jest to be installed as a devDependency.",
|
|
50
|
-
"See the migration guide in the changelog for version options and their consequences."
|
|
51
|
-
].join("\n")
|
|
52
|
-
);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
await require("jest").run(args);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
exports.default = test;
|
|
59
|
-
//# sourceMappingURL=test.cjs.js.map
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var os = require('node:os');
|
|
6
|
-
var crypto = require('node:crypto');
|
|
7
|
-
var cleye = require('cleye');
|
|
8
|
-
var yargs = require('yargs');
|
|
9
|
-
var jestCli = require('jest-cli');
|
|
10
|
-
var path = require('node:path');
|
|
11
|
-
var cliNode = require('@backstage/cli-node');
|
|
12
|
-
var cliCommon = require('@backstage/cli-common');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
-
|
|
16
|
-
var os__default = /*#__PURE__*/_interopDefaultCompat(os);
|
|
17
|
-
var crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
|
|
18
|
-
var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
|
|
19
|
-
|
|
20
|
-
async function readPackageTreeHashes(graph) {
|
|
21
|
-
const pkgs = Array.from(graph.values()).map((pkg) => ({
|
|
22
|
-
...pkg,
|
|
23
|
-
path: path.relative(cliCommon.targetPaths.rootDir, pkg.dir)
|
|
24
|
-
}));
|
|
25
|
-
const output = await cliCommon.runOutput([
|
|
26
|
-
"git",
|
|
27
|
-
"ls-tree",
|
|
28
|
-
"--format=%(objectname)=%(path)",
|
|
29
|
-
"HEAD",
|
|
30
|
-
"--",
|
|
31
|
-
...pkgs.map((pkg) => pkg.path)
|
|
32
|
-
]);
|
|
33
|
-
const map = new Map(
|
|
34
|
-
output.trim().split(/\r?\n/).map((line) => {
|
|
35
|
-
const [itemSha, ...itemPathParts] = line.split("=");
|
|
36
|
-
const itemPath = itemPathParts.join("=");
|
|
37
|
-
const pkg = pkgs.find((p) => p.path === itemPath);
|
|
38
|
-
if (!pkg) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
`Unexpectedly missing tree sha entry for path ${itemPath}`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return [pkg.packageJson.name, itemSha];
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
return (pkgName) => {
|
|
47
|
-
const sha = map.get(pkgName);
|
|
48
|
-
if (!sha) {
|
|
49
|
-
throw new Error(`Tree sha not found for ${pkgName}`);
|
|
50
|
-
}
|
|
51
|
-
return sha;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function createFlagFinder(args) {
|
|
55
|
-
const flags = /* @__PURE__ */ new Set();
|
|
56
|
-
for (const arg of args) {
|
|
57
|
-
if (arg.startsWith("--no-")) {
|
|
58
|
-
flags.add(`--${arg.slice("--no-".length)}`);
|
|
59
|
-
} else if (arg.startsWith("--")) {
|
|
60
|
-
flags.add(arg.split("=")[0]);
|
|
61
|
-
} else if (arg.startsWith("-")) {
|
|
62
|
-
const shortFlags = arg.slice(1).split("");
|
|
63
|
-
for (const shortFlag of shortFlags) {
|
|
64
|
-
flags.add(`-${shortFlag}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return (...findFlags) => {
|
|
69
|
-
for (const flag of findFlags) {
|
|
70
|
-
if (flags.has(flag)) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
var test = async ({ args, info }) => {
|
|
78
|
-
const testGlobal = global;
|
|
79
|
-
for (const flag of ["successCache", "successCacheDir", "jestHelp"]) {
|
|
80
|
-
if (args.some((a) => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
|
|
81
|
-
process.stderr.write(
|
|
82
|
-
`DEPRECATION WARNING: --${flag} is deprecated, use the kebab-case form instead
|
|
83
|
-
`
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const { flags: opts } = cleye.cli(
|
|
88
|
-
{
|
|
89
|
-
help: info,
|
|
90
|
-
booleanFlagNegation: true,
|
|
91
|
-
flags: {
|
|
92
|
-
since: {
|
|
93
|
-
type: String,
|
|
94
|
-
description: "Only include test packages changed since the specified ref"
|
|
95
|
-
},
|
|
96
|
-
successCache: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
description: "Cache and skip tests for unchanged packages"
|
|
99
|
-
},
|
|
100
|
-
successCacheDir: {
|
|
101
|
-
type: String,
|
|
102
|
-
description: "Directory for the success cache"
|
|
103
|
-
},
|
|
104
|
-
jestHelp: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
description: "Show Jest's own help output"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
ignoreArgv: (type) => type === "unknown-flag" || type === "argument"
|
|
110
|
-
},
|
|
111
|
-
void 0,
|
|
112
|
-
args
|
|
113
|
-
);
|
|
114
|
-
const hasFlags = createFlagFinder(args);
|
|
115
|
-
const sinceRef = opts.since || void 0;
|
|
116
|
-
const { _: parsedArgs } = await yargs__default.default(args).options(jestCli.yargsOptions).argv;
|
|
117
|
-
if (!hasFlags("-c", "--config")) {
|
|
118
|
-
args.push("--config", cliCommon.findOwnPaths(__dirname).resolve("config/jest.js"));
|
|
119
|
-
}
|
|
120
|
-
if (!hasFlags("--passWithNoTests")) {
|
|
121
|
-
args.push("--passWithNoTests");
|
|
122
|
-
}
|
|
123
|
-
let isSingleWatchMode = args.includes("--watch");
|
|
124
|
-
if (!sinceRef && !process.env.CI && !hasFlags("--coverage", "--watch", "--watchAll")) {
|
|
125
|
-
const isGitRepo = () => cliCommon.runCheck(["git", "rev-parse", "--is-inside-work-tree"]);
|
|
126
|
-
const isMercurialRepo = () => cliCommon.runCheck(["hg", "--cwd", ".", "root"]);
|
|
127
|
-
if (await isGitRepo() || await isMercurialRepo()) {
|
|
128
|
-
isSingleWatchMode = true;
|
|
129
|
-
args.push("--watch");
|
|
130
|
-
} else {
|
|
131
|
-
args.push("--watchAll");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (isSingleWatchMode && parsedArgs.length > 0) {
|
|
135
|
-
testGlobal.__backstageCli_watchProjectFilter = {
|
|
136
|
-
async filter(projectConfigs) {
|
|
137
|
-
const selectedProjects2 = [];
|
|
138
|
-
const usedArgs = /* @__PURE__ */ new Set();
|
|
139
|
-
for (const project of projectConfigs) {
|
|
140
|
-
for (const arg of parsedArgs) {
|
|
141
|
-
if (cliCommon.isChildPath(project.rootDir, String(arg))) {
|
|
142
|
-
selectedProjects2.push(project);
|
|
143
|
-
usedArgs.add(arg);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (usedArgs.size !== parsedArgs.length) {
|
|
148
|
-
return projectConfigs;
|
|
149
|
-
}
|
|
150
|
-
return selectedProjects2;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
if (!hasFlags("--workerIdleMemoryLimit")) {
|
|
155
|
-
args.push("--workerIdleMemoryLimit=1000M");
|
|
156
|
-
}
|
|
157
|
-
if (os__default.default.cpus().length <= 3 && !hasFlags("-i", "--runInBand", "-w", "--maxWorkers")) {
|
|
158
|
-
args.push("--maxWorkers=2");
|
|
159
|
-
}
|
|
160
|
-
let packageGraph;
|
|
161
|
-
async function getPackageGraph() {
|
|
162
|
-
if (packageGraph) {
|
|
163
|
-
return packageGraph;
|
|
164
|
-
}
|
|
165
|
-
const packages = await cliNode.PackageGraph.listTargetPackages();
|
|
166
|
-
packageGraph = cliNode.PackageGraph.fromPackages(packages);
|
|
167
|
-
return packageGraph;
|
|
168
|
-
}
|
|
169
|
-
let selectedProjects = void 0;
|
|
170
|
-
if (sinceRef && !hasFlags("--selectProjects")) {
|
|
171
|
-
const graph = await getPackageGraph();
|
|
172
|
-
const changedPackages = await graph.listChangedPackages({
|
|
173
|
-
ref: sinceRef,
|
|
174
|
-
analyzeLockfile: true
|
|
175
|
-
});
|
|
176
|
-
selectedProjects = Array.from(
|
|
177
|
-
graph.collectPackageNames(
|
|
178
|
-
changedPackages.map((pkg) => pkg.name),
|
|
179
|
-
(pkg) => pkg.allLocalDependents.keys()
|
|
180
|
-
)
|
|
181
|
-
);
|
|
182
|
-
if (selectedProjects.length === 0) {
|
|
183
|
-
console.log(`No packages changed since ${opts.since}`);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
args.push("--selectProjects", ...selectedProjects);
|
|
187
|
-
}
|
|
188
|
-
if (!process.env.NODE_ENV) {
|
|
189
|
-
process.env.NODE_ENV = "test";
|
|
190
|
-
}
|
|
191
|
-
if (!process.env.TZ) {
|
|
192
|
-
process.env.TZ = "UTC";
|
|
193
|
-
}
|
|
194
|
-
if (!process.env.NODE_OPTIONS?.includes("--node-snapshot")) {
|
|
195
|
-
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : ""}--no-node-snapshot`;
|
|
196
|
-
}
|
|
197
|
-
if (opts.jestHelp) {
|
|
198
|
-
args.push("--help");
|
|
199
|
-
}
|
|
200
|
-
if (opts.successCache) {
|
|
201
|
-
if (parsedArgs.length > 0) {
|
|
202
|
-
throw new Error(
|
|
203
|
-
`The --successCache flag can not be combined with the following arguments: ${parsedArgs.join(
|
|
204
|
-
", "
|
|
205
|
-
)}`
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
if (args.includes("--shard")) {
|
|
209
|
-
throw new Error(
|
|
210
|
-
`The --successCache flag can not be combined with the --shard flag`
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
const cache = cliNode.SuccessCache.create({
|
|
214
|
-
name: "test",
|
|
215
|
-
basePath: opts.successCacheDir
|
|
216
|
-
});
|
|
217
|
-
const graph = await getPackageGraph();
|
|
218
|
-
const projectHashes = /* @__PURE__ */ new Map();
|
|
219
|
-
const outputSuccessCache = new Array();
|
|
220
|
-
testGlobal.__backstageCli_jestSuccessCache = {
|
|
221
|
-
// This is called by `config/jest.js` after the project configs have been gathered
|
|
222
|
-
async filterConfigs(projectConfigs, globalRootConfig) {
|
|
223
|
-
const cacheEntries = await cache.read();
|
|
224
|
-
const lockfile = await cliNode.Lockfile.load(
|
|
225
|
-
cliCommon.targetPaths.resolveRoot("yarn.lock")
|
|
226
|
-
);
|
|
227
|
-
const getPackageTreeHash = await readPackageTreeHashes(graph);
|
|
228
|
-
const baseHash = crypto__default.default.createHash("sha1");
|
|
229
|
-
baseHash.update("v1");
|
|
230
|
-
baseHash.update("\0");
|
|
231
|
-
baseHash.update(process.version);
|
|
232
|
-
baseHash.update("\0");
|
|
233
|
-
baseHash.update(
|
|
234
|
-
cliNode.SuccessCache.trimPaths(JSON.stringify(globalRootConfig))
|
|
235
|
-
);
|
|
236
|
-
const baseSha = baseHash.digest("hex");
|
|
237
|
-
return projectConfigs.filter((project) => {
|
|
238
|
-
const packageName = project.displayName;
|
|
239
|
-
const pkg = graph.get(packageName);
|
|
240
|
-
if (!pkg) {
|
|
241
|
-
throw new Error(
|
|
242
|
-
`Package ${packageName} not found in package graph`
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
const hash = crypto__default.default.createHash("sha1");
|
|
246
|
-
hash.update(baseSha);
|
|
247
|
-
const packageTreeSha = getPackageTreeHash(packageName);
|
|
248
|
-
hash.update(packageTreeSha);
|
|
249
|
-
for (const [depName, depPkg] of pkg.allLocalDependencies) {
|
|
250
|
-
const depHash = getPackageTreeHash(depPkg.name);
|
|
251
|
-
hash.update(`${depName}:${depHash}`);
|
|
252
|
-
}
|
|
253
|
-
hash.update(cliNode.SuccessCache.trimPaths(JSON.stringify(project)));
|
|
254
|
-
hash.update(lockfile.getDependencyTreeHash(packageName));
|
|
255
|
-
const sha = hash.digest("hex");
|
|
256
|
-
projectHashes.set(packageName, sha);
|
|
257
|
-
if (cacheEntries.has(sha)) {
|
|
258
|
-
if (!selectedProjects || selectedProjects.includes(packageName)) {
|
|
259
|
-
console.log(`Skipped ${packageName} due to cache hit`);
|
|
260
|
-
}
|
|
261
|
-
outputSuccessCache.push(sha);
|
|
262
|
-
return void 0;
|
|
263
|
-
}
|
|
264
|
-
return project;
|
|
265
|
-
});
|
|
266
|
-
},
|
|
267
|
-
// This is called by `config/jestCacheResultProcess.cjs` after all tests have run
|
|
268
|
-
async reportResults(results) {
|
|
269
|
-
const successful = /* @__PURE__ */ new Set();
|
|
270
|
-
const failed = /* @__PURE__ */ new Set();
|
|
271
|
-
for (const testResult of results.testResults) {
|
|
272
|
-
for (const [pkgName, pkg] of graph) {
|
|
273
|
-
if (cliCommon.isChildPath(pkg.dir, testResult.testFilePath)) {
|
|
274
|
-
if (testResult.testExecError || testResult.failureMessage || testResult.numFailingTests > 0) {
|
|
275
|
-
failed.add(pkgName);
|
|
276
|
-
successful.delete(pkgName);
|
|
277
|
-
} else if (!failed.has(pkgName)) {
|
|
278
|
-
successful.add(pkgName);
|
|
279
|
-
}
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
for (const pkgName of successful) {
|
|
285
|
-
const sha = projectHashes.get(pkgName);
|
|
286
|
-
if (sha) {
|
|
287
|
-
outputSuccessCache.push(sha);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
await cache.write(outputSuccessCache);
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
await jestCli.run(args);
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
exports.createFlagFinder = createFlagFinder;
|
|
298
|
-
exports.default = test;
|
|
299
|
-
//# sourceMappingURL=test.cjs.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
|
|
7
|
-
var index = factory.createCliPlugin({
|
|
8
|
-
pluginId: "test",
|
|
9
|
-
init: async (reg) => {
|
|
10
|
-
reg.addCommand({
|
|
11
|
-
path: ["repo", "test"],
|
|
12
|
-
description: "Run tests, forwarding args to Jest, defaulting to watch mode",
|
|
13
|
-
execute: { loader: () => import('./commands/repo/test.cjs.js') }
|
|
14
|
-
});
|
|
15
|
-
reg.addCommand({
|
|
16
|
-
path: ["package", "test"],
|
|
17
|
-
description: "Run tests, forwarding args to Jest, defaulting to watch mode",
|
|
18
|
-
execute: { loader: () => import('./commands/package/test.cjs.js') }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
exports.default = index;
|
|
24
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var cleye = require('cleye');
|
|
6
|
-
var cliCommon = require('@backstage/cli-common');
|
|
7
|
-
var fs = require('fs-extra');
|
|
8
|
-
var path = require('node:path');
|
|
9
|
-
var discoverPackages = require('../lib/discoverPackages.cjs.js');
|
|
10
|
-
var extractTranslations = require('../lib/extractTranslations.cjs.js');
|
|
11
|
-
var messageFilePath = require('../lib/messageFilePath.cjs.js');
|
|
12
|
-
|
|
13
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
|
-
|
|
17
|
-
var _export = async ({ args, info }) => {
|
|
18
|
-
const {
|
|
19
|
-
flags: { output, pattern }
|
|
20
|
-
} = cleye.cli(
|
|
21
|
-
{
|
|
22
|
-
help: info,
|
|
23
|
-
booleanFlagNegation: true,
|
|
24
|
-
flags: {
|
|
25
|
-
output: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: "translations",
|
|
28
|
-
description: "Output directory for exported messages and manifest"
|
|
29
|
-
},
|
|
30
|
-
pattern: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: messageFilePath.DEFAULT_MESSAGE_PATTERN,
|
|
33
|
-
description: "File path pattern for message files, with {id} and {lang} placeholders"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
void 0,
|
|
38
|
-
args
|
|
39
|
-
);
|
|
40
|
-
const options = { output, pattern };
|
|
41
|
-
messageFilePath.validatePattern(options.pattern);
|
|
42
|
-
const targetPackageJson = await discoverPackages.readTargetPackage(
|
|
43
|
-
cliCommon.targetPaths.dir,
|
|
44
|
-
cliCommon.targetPaths.rootDir
|
|
45
|
-
);
|
|
46
|
-
const outputDir = path.resolve(cliCommon.targetPaths.dir, options.output);
|
|
47
|
-
const manifestPath = path.resolve(outputDir, "manifest.json");
|
|
48
|
-
const tsconfigPath = cliCommon.targetPaths.resolveRoot("tsconfig.json");
|
|
49
|
-
if (!await fs__default.default.pathExists(tsconfigPath)) {
|
|
50
|
-
throw new Error(
|
|
51
|
-
`No tsconfig.json found at ${tsconfigPath}. The translations export command requires a tsconfig.json in the repo root.`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
console.log(
|
|
55
|
-
`Discovering frontend dependencies of ${targetPackageJson.name}...`
|
|
56
|
-
);
|
|
57
|
-
const packages = await discoverPackages.discoverFrontendPackages(
|
|
58
|
-
targetPackageJson,
|
|
59
|
-
cliCommon.targetPaths.dir
|
|
60
|
-
);
|
|
61
|
-
console.log(`Found ${packages.length} frontend packages to scan`);
|
|
62
|
-
console.log("Creating TypeScript project...");
|
|
63
|
-
const project = extractTranslations.createTranslationProject(tsconfigPath);
|
|
64
|
-
const allRefs = [];
|
|
65
|
-
for (const pkg of packages) {
|
|
66
|
-
for (const [exportPath, filePath] of pkg.entryPoints) {
|
|
67
|
-
try {
|
|
68
|
-
const sourceFile = project.addSourceFileAtPath(filePath);
|
|
69
|
-
const refs = extractTranslations.extractTranslationRefsFromSourceFile(
|
|
70
|
-
sourceFile,
|
|
71
|
-
pkg.name,
|
|
72
|
-
exportPath
|
|
73
|
-
);
|
|
74
|
-
allRefs.push(...refs);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.warn(
|
|
77
|
-
` Warning: failed to process ${pkg.name} (${exportPath}): ${error}`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (allRefs.length === 0) {
|
|
83
|
-
console.log("No translation refs found.");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
console.log(`Found ${allRefs.length} translation ref(s):`);
|
|
87
|
-
for (const ref of allRefs) {
|
|
88
|
-
const messageCount = Object.keys(ref.messages).length;
|
|
89
|
-
console.log(` ${ref.id} (${ref.packageName}, ${messageCount} messages)`);
|
|
90
|
-
}
|
|
91
|
-
for (const ref of allRefs) {
|
|
92
|
-
const relPath = messageFilePath.formatMessagePath(
|
|
93
|
-
options.pattern,
|
|
94
|
-
ref.id,
|
|
95
|
-
messageFilePath.DEFAULT_LANGUAGE
|
|
96
|
-
);
|
|
97
|
-
const filePath = path.resolve(outputDir, relPath);
|
|
98
|
-
await fs__default.default.ensureDir(path.dirname(filePath));
|
|
99
|
-
await fs__default.default.writeJson(filePath, ref.messages, { spaces: 2 });
|
|
100
|
-
}
|
|
101
|
-
const manifest = {};
|
|
102
|
-
for (const ref of allRefs) {
|
|
103
|
-
manifest[ref.id] = {
|
|
104
|
-
package: ref.packageName,
|
|
105
|
-
exportPath: ref.exportPath,
|
|
106
|
-
exportName: ref.exportName
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
await fs__default.default.writeJson(
|
|
110
|
-
manifestPath,
|
|
111
|
-
{ pattern: options.pattern, refs: manifest },
|
|
112
|
-
{ spaces: 2 }
|
|
113
|
-
);
|
|
114
|
-
const examplePath = messageFilePath.formatMessagePath(
|
|
115
|
-
options.pattern,
|
|
116
|
-
"<ref-id>",
|
|
117
|
-
messageFilePath.DEFAULT_LANGUAGE
|
|
118
|
-
);
|
|
119
|
-
console.log(
|
|
120
|
-
`
|
|
121
|
-
Exported ${allRefs.length} translation ref(s) to ${options.output}/`
|
|
122
|
-
);
|
|
123
|
-
console.log(` Messages: ${options.output}/${examplePath}`);
|
|
124
|
-
console.log(` Manifest: ${options.output}/manifest.json`);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
exports.default = _export;
|
|
128
|
-
//# sourceMappingURL=export.cjs.js.map
|