@backstage/cli 0.35.5-next.0 → 0.36.0-next.2
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 +42 -0
- package/config/jest.js +2 -2
- package/dist/index.cjs.js +1 -0
- package/dist/modules/auth/commands/list.cjs.js +23 -0
- package/dist/modules/auth/commands/login.cjs.js +316 -0
- package/dist/modules/auth/commands/logout.cjs.js +55 -0
- package/dist/modules/auth/commands/printToken.cjs.js +41 -0
- package/dist/modules/auth/commands/select.cjs.js +32 -0
- package/dist/modules/auth/commands/show.cjs.js +59 -0
- package/dist/modules/auth/index.cjs.js +44 -0
- package/dist/modules/auth/lib/auth.cjs.js +60 -0
- package/dist/modules/auth/lib/http.cjs.js +26 -0
- package/dist/modules/auth/lib/localServer.cjs.js +80 -0
- package/dist/modules/auth/lib/pkce.cjs.js +23 -0
- package/dist/modules/auth/lib/prompt.cjs.js +44 -0
- package/dist/modules/auth/lib/secretStore.cjs.js +81 -0
- package/dist/modules/auth/lib/storage.cjs.js +152 -0
- package/dist/modules/build/commands/buildWorkspace.cjs.js +31 -2
- package/dist/modules/build/commands/package/build/command.cjs.js +62 -15
- package/dist/modules/build/commands/package/build/index.cjs.js +3 -1
- package/dist/modules/{maintenance → build}/commands/package/clean.cjs.js +4 -2
- package/dist/modules/build/commands/package/postpack.cjs.js +15 -0
- package/dist/modules/{maintenance/commands/package/pack.cjs.js → build/commands/package/prepack.cjs.js} +10 -10
- package/dist/modules/build/commands/package/start/command.cjs.js +68 -11
- package/dist/modules/build/commands/package/start/index.cjs.js +3 -1
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +1 -1
- package/dist/modules/build/commands/repo/build.cjs.js +46 -11
- package/dist/modules/{maintenance → build}/commands/repo/clean.cjs.js +7 -3
- package/dist/modules/build/commands/repo/start.cjs.js +54 -5
- package/dist/modules/build/index.cjs.js +32 -123
- package/dist/modules/build/lib/buildFrontend.cjs.js +2 -2
- package/dist/modules/build/lib/bundler/config.cjs.js +1 -1
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +1 -1
- package/dist/modules/build/lib/bundler/server.cjs.js +1 -1
- package/dist/modules/build/lib/config.cjs.js +94 -0
- package/dist/modules/build/lib/optionsParser.cjs.js +22 -0
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +1 -1
- package/dist/modules/build/lib/packager/productionPack.cjs.js +1 -1
- package/dist/modules/build/lib/role.cjs.js +1 -1
- package/dist/modules/config/commands/docs.cjs.js +19 -2
- package/dist/modules/config/commands/print.cjs.js +41 -13
- package/dist/modules/config/commands/schema.cjs.js +25 -6
- package/dist/modules/config/commands/validate.cjs.js +38 -7
- package/dist/modules/config/index.cjs.js +6 -65
- package/dist/modules/config/lib/config.cjs.js +6 -22
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +14 -3
- package/dist/modules/create-github-app/index.cjs.js +1 -9
- package/dist/modules/info/commands/info.cjs.js +26 -6
- package/dist/modules/info/index.cjs.js +1 -23
- package/dist/modules/lint/commands/package/lint.cjs.js +42 -10
- package/dist/modules/lint/commands/repo/lint.cjs.js +99 -27
- package/dist/modules/lint/index.cjs.js +2 -60
- package/dist/modules/lint/lib/optionsParser.cjs.js +22 -0
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +32 -9
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +20 -4
- package/dist/modules/maintenance/index.cjs.js +2 -64
- package/dist/modules/migrate/commands/packageExports.cjs.js +9 -11
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +7 -3
- package/dist/modules/migrate/commands/packageRole.cjs.js +3 -1
- package/dist/modules/migrate/commands/packageScripts.cjs.js +11 -7
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +7 -3
- package/dist/modules/migrate/commands/versions/bump.cjs.js +48 -20
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +24 -3
- package/dist/modules/migrate/index.cjs.js +12 -55
- package/dist/modules/new/commands/new.cjs.js +70 -15
- package/dist/modules/new/index.cjs.js +1 -29
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +5 -9
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +8 -8
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +18 -18
- package/dist/{lib → modules/new/lib}/version.cjs.js +22 -34
- package/dist/modules/test/commands/package/test.cjs.js +1 -10
- package/dist/modules/test/commands/repo/test.cjs.js +51 -39
- package/dist/modules/test/index.cjs.js +2 -32
- package/dist/modules/translations/commands/export.cjs.js +25 -1
- package/dist/modules/translations/commands/import.cjs.js +25 -1
- package/dist/modules/translations/index.cjs.js +2 -37
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/catalog-client/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +7 -6
- package/dist/packages/core-app-api/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/frontend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/frontend-test-utils/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
- package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
- package/dist/wiring/CliInitializer.cjs.js +24 -7
- package/dist/wiring/version.cjs.js +20 -0
- package/package.json +26 -22
- package/dist/lib/cache/SuccessCache.cjs.js +0 -79
- package/dist/lib/lazy.cjs.js +0 -22
- package/dist/lib/optionsParser.cjs.js +0 -37
- package/dist/lib/versioning/Lockfile.cjs.js +0 -89
- package/dist/lib/yarnPlugin.cjs.js +0 -46
- /package/dist/modules/{maintenance → build}/lib/publishing.cjs.js +0 -0
- /package/dist/{lib → modules/build/lib}/typeDistProject.cjs.js +0 -0
- /package/dist/{lib → modules/migrate/lib}/versioning/packages.cjs.js +0 -0
- /package/dist/{lib → modules/migrate/lib}/versioning/yarn.cjs.js +0 -0
- /package/dist/{lib → wiring}/errors.cjs.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var zod = require('zod');
|
|
4
4
|
var fs = require('fs-extra');
|
|
5
5
|
var recursiveReaddir = require('recursive-readdir');
|
|
6
6
|
var path = require('node:path');
|
|
7
|
-
var
|
|
7
|
+
var YAML = require('yaml');
|
|
8
8
|
var cliCommon = require('@backstage/cli-common');
|
|
9
9
|
var types = require('../types.cjs.js');
|
|
10
10
|
var errors = require('@backstage/errors');
|
|
@@ -15,11 +15,11 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
16
16
|
var recursiveReaddir__default = /*#__PURE__*/_interopDefaultCompat(recursiveReaddir);
|
|
17
17
|
|
|
18
|
-
const templateDefinitionSchema =
|
|
19
|
-
name:
|
|
20
|
-
role:
|
|
21
|
-
description:
|
|
22
|
-
values:
|
|
18
|
+
const templateDefinitionSchema = zod.z.object({
|
|
19
|
+
name: zod.z.string(),
|
|
20
|
+
role: zod.z.enum(types.TEMPLATE_ROLES),
|
|
21
|
+
description: zod.z.string().optional(),
|
|
22
|
+
values: zod.z.record(zod.z.string()).optional()
|
|
23
23
|
}).strict();
|
|
24
24
|
async function loadPortableTemplate(pointer) {
|
|
25
25
|
if (pointer.target.match(/https?:\/\//)) {
|
|
@@ -31,7 +31,7 @@ async function loadPortableTemplate(pointer) {
|
|
|
31
31
|
error
|
|
32
32
|
);
|
|
33
33
|
});
|
|
34
|
-
const rawTemplate =
|
|
34
|
+
const rawTemplate = YAML.parse(templateContent);
|
|
35
35
|
const parsed = templateDefinitionSchema.safeParse(rawTemplate);
|
|
36
36
|
if (!parsed.success) {
|
|
37
37
|
throw new errors.ForwardedError(
|
|
@@ -5,8 +5,8 @@ var path = require('node:path');
|
|
|
5
5
|
var cliCommon = require('@backstage/cli-common');
|
|
6
6
|
var defaultTemplates = require('../defaultTemplates.cjs.js');
|
|
7
7
|
var types = require('../types.cjs.js');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var YAML = require('yaml');
|
|
9
|
+
var zod = require('zod');
|
|
10
10
|
var v3 = require('zod-validation-error/v3');
|
|
11
11
|
var errors = require('@backstage/errors');
|
|
12
12
|
|
|
@@ -22,20 +22,20 @@ const defaults = {
|
|
|
22
22
|
packageNamePrefix: "@internal/",
|
|
23
23
|
packageNamePluginInfix: "plugin-"
|
|
24
24
|
};
|
|
25
|
-
const newConfigSchema =
|
|
26
|
-
templates:
|
|
27
|
-
globals:
|
|
28
|
-
license:
|
|
29
|
-
version:
|
|
30
|
-
private:
|
|
31
|
-
publishRegistry:
|
|
32
|
-
namePrefix:
|
|
33
|
-
namePluginInfix:
|
|
25
|
+
const newConfigSchema = zod.z.object({
|
|
26
|
+
templates: zod.z.array(zod.z.string()).optional(),
|
|
27
|
+
globals: zod.z.object({
|
|
28
|
+
license: zod.z.string().optional(),
|
|
29
|
+
version: zod.z.string().optional(),
|
|
30
|
+
private: zod.z.boolean().optional(),
|
|
31
|
+
publishRegistry: zod.z.string().optional(),
|
|
32
|
+
namePrefix: zod.z.string().optional(),
|
|
33
|
+
namePluginInfix: zod.z.string().optional()
|
|
34
34
|
}).optional()
|
|
35
35
|
}).strict();
|
|
36
|
-
const pkgJsonWithNewConfigSchema =
|
|
37
|
-
backstage:
|
|
38
|
-
cli:
|
|
36
|
+
const pkgJsonWithNewConfigSchema = zod.z.object({
|
|
37
|
+
backstage: zod.z.object({
|
|
38
|
+
cli: zod.z.object({
|
|
39
39
|
new: newConfigSchema.optional()
|
|
40
40
|
}).optional()
|
|
41
41
|
}).optional()
|
|
@@ -110,13 +110,13 @@ function resolveLocalTemplatePath(pointer, basePath) {
|
|
|
110
110
|
paths: [basePath]
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
const partialTemplateDefinitionSchema =
|
|
114
|
-
name:
|
|
115
|
-
description:
|
|
113
|
+
const partialTemplateDefinitionSchema = zod.z.object({
|
|
114
|
+
name: zod.z.string(),
|
|
115
|
+
description: zod.z.string().optional()
|
|
116
116
|
});
|
|
117
117
|
async function peekLocalTemplateDefinition(target) {
|
|
118
118
|
const content = await fs__default.default.readFile(target, "utf8");
|
|
119
|
-
const rawTemplate =
|
|
119
|
+
const rawTemplate = YAML.parse(content);
|
|
120
120
|
const parsed = partialTemplateDefinitionSchema.safeParse(rawTemplate);
|
|
121
121
|
if (!parsed.success) {
|
|
122
122
|
throw v3.fromZodError(parsed.error);
|
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
3
|
var semver = require('semver');
|
|
5
|
-
var
|
|
6
|
-
var _package$
|
|
7
|
-
var _package$
|
|
8
|
-
var _package$
|
|
9
|
-
var _package$
|
|
10
|
-
var _package$
|
|
11
|
-
var _package$
|
|
12
|
-
var _package$
|
|
13
|
-
var _package$
|
|
14
|
-
var _package$
|
|
15
|
-
var _package$
|
|
16
|
-
var _package$
|
|
17
|
-
var _package$
|
|
18
|
-
var _package$
|
|
19
|
-
var _package$
|
|
20
|
-
var _package$
|
|
21
|
-
var _package$
|
|
22
|
-
var _package$
|
|
23
|
-
var _package
|
|
24
|
-
var _package = require('
|
|
25
|
-
var _package$
|
|
26
|
-
var _package$
|
|
27
|
-
var _package$l = require('../packages/backend-defaults/package.json.cjs.js');
|
|
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');
|
|
28
26
|
|
|
29
27
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
30
28
|
|
|
31
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
32
29
|
var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
|
|
33
30
|
|
|
34
|
-
const ownPaths = cliCommon.findOwnPaths(__dirname);
|
|
35
31
|
const packageVersions = {
|
|
36
32
|
"@backstage/backend-defaults": _package$l.version,
|
|
37
33
|
"@backstage/backend-plugin-api": _package$k.version,
|
|
@@ -56,12 +52,6 @@ const packageVersions = {
|
|
|
56
52
|
"@backstage/plugin-auth-backend-module-guest-provider": _package$1.version,
|
|
57
53
|
"@backstage/plugin-catalog-node": _package.version
|
|
58
54
|
};
|
|
59
|
-
function findVersion() {
|
|
60
|
-
const pkgContent = fs__default.default.readFileSync(ownPaths.resolve("package.json"), "utf8");
|
|
61
|
-
return JSON.parse(pkgContent).version;
|
|
62
|
-
}
|
|
63
|
-
const version = findVersion();
|
|
64
|
-
fs__default.default.pathExistsSync(ownPaths.resolve("src"));
|
|
65
55
|
function createPackageVersionProvider(lockfile, options) {
|
|
66
56
|
return (name, versionHint) => {
|
|
67
57
|
const packageVersion = packageVersions[name];
|
|
@@ -97,7 +87,5 @@ function createPackageVersionProvider(lockfile, options) {
|
|
|
97
87
|
}
|
|
98
88
|
|
|
99
89
|
exports.createPackageVersionProvider = createPackageVersionProvider;
|
|
100
|
-
exports.findVersion = findVersion;
|
|
101
90
|
exports.packageVersions = packageVersions;
|
|
102
|
-
exports.version = version;
|
|
103
91
|
//# sourceMappingURL=version.cjs.js.map
|
|
@@ -12,13 +12,7 @@ function includesAnyOf(hayStack, ...needles) {
|
|
|
12
12
|
}
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
15
|
-
var test = async (
|
|
16
|
-
let parent = cmd;
|
|
17
|
-
while (parent.parent) {
|
|
18
|
-
parent = parent.parent;
|
|
19
|
-
}
|
|
20
|
-
const allArgs = parent.args;
|
|
21
|
-
const args = allArgs.slice(allArgs.indexOf("test") + 1);
|
|
15
|
+
var test = async ({ args }) => {
|
|
22
16
|
if (!includesAnyOf(args, "-c", "--config")) {
|
|
23
17
|
args.push("--config", cliCommon.findOwnPaths(__dirname).resolve("config/jest.js"));
|
|
24
18
|
}
|
|
@@ -45,9 +39,6 @@ var test = async (_opts, cmd) => {
|
|
|
45
39
|
if (!process.env.NODE_OPTIONS?.includes("--node-snapshot")) {
|
|
46
40
|
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : ""}--no-node-snapshot`;
|
|
47
41
|
}
|
|
48
|
-
if (args.includes("--help")) {
|
|
49
|
-
process.stdout._handle.setBlocking(true);
|
|
50
|
-
}
|
|
51
42
|
try {
|
|
52
43
|
require.resolve("jest");
|
|
53
44
|
} catch {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var os = require('node:os');
|
|
4
6
|
var crypto = require('node:crypto');
|
|
7
|
+
var cleye = require('cleye');
|
|
5
8
|
var yargs = require('yargs');
|
|
6
9
|
var jestCli = require('jest-cli');
|
|
7
10
|
var path = require('node:path');
|
|
8
11
|
var cliNode = require('@backstage/cli-node');
|
|
9
12
|
var cliCommon = require('@backstage/cli-common');
|
|
10
|
-
var SuccessCache = require('../../../../lib/cache/SuccessCache.cjs.js');
|
|
11
13
|
|
|
12
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
15
|
|
|
@@ -72,31 +74,45 @@ function createFlagFinder(args) {
|
|
|
72
74
|
return false;
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
let changed = false;
|
|
77
|
-
do {
|
|
78
|
-
changed = false;
|
|
79
|
-
const index = args.indexOf(option);
|
|
80
|
-
if (index >= 0) {
|
|
81
|
-
changed = true;
|
|
82
|
-
args.splice(index, size);
|
|
83
|
-
}
|
|
84
|
-
const indexEq = args.findIndex((arg) => arg.startsWith(`${option}=`));
|
|
85
|
-
if (indexEq >= 0) {
|
|
86
|
-
changed = true;
|
|
87
|
-
args.splice(indexEq, 1);
|
|
88
|
-
}
|
|
89
|
-
} while (changed);
|
|
90
|
-
}
|
|
91
|
-
async function command(opts, cmd) {
|
|
77
|
+
var test = async ({ args, info }) => {
|
|
92
78
|
const testGlobal = global;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
+
}
|
|
96
86
|
}
|
|
97
|
-
const
|
|
98
|
-
|
|
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
|
+
);
|
|
99
114
|
const hasFlags = createFlagFinder(args);
|
|
115
|
+
const sinceRef = opts.since || void 0;
|
|
100
116
|
const { _: parsedArgs } = await yargs__default.default(args).options(jestCli.yargsOptions).argv;
|
|
101
117
|
if (!hasFlags("-c", "--config")) {
|
|
102
118
|
args.push("--config", cliCommon.findOwnPaths(__dirname).resolve("config/jest.js"));
|
|
@@ -105,7 +121,7 @@ async function command(opts, cmd) {
|
|
|
105
121
|
args.push("--passWithNoTests");
|
|
106
122
|
}
|
|
107
123
|
let isSingleWatchMode = args.includes("--watch");
|
|
108
|
-
if (!
|
|
124
|
+
if (!sinceRef && !process.env.CI && !hasFlags("--coverage", "--watch", "--watchAll")) {
|
|
109
125
|
const isGitRepo = () => cliCommon.runCheck(["git", "rev-parse", "--is-inside-work-tree"]);
|
|
110
126
|
const isMercurialRepo = () => cliCommon.runCheck(["hg", "--cwd", ".", "root"]);
|
|
111
127
|
if (await isGitRepo() || await isMercurialRepo()) {
|
|
@@ -141,9 +157,6 @@ async function command(opts, cmd) {
|
|
|
141
157
|
if (os__default.default.cpus().length <= 3 && !hasFlags("-i", "--runInBand", "-w", "--maxWorkers")) {
|
|
142
158
|
args.push("--maxWorkers=2");
|
|
143
159
|
}
|
|
144
|
-
if (opts.since) {
|
|
145
|
-
removeOptionArg(args, "--since");
|
|
146
|
-
}
|
|
147
160
|
let packageGraph;
|
|
148
161
|
async function getPackageGraph() {
|
|
149
162
|
if (packageGraph) {
|
|
@@ -154,10 +167,10 @@ async function command(opts, cmd) {
|
|
|
154
167
|
return packageGraph;
|
|
155
168
|
}
|
|
156
169
|
let selectedProjects = void 0;
|
|
157
|
-
if (
|
|
170
|
+
if (sinceRef && !hasFlags("--selectProjects")) {
|
|
158
171
|
const graph = await getPackageGraph();
|
|
159
172
|
const changedPackages = await graph.listChangedPackages({
|
|
160
|
-
ref:
|
|
173
|
+
ref: sinceRef,
|
|
161
174
|
analyzeLockfile: true
|
|
162
175
|
});
|
|
163
176
|
selectedProjects = Array.from(
|
|
@@ -181,14 +194,10 @@ async function command(opts, cmd) {
|
|
|
181
194
|
if (!process.env.NODE_OPTIONS?.includes("--node-snapshot")) {
|
|
182
195
|
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS ? `${process.env.NODE_OPTIONS} ` : ""}--no-node-snapshot`;
|
|
183
196
|
}
|
|
184
|
-
if (
|
|
185
|
-
removeOptionArg(args, "--jest-help");
|
|
197
|
+
if (opts.jestHelp) {
|
|
186
198
|
args.push("--help");
|
|
187
|
-
process.stdout._handle.setBlocking(true);
|
|
188
199
|
}
|
|
189
200
|
if (opts.successCache) {
|
|
190
|
-
removeOptionArg(args, "--successCache", 1);
|
|
191
|
-
removeOptionArg(args, "--successCacheDir");
|
|
192
201
|
if (parsedArgs.length > 0) {
|
|
193
202
|
throw new Error(
|
|
194
203
|
`The --successCache flag can not be combined with the following arguments: ${parsedArgs.join(
|
|
@@ -201,7 +210,10 @@ async function command(opts, cmd) {
|
|
|
201
210
|
`The --successCache flag can not be combined with the --shard flag`
|
|
202
211
|
);
|
|
203
212
|
}
|
|
204
|
-
const cache =
|
|
213
|
+
const cache = cliNode.SuccessCache.create({
|
|
214
|
+
name: "test",
|
|
215
|
+
basePath: opts.successCacheDir
|
|
216
|
+
});
|
|
205
217
|
const graph = await getPackageGraph();
|
|
206
218
|
const projectHashes = /* @__PURE__ */ new Map();
|
|
207
219
|
const outputSuccessCache = new Array();
|
|
@@ -219,7 +231,7 @@ async function command(opts, cmd) {
|
|
|
219
231
|
baseHash.update(process.version);
|
|
220
232
|
baseHash.update("\0");
|
|
221
233
|
baseHash.update(
|
|
222
|
-
|
|
234
|
+
cliNode.SuccessCache.trimPaths(JSON.stringify(globalRootConfig))
|
|
223
235
|
);
|
|
224
236
|
const baseSha = baseHash.digest("hex");
|
|
225
237
|
return projectConfigs.filter((project) => {
|
|
@@ -238,7 +250,7 @@ async function command(opts, cmd) {
|
|
|
238
250
|
const depHash = getPackageTreeHash(depPkg.name);
|
|
239
251
|
hash.update(`${depName}:${depHash}`);
|
|
240
252
|
}
|
|
241
|
-
hash.update(
|
|
253
|
+
hash.update(cliNode.SuccessCache.trimPaths(JSON.stringify(project)));
|
|
242
254
|
hash.update(lockfile.getDependencyTreeHash(packageName));
|
|
243
255
|
const sha = hash.digest("hex");
|
|
244
256
|
projectHashes.set(packageName, sha);
|
|
@@ -280,8 +292,8 @@ async function command(opts, cmd) {
|
|
|
280
292
|
};
|
|
281
293
|
}
|
|
282
294
|
await jestCli.run(args);
|
|
283
|
-
}
|
|
295
|
+
};
|
|
284
296
|
|
|
285
|
-
exports.command = command;
|
|
286
297
|
exports.createFlagFinder = createFlagFinder;
|
|
298
|
+
exports.default = test;
|
|
287
299
|
//# sourceMappingURL=test.cjs.js.map
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
6
|
-
var commander = require('commander');
|
|
7
|
-
var lazy = require('../../lib/lazy.cjs.js');
|
|
8
6
|
|
|
9
7
|
var index = factory.createCliPlugin({
|
|
10
8
|
pluginId: "test",
|
|
@@ -12,40 +10,12 @@ var index = factory.createCliPlugin({
|
|
|
12
10
|
reg.addCommand({
|
|
13
11
|
path: ["repo", "test"],
|
|
14
12
|
description: "Run tests, forwarding args to Jest, defaulting to watch mode",
|
|
15
|
-
execute:
|
|
16
|
-
const command = new commander.Command();
|
|
17
|
-
command.allowUnknownOption(true);
|
|
18
|
-
command.allowExcessArguments(true);
|
|
19
|
-
command.option(
|
|
20
|
-
"--since <ref>",
|
|
21
|
-
"Only test packages that changed since the specified ref"
|
|
22
|
-
);
|
|
23
|
-
command.option("--successCache", "Enable success caching");
|
|
24
|
-
command.option(
|
|
25
|
-
"--successCacheDir <path>",
|
|
26
|
-
"Set the success cache location, (default: node_modules/.cache/backstage-cli)"
|
|
27
|
-
);
|
|
28
|
-
command.option(
|
|
29
|
-
"--jest-help",
|
|
30
|
-
"Show help for Jest CLI options, which are passed through"
|
|
31
|
-
);
|
|
32
|
-
command.action(lazy.lazy(() => import('./commands/repo/test.cjs.js'), "command"));
|
|
33
|
-
await command.parseAsync(args, { from: "user" });
|
|
34
|
-
}
|
|
13
|
+
execute: { loader: () => import('./commands/repo/test.cjs.js') }
|
|
35
14
|
});
|
|
36
15
|
reg.addCommand({
|
|
37
16
|
path: ["package", "test"],
|
|
38
17
|
description: "Run tests, forwarding args to Jest, defaulting to watch mode",
|
|
39
|
-
execute:
|
|
40
|
-
const command = new commander.Command();
|
|
41
|
-
command.allowUnknownOption(true);
|
|
42
|
-
command.allowExcessArguments(true);
|
|
43
|
-
command.helpOption("--backstage-cli-help");
|
|
44
|
-
command.action(
|
|
45
|
-
lazy.lazy(() => import('./commands/package/test.cjs.js'), "default")
|
|
46
|
-
);
|
|
47
|
-
await command.parseAsync(args, { from: "user" });
|
|
48
|
-
}
|
|
18
|
+
execute: { loader: () => import('./commands/package/test.cjs.js') }
|
|
49
19
|
});
|
|
50
20
|
}
|
|
51
21
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var cliCommon = require('@backstage/cli-common');
|
|
6
7
|
var fs = require('fs-extra');
|
|
7
8
|
var path = require('node:path');
|
|
@@ -13,7 +14,30 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
14
|
|
|
14
15
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
15
16
|
|
|
16
|
-
var _export = async (
|
|
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 };
|
|
17
41
|
messageFilePath.validatePattern(options.pattern);
|
|
18
42
|
const targetPackageJson = await discoverPackages.readTargetPackage(
|
|
19
43
|
cliCommon.targetPaths.dir,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var cleye = require('cleye');
|
|
5
6
|
var cliCommon = require('@backstage/cli-common');
|
|
6
7
|
var fs = require('fs-extra');
|
|
7
8
|
var path = require('node:path');
|
|
@@ -12,7 +13,30 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
13
|
|
|
13
14
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
15
|
|
|
15
|
-
var _import = async (
|
|
16
|
+
var _import = async ({ args, info }) => {
|
|
17
|
+
const {
|
|
18
|
+
flags: { input, output }
|
|
19
|
+
} = cleye.cli(
|
|
20
|
+
{
|
|
21
|
+
help: info,
|
|
22
|
+
booleanFlagNegation: true,
|
|
23
|
+
flags: {
|
|
24
|
+
input: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "translations",
|
|
27
|
+
description: "Input directory containing the manifest and translated message files"
|
|
28
|
+
},
|
|
29
|
+
output: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "src/translations/resources.ts",
|
|
32
|
+
description: "Output path for the generated wiring module"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
void 0,
|
|
37
|
+
args
|
|
38
|
+
);
|
|
39
|
+
const options = { input, output };
|
|
16
40
|
await discoverPackages.readTargetPackage(cliCommon.targetPaths.dir, cliCommon.targetPaths.rootDir);
|
|
17
41
|
const inputDir = path.resolve(cliCommon.targetPaths.dir, options.input);
|
|
18
42
|
const manifestPath = path.resolve(inputDir, "manifest.json");
|
|
@@ -2,14 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var yargs = require('yargs');
|
|
6
5
|
var factory = require('../../wiring/factory.cjs.js');
|
|
7
|
-
var lazy = require('../../lib/lazy.cjs.js');
|
|
8
|
-
var messageFilePath = require('./lib/messageFilePath.cjs.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
|
|
13
6
|
|
|
14
7
|
var index = factory.createCliPlugin({
|
|
15
8
|
pluginId: "translations",
|
|
@@ -17,40 +10,12 @@ var index = factory.createCliPlugin({
|
|
|
17
10
|
reg.addCommand({
|
|
18
11
|
path: ["translations", "export"],
|
|
19
12
|
description: "Export translation messages from an app and all of its frontend plugins to JSON files",
|
|
20
|
-
execute:
|
|
21
|
-
const argv = await yargs__default.default().options({
|
|
22
|
-
output: {
|
|
23
|
-
type: "string",
|
|
24
|
-
default: "translations",
|
|
25
|
-
description: "Output directory for exported messages and manifest"
|
|
26
|
-
},
|
|
27
|
-
pattern: {
|
|
28
|
-
type: "string",
|
|
29
|
-
default: messageFilePath.DEFAULT_MESSAGE_PATTERN,
|
|
30
|
-
description: "File path pattern for message files, with {id} and {lang} placeholders"
|
|
31
|
-
}
|
|
32
|
-
}).help().parse(args);
|
|
33
|
-
await lazy.lazy(() => import('./commands/export.cjs.js'), "default")(argv);
|
|
34
|
-
}
|
|
13
|
+
execute: { loader: () => import('./commands/export.cjs.js') }
|
|
35
14
|
});
|
|
36
15
|
reg.addCommand({
|
|
37
16
|
path: ["translations", "import"],
|
|
38
17
|
description: "Generate translation resource wiring from translated JSON files",
|
|
39
|
-
execute:
|
|
40
|
-
const argv = await yargs__default.default().options({
|
|
41
|
-
input: {
|
|
42
|
-
type: "string",
|
|
43
|
-
default: "translations",
|
|
44
|
-
description: "Input directory containing the manifest and translated message files"
|
|
45
|
-
},
|
|
46
|
-
output: {
|
|
47
|
-
type: "string",
|
|
48
|
-
default: "src/translations/resources.ts",
|
|
49
|
-
description: "Output path for the generated wiring module"
|
|
50
|
-
}
|
|
51
|
-
}).help().parse(args);
|
|
52
|
-
await lazy.lazy(() => import('./commands/import.cjs.js'), "default")(argv);
|
|
53
|
-
}
|
|
18
|
+
execute: { loader: () => import('./commands/import.cjs.js') }
|
|
54
19
|
});
|
|
55
20
|
}
|
|
56
21
|
});
|