@nx/workspace 22.1.0-beta.5 → 22.1.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 +4 -4
- package/src/generators/move/lib/extract-base-configs.d.ts.map +1 -1
- package/src/generators/move/lib/extract-base-configs.js +2 -4
- package/src/generators/move/lib/update-jest-config.d.ts.map +1 -1
- package/src/generators/move/lib/update-jest-config.js +2 -3
- package/src/generators/move/lib/update-project-root-files.js +1 -1
- package/src/generators/remove/lib/update-jest-config.d.ts.map +1 -1
- package/src/generators/remove/lib/update-jest-config.js +2 -2
- package/src/generators/utils/jest-config.d.ts +2 -1
- package/src/generators/utils/jest-config.d.ts.map +1 -1
- package/src/generators/utils/jest-config.js +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "22.1.0-beta.
|
|
3
|
+
"version": "22.1.0-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nx/devkit": "22.1.0-beta.
|
|
41
|
+
"@nx/devkit": "22.1.0-beta.6",
|
|
42
42
|
"@zkochan/js-yaml": "0.0.7",
|
|
43
43
|
"chalk": "^4.1.0",
|
|
44
44
|
"enquirer": "~2.3.6",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"semver": "^7.6.3",
|
|
47
47
|
"tslib": "^2.3.0",
|
|
48
48
|
"yargs-parser": "21.1.1",
|
|
49
|
-
"nx": "22.1.0-beta.
|
|
49
|
+
"nx": "22.1.0-beta.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"nx": "22.1.0-beta.
|
|
52
|
+
"nx": "22.1.0-beta.6"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-base-configs.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/extract-base-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,IAAI,EACL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-base-configs.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/extract-base-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CASzD;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAS1E;AAED,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,oBAAoB,GAChC,IAAI,CAaN"}
|
|
@@ -4,6 +4,7 @@ exports.maybeExtractTsConfigBase = maybeExtractTsConfigBase;
|
|
|
4
4
|
exports.maybeExtractJestConfigBase = maybeExtractJestConfigBase;
|
|
5
5
|
exports.maybeMigrateEslintConfigIfRootProject = maybeMigrateEslintConfigIfRootProject;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const jest_config_1 = require("../../utils/jest-config");
|
|
7
8
|
function maybeExtractTsConfigBase(tree) {
|
|
8
9
|
let extractTsConfigBase;
|
|
9
10
|
try {
|
|
@@ -35,8 +36,5 @@ function maybeMigrateEslintConfigIfRootProject(tree, rootProject) {
|
|
|
35
36
|
catch {
|
|
36
37
|
// eslint not installed
|
|
37
38
|
}
|
|
38
|
-
migrateConfigToMonorepoStyle?.(Array.from((0, devkit_1.getProjects)(tree).values()), tree,
|
|
39
|
-
tree.exists((0, devkit_1.joinPathFragments)(rootProject.root, 'jest.config.js'))
|
|
40
|
-
? 'jest'
|
|
41
|
-
: 'none');
|
|
39
|
+
migrateConfigToMonorepoStyle?.(Array.from((0, devkit_1.getProjects)(tree).values()), tree, (0, jest_config_1.findProjectJestConfig)(tree, rootProject.root) ? 'jest' : 'none');
|
|
42
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAM7C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,oBAAoB,QAiE9B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateJestConfig = updateJestConfig;
|
|
4
|
-
const path = require("path");
|
|
5
4
|
const jest_config_1 = require("../../utils/jest-config");
|
|
6
5
|
/**
|
|
7
6
|
* Updates the project name and coverage folder in the jest.config.js if it exists
|
|
@@ -11,8 +10,8 @@ const jest_config_1 = require("../../utils/jest-config");
|
|
|
11
10
|
* @param schema The options provided to the schematic
|
|
12
11
|
*/
|
|
13
12
|
function updateJestConfig(tree, schema, project) {
|
|
14
|
-
const jestConfigPath =
|
|
15
|
-
if (
|
|
13
|
+
const jestConfigPath = (0, jest_config_1.findProjectJestConfig)(tree, schema.relativeToRootDestination);
|
|
14
|
+
if (jestConfigPath) {
|
|
16
15
|
const oldContent = tree.read(jestConfigPath, 'utf-8');
|
|
17
16
|
let newContent = oldContent;
|
|
18
17
|
if (schema.projectName !== schema.newProjectName) {
|
|
@@ -6,7 +6,7 @@ exports.updateFilesForNonRootProjects = updateFilesForNonRootProjects;
|
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const allowedExt = ['.ts', '.js', '.json'];
|
|
9
|
+
const allowedExt = ['.ts', '.js', '.json', '.cts', '.cjs'];
|
|
10
10
|
/**
|
|
11
11
|
* Updates the files in the root of the project
|
|
12
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/update-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/update-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAuCnC;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,oBAAoB,QAiFpC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateJestConfig = updateJestConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const get_source_nodes_1 = require("../../../utilities/typescript/get-source-nodes");
|
|
6
|
-
const path_1 = require("path");
|
|
7
6
|
const typescript_1 = require("../../../utilities/typescript");
|
|
8
7
|
const jest_config_1 = require("../../utils/jest-config");
|
|
9
8
|
let tsModule;
|
|
@@ -37,9 +36,10 @@ function updateJestConfig(tree, schema, projectConfig) {
|
|
|
37
36
|
const { createSourceFile, ScriptTarget, isPropertyAssignment, isArrayLiteralExpression, isStringLiteral, } = tsModule;
|
|
38
37
|
const projectToRemove = schema.projectName;
|
|
39
38
|
const rootConfigPath = (0, jest_config_1.findRootJestConfig)(tree);
|
|
39
|
+
const projectJestConfig = (0, jest_config_1.findProjectJestConfig)(tree, projectConfig.root);
|
|
40
40
|
if (!rootConfigPath ||
|
|
41
41
|
!tree.exists(rootConfigPath) ||
|
|
42
|
-
!
|
|
42
|
+
!projectJestConfig ||
|
|
43
43
|
isUsingUtilityFunction(tree) ||
|
|
44
44
|
!isMonorepoConfig(tree)) {
|
|
45
45
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
2
|
export declare function findRootJestConfig(tree: Tree): string | null;
|
|
3
|
+
export declare function findProjectJestConfig(tree: Tree, projectRoot: string): string | null;
|
|
3
4
|
//# sourceMappingURL=jest-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/utils/jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"jest-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/utils/jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAc5D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAWf"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findRootJestConfig = findRootJestConfig;
|
|
4
|
+
exports.findProjectJestConfig = findProjectJestConfig;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
6
|
function findRootJestConfig(tree) {
|
|
5
7
|
if (tree.exists('jest.config.js')) {
|
|
6
8
|
return 'jest.config.js';
|
|
@@ -8,5 +10,18 @@ function findRootJestConfig(tree) {
|
|
|
8
10
|
if (tree.exists('jest.config.ts')) {
|
|
9
11
|
return 'jest.config.ts';
|
|
10
12
|
}
|
|
13
|
+
if (tree.exists('jest.config.cts')) {
|
|
14
|
+
return 'jest.config.cts';
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function findProjectJestConfig(tree, projectRoot) {
|
|
19
|
+
const extensions = ['js', 'ts', 'cts'];
|
|
20
|
+
for (const ext of extensions) {
|
|
21
|
+
const configPath = (0, devkit_1.joinPathFragments)(projectRoot, `jest.config.${ext}`);
|
|
22
|
+
if (tree.exists(configPath)) {
|
|
23
|
+
return configPath;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
11
26
|
return null;
|
|
12
27
|
}
|