@nx/plugin 16.8.0-beta.4 → 16.8.0-beta.6
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/package.json +7 -7
- package/src/executors/e2e/e2e.impl.js +30 -63
- package/src/generators/create-package/create-package.js +70 -64
- package/src/generators/create-package/utils/normalize-schema.js +15 -14
- package/src/generators/e2e-project/e2e.js +105 -93
- package/src/generators/executor/executor.js +67 -65
- package/src/generators/generator/generator.js +67 -66
- package/src/generators/lint-checks/generator.js +54 -54
- package/src/generators/migration/migration.js +29 -29
- package/src/generators/plugin/plugin.js +54 -50
- package/src/generators/plugin/utils/normalize-schema.js +36 -33
- package/src/generators/preset/generator.js +41 -44
- package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js +4 -7
- package/src/migrations/update-15-0-0/specify-output-capture.js +39 -42
- package/src/migrations/update-15-9-0/jest-29-configs.js +28 -34
- package/src/migrations/update-15-9-0/jest-29-tests.js +11 -14
- package/src/migrations/update-16-0-0/cli-in-schema-json.js +6 -9
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-2-0/replace-e2e-executor.js +26 -26
- package/src/utils/has-generator.js +3 -3
- package/src/utils/testing-utils/async-commands.js +2 -3
- package/src/utils/testing-utils/commands.js +4 -6
- package/src/utils/testing-utils/nx-project.js +8 -2
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
function replaceE2EExecutor(tree) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
5
|
+
async function replaceE2EExecutor(tree) {
|
|
6
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
7
|
+
for (const executor of ['@nx/plugin:e2e', '@nrwl/nx-plugin:e2e']) {
|
|
8
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, executor, (options, project, target, configuration) => {
|
|
9
|
+
const projectConfiguration = projects.get(project);
|
|
10
|
+
const config = {
|
|
11
|
+
...options,
|
|
12
|
+
target: undefined,
|
|
13
|
+
runInBand: true,
|
|
14
|
+
};
|
|
15
|
+
if (configuration) {
|
|
16
|
+
projectConfiguration.targets[target].configurations[configuration] =
|
|
17
|
+
config;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
projectConfiguration.targets[target].dependsOn = [
|
|
21
|
+
...(projectConfiguration.targets[target].dependsOn ?? []),
|
|
22
|
+
options.target,
|
|
23
|
+
];
|
|
24
|
+
projectConfiguration.targets[target].executor = '@nx/jest:jest';
|
|
25
|
+
projectConfiguration.targets[target].options = config;
|
|
26
|
+
}
|
|
27
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfiguration);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
31
31
|
}
|
|
32
32
|
exports.default = replaceE2EExecutor;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function hasGenerator(tree, projectName, generatorName) {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
7
6
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
8
7
|
const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
9
8
|
if (!packageJson.generators && !packageJson.schematics) {
|
|
10
9
|
return false;
|
|
11
10
|
}
|
|
12
|
-
const generatorsPath = (0, devkit_1.joinPathFragments)(project.root,
|
|
11
|
+
const generatorsPath = (0, devkit_1.joinPathFragments)(project.root, packageJson.generators ?? packageJson.schematics);
|
|
13
12
|
const generatorsJson = (0, devkit_1.readJson)(tree, generatorsPath);
|
|
14
|
-
return ((
|
|
13
|
+
return ((generatorsJson.generators?.[generatorName] ??
|
|
14
|
+
generatorsJson.schematics?.[generatorName]) !== undefined);
|
|
15
15
|
}
|
|
16
16
|
exports.hasGenerator = hasGenerator;
|
|
@@ -15,10 +15,9 @@ function runCommandAsync(command, opts = {
|
|
|
15
15
|
silenceError: false,
|
|
16
16
|
}) {
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
18
|
-
var _a;
|
|
19
18
|
(0, child_process_1.exec)(command, {
|
|
20
|
-
cwd:
|
|
21
|
-
env:
|
|
19
|
+
cwd: opts.cwd ?? (0, paths_1.tmpProjPath)(),
|
|
20
|
+
env: { ...process.env, ...opts.env },
|
|
22
21
|
}, (err, stdout, stderr) => {
|
|
23
22
|
if (!opts.silenceError && err) {
|
|
24
23
|
reject(err);
|
|
@@ -16,10 +16,9 @@ function runNxCommand(command, opts = {
|
|
|
16
16
|
silenceError: false,
|
|
17
17
|
}) {
|
|
18
18
|
function _runNxCommand(c) {
|
|
19
|
-
var _a;
|
|
20
19
|
const execSyncOptions = {
|
|
21
|
-
cwd:
|
|
22
|
-
env:
|
|
20
|
+
cwd: opts.cwd ?? (0, paths_1.tmpProjPath)(),
|
|
21
|
+
env: { ...process.env, ...opts.env },
|
|
23
22
|
};
|
|
24
23
|
if ((0, utils_1.fileExists)((0, paths_1.tmpProjPath)('package.json'))) {
|
|
25
24
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
@@ -49,12 +48,11 @@ function runNxCommand(command, opts = {
|
|
|
49
48
|
}
|
|
50
49
|
exports.runNxCommand = runNxCommand;
|
|
51
50
|
function runCommand(command, opts) {
|
|
52
|
-
var _a;
|
|
53
51
|
try {
|
|
54
52
|
return (0, child_process_1.execSync)(command, {
|
|
55
|
-
cwd:
|
|
53
|
+
cwd: opts.cwd ?? (0, paths_1.tmpProjPath)(),
|
|
56
54
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
57
|
-
env:
|
|
55
|
+
env: { ...process.env, ...opts?.env },
|
|
58
56
|
}).toString();
|
|
59
57
|
}
|
|
60
58
|
catch (e) {
|
|
@@ -10,7 +10,10 @@ const paths_1 = require("./paths");
|
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
function runNxNewCommand(args, silent) {
|
|
12
12
|
const localTmpDir = (0, path_1.dirname)((0, paths_1.tmpProjPath)());
|
|
13
|
-
return (0, child_process_1.execSync)(`node ${require.resolve('nx')} new proj --nx-workspace-root=${localTmpDir} --no-interactive --skip-install --collection=@nx/workspace --npmScope=proj --preset=empty ${args || ''}`,
|
|
13
|
+
return (0, child_process_1.execSync)(`node ${require.resolve('nx')} new proj --nx-workspace-root=${localTmpDir} --no-interactive --skip-install --collection=@nx/workspace --npmScope=proj --preset=empty ${args || ''}`, {
|
|
14
|
+
cwd: localTmpDir,
|
|
15
|
+
...(silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
|
16
|
+
});
|
|
14
17
|
}
|
|
15
18
|
function patchPackageJsonForPlugin(npmPackageName, distPath) {
|
|
16
19
|
const path = (0, paths_1.tmpProjPath)('package.json');
|
|
@@ -35,7 +38,10 @@ exports.uniq = uniq;
|
|
|
35
38
|
*/
|
|
36
39
|
function runPackageManagerInstall(silent = true) {
|
|
37
40
|
const pmc = (0, devkit_2.getPackageManagerCommand)();
|
|
38
|
-
const install = (0, child_process_1.execSync)(pmc.install,
|
|
41
|
+
const install = (0, child_process_1.execSync)(pmc.install, {
|
|
42
|
+
cwd: (0, paths_1.tmpProjPath)(),
|
|
43
|
+
...(silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
|
44
|
+
});
|
|
39
45
|
return install ? install.toString() : '';
|
|
40
46
|
}
|
|
41
47
|
exports.runPackageManagerInstall = runPackageManagerInstall;
|