@nx/js 16.6.0-beta.0 → 16.6.0-beta.1
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 +5 -5
- package/src/executors/swc/schema.json +4 -2
- package/src/executors/tsc/schema.json +4 -2
- package/src/executors/tsc/tsc.batch-impl.js +52 -18
- package/src/generators/library/library.js +2 -2
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +14 -11
- package/src/utils/schema.d.ts +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "16.6.0-beta.
|
|
3
|
+
"version": "16.6.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.15.0",
|
|
40
40
|
"@babel/preset-typescript": "^7.15.0",
|
|
41
41
|
"@babel/runtime": "^7.14.8",
|
|
42
|
-
"@nrwl/js": "16.6.0-beta.
|
|
43
|
-
"@nx/devkit": "16.6.0-beta.
|
|
44
|
-
"@nx/workspace": "16.6.0-beta.
|
|
42
|
+
"@nrwl/js": "16.6.0-beta.1",
|
|
43
|
+
"@nx/devkit": "16.6.0-beta.1",
|
|
44
|
+
"@nx/workspace": "16.6.0-beta.1",
|
|
45
45
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
46
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
47
47
|
"babel-plugin-macros": "^2.8.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
71
|
"types": "./src/index.d.ts",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "cf9f5cbe6a7ce3b916ec6505dc8488f669cbc52b"
|
|
73
73
|
}
|
|
@@ -69,13 +69,15 @@
|
|
|
69
69
|
"updateBuildableProjectDepsInPackageJson": {
|
|
70
70
|
"type": "boolean",
|
|
71
71
|
"description": "Whether to update the buildable project dependencies in the build output package.json.",
|
|
72
|
-
"default": false
|
|
72
|
+
"default": false,
|
|
73
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
73
74
|
},
|
|
74
75
|
"buildableProjectDepsInPackageJsonType": {
|
|
75
76
|
"type": "string",
|
|
76
77
|
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
77
78
|
"enum": ["dependencies", "peerDependencies"],
|
|
78
|
-
"default": "peerDependencies"
|
|
79
|
+
"default": "peerDependencies",
|
|
80
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
79
81
|
},
|
|
80
82
|
"external": {
|
|
81
83
|
"description": "A list projects to be treated as external. This feature is experimental",
|
|
@@ -57,13 +57,15 @@
|
|
|
57
57
|
"updateBuildableProjectDepsInPackageJson": {
|
|
58
58
|
"type": "boolean",
|
|
59
59
|
"description": "Whether to update the buildable project dependencies in the build output package.json.",
|
|
60
|
-
"default": false
|
|
60
|
+
"default": false,
|
|
61
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
61
62
|
},
|
|
62
63
|
"buildableProjectDepsInPackageJsonType": {
|
|
63
64
|
"type": "string",
|
|
64
65
|
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
65
66
|
"enum": ["dependencies", "peerDependencies"],
|
|
66
|
-
"default": "peerDependencies"
|
|
67
|
+
"default": "peerDependencies",
|
|
68
|
+
"x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
|
|
67
69
|
},
|
|
68
70
|
"external": {
|
|
69
71
|
"description": "A list projects to be treated as external. This feature is experimental",
|
|
@@ -43,20 +43,21 @@ function tscBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
|
+
const processTaskPostCompilation = (tsConfig) => {
|
|
47
|
+
if (tsConfigTaskInfoMap[tsConfig]) {
|
|
48
|
+
const taskInfo = tsConfigTaskInfoMap[tsConfig];
|
|
49
|
+
taskInfo.assetsHandler.processAllAssetsOnceSync();
|
|
50
|
+
(0, update_package_json_1.updatePackageJson)(taskInfo.options, taskInfo.context, taskInfo.projectGraphNode, taskInfo.buildableProjectNodeDependencies);
|
|
51
|
+
taskInfo.endTime = Date.now();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
46
54
|
const typescriptCompilation = (0, lib_1.compileTypescriptSolution)(tsCompilationContext, shouldWatch, logger, {
|
|
47
55
|
beforeProjectCompilationCallback: (tsConfig) => {
|
|
48
56
|
if (tsConfigTaskInfoMap[tsConfig]) {
|
|
49
57
|
tsConfigTaskInfoMap[tsConfig].startTime = Date.now();
|
|
50
58
|
}
|
|
51
59
|
},
|
|
52
|
-
afterProjectCompilationCallback:
|
|
53
|
-
if (tsConfigTaskInfoMap[tsConfig]) {
|
|
54
|
-
const taskInfo = tsConfigTaskInfoMap[tsConfig];
|
|
55
|
-
taskInfo.assetsHandler.processAllAssetsOnceSync();
|
|
56
|
-
(0, update_package_json_1.updatePackageJson)(taskInfo.options, taskInfo.context, taskInfo.projectGraphNode, taskInfo.buildableProjectNodeDependencies);
|
|
57
|
-
taskInfo.endTime = Date.now();
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
+
afterProjectCompilationCallback: processTaskPostCompilation,
|
|
60
61
|
});
|
|
61
62
|
if (shouldWatch) {
|
|
62
63
|
const taskInfos = Object.values(tsConfigTaskInfoMap);
|
|
@@ -79,21 +80,54 @@ function tscBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
|
79
80
|
return { value: undefined, done: true };
|
|
80
81
|
}))))));
|
|
81
82
|
}
|
|
83
|
+
const toBatchExecutorTaskResult = (tsConfig, success) => ({
|
|
84
|
+
task: tsConfigTaskInfoMap[tsConfig].task,
|
|
85
|
+
result: {
|
|
86
|
+
success: success,
|
|
87
|
+
terminalOutput: tsConfigTaskInfoMap[tsConfig].terminalOutput,
|
|
88
|
+
startTime: tsConfigTaskInfoMap[tsConfig].startTime,
|
|
89
|
+
endTime: tsConfigTaskInfoMap[tsConfig].endTime,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
let isCompilationDone = false;
|
|
93
|
+
const taskTsConfigsToReport = new Set(Object.keys(taskGraph.tasks).map((t) => taskInMemoryTsConfigMap[t].path));
|
|
94
|
+
let tasksToReportIterator;
|
|
95
|
+
const processSkippedTasks = () => {
|
|
96
|
+
const { value: tsConfig, done } = tasksToReportIterator.next();
|
|
97
|
+
if (done) {
|
|
98
|
+
return { value: undefined, done: true };
|
|
99
|
+
}
|
|
100
|
+
tsConfigTaskInfoMap[tsConfig].startTime = Date.now();
|
|
101
|
+
processTaskPostCompilation(tsConfig);
|
|
102
|
+
return { value: toBatchExecutorTaskResult(tsConfig, true), done: false };
|
|
103
|
+
};
|
|
82
104
|
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(mapAsyncIterable(typescriptCompilation, (iterator) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
if (isCompilationDone) {
|
|
106
|
+
return processSkippedTasks();
|
|
107
|
+
}
|
|
83
108
|
const { value, done } = yield iterator.next();
|
|
84
109
|
if (done) {
|
|
85
|
-
|
|
110
|
+
if (taskTsConfigsToReport.size > 0) {
|
|
111
|
+
/**
|
|
112
|
+
* TS compilation is done but we still have tasks to report. This can
|
|
113
|
+
* happen if, for example, a project is identified as affected, but
|
|
114
|
+
* no file in the TS project is actually changed or if running a
|
|
115
|
+
* task with `--skip-nx-cache` and the outputs are already there. There
|
|
116
|
+
* can still be changes to assets or other files we need to process.
|
|
117
|
+
*
|
|
118
|
+
* Switch to handle the iterator for the tasks we still need to report.
|
|
119
|
+
*/
|
|
120
|
+
isCompilationDone = true;
|
|
121
|
+
tasksToReportIterator = taskTsConfigsToReport.values();
|
|
122
|
+
return processSkippedTasks();
|
|
123
|
+
}
|
|
124
|
+
return { value: undefined, done: true };
|
|
86
125
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
terminalOutput: tsConfigTaskInfoMap[value.tsConfig].terminalOutput,
|
|
92
|
-
startTime: tsConfigTaskInfoMap[value.tsConfig].startTime,
|
|
93
|
-
endTime: tsConfigTaskInfoMap[value.tsConfig].endTime,
|
|
94
|
-
},
|
|
126
|
+
taskTsConfigsToReport.delete(value.tsConfig);
|
|
127
|
+
return {
|
|
128
|
+
value: toBatchExecutorTaskResult(value.tsConfig, value.success),
|
|
129
|
+
done: false,
|
|
95
130
|
};
|
|
96
|
-
return { value: taskResult, done: false };
|
|
97
131
|
}))))));
|
|
98
132
|
});
|
|
99
133
|
}
|
|
@@ -238,8 +238,8 @@ function createFiles(tree, options, filesDir) {
|
|
|
238
238
|
}
|
|
239
239
|
function addJest(tree, options) {
|
|
240
240
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const {
|
|
242
|
-
return yield
|
|
241
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
|
|
242
|
+
return yield configurationGenerator(tree, Object.assign(Object.assign({}, options), { project: options.name, setupFile: 'none', supportTsx: false, skipSerializers: true, testEnvironment: options.testEnvironment, skipFormat: true, compiler: options.bundler === 'swc' || options.bundler === 'tsc'
|
|
243
243
|
? options.bundler
|
|
244
244
|
: options.bundler === 'rollup'
|
|
245
245
|
? 'swc'
|
|
@@ -9,26 +9,29 @@ const executors = new Set([
|
|
|
9
9
|
'@nrwl/js:tsc',
|
|
10
10
|
]);
|
|
11
11
|
function default_1(tree) {
|
|
12
|
+
var _a;
|
|
13
|
+
var _b;
|
|
12
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// use project graph to get the expanded target configurations
|
|
16
|
+
const projectGraph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
17
|
+
for (const [projectName, { data: projectData }] of Object.entries(projectGraph.nodes)) {
|
|
18
|
+
if (projectData.projectType !== 'library') {
|
|
16
19
|
continue;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
for (const [, target] of Object.entries(project.targets || {})) {
|
|
21
|
+
for (const [targetName, target] of Object.entries(projectData.targets || {})) {
|
|
20
22
|
if (!executors.has(target.executor)) {
|
|
21
23
|
continue;
|
|
22
24
|
}
|
|
23
|
-
if (target.options
|
|
25
|
+
if (!target.options ||
|
|
24
26
|
target.options.updateBuildableProjectDepsInPackageJson === undefined) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
// read the project configuration to write the explicit project configuration
|
|
28
|
+
// and avoid writing the expanded target configuration
|
|
29
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
30
|
+
(_a = (_b = project.targets[targetName]).options) !== null && _a !== void 0 ? _a : (_b.options = {});
|
|
31
|
+
project.targets[targetName].options.updateBuildableProjectDepsInPackageJson = true;
|
|
32
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
|
-
if (updated) {
|
|
30
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
31
|
-
}
|
|
32
35
|
}
|
|
33
36
|
yield (0, devkit_1.formatFiles)(tree);
|
|
34
37
|
});
|
package/src/utils/schema.d.ts
CHANGED
|
@@ -42,7 +42,17 @@ export interface ExecutorOptions {
|
|
|
42
42
|
watch: boolean;
|
|
43
43
|
clean?: boolean;
|
|
44
44
|
transformers: TransformerEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
|
|
47
|
+
* rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
|
|
48
|
+
* It will be removed in v17.
|
|
49
|
+
*/
|
|
45
50
|
updateBuildableProjectDepsInPackageJson?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
|
|
53
|
+
* rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
|
|
54
|
+
* It will be removed in v17.
|
|
55
|
+
*/
|
|
46
56
|
buildableProjectDepsInPackageJsonType?: 'dependencies' | 'peerDependencies';
|
|
47
57
|
external?: 'all' | 'none' | string[];
|
|
48
58
|
externalBuildTargets?: string[];
|