@nx/devkit 20.4.0-canary.20250123-7524356 → 20.4.0-canary.20250125-15fc599
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/devkit",
|
3
|
-
"version": "20.4.0-canary.
|
3
|
+
"version": "20.4.0-canary.20250125-15fc599",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -3,21 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateTsConfigsToJs = updateTsConfigsToJs;
|
4
4
|
const devkit_exports_1 = require("nx/src/devkit-exports");
|
5
5
|
function updateTsConfigsToJs(tree, options) {
|
6
|
-
let updateConfigPath;
|
6
|
+
let updateConfigPath = null;
|
7
7
|
const paths = {
|
8
8
|
tsConfig: `${options.projectRoot}/tsconfig.json`,
|
9
9
|
tsConfigLib: `${options.projectRoot}/tsconfig.lib.json`,
|
10
10
|
tsConfigApp: `${options.projectRoot}/tsconfig.app.json`,
|
11
11
|
};
|
12
|
-
const getProjectType = (tree) => {
|
13
|
-
if (tree.exists(paths.tsConfigApp)) {
|
14
|
-
return 'application';
|
15
|
-
}
|
16
|
-
if (tree.exists(paths.tsConfigLib)) {
|
17
|
-
return 'library';
|
18
|
-
}
|
19
|
-
throw new Error(`project is missing tsconfig.lib.json or tsconfig.app.json`);
|
20
|
-
};
|
21
12
|
(0, devkit_exports_1.updateJson)(tree, paths.tsConfig, (json) => {
|
22
13
|
if (json.compilerOptions) {
|
23
14
|
json.compilerOptions.allowJs = true;
|
@@ -27,21 +18,25 @@ function updateTsConfigsToJs(tree, options) {
|
|
27
18
|
}
|
28
19
|
return json;
|
29
20
|
});
|
30
|
-
|
31
|
-
if (projectType === 'library') {
|
21
|
+
if (tree.exists(paths.tsConfigLib)) {
|
32
22
|
updateConfigPath = paths.tsConfigLib;
|
33
23
|
}
|
34
|
-
if (
|
24
|
+
if (tree.exists(paths.tsConfigApp)) {
|
35
25
|
updateConfigPath = paths.tsConfigApp;
|
36
26
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
27
|
+
if (updateConfigPath) {
|
28
|
+
(0, devkit_exports_1.updateJson)(tree, updateConfigPath, (json) => {
|
29
|
+
json.include = uniq([...json.include, 'src/**/*.js']);
|
30
|
+
json.exclude = uniq([
|
31
|
+
...json.exclude,
|
32
|
+
'src/**/*.spec.js',
|
33
|
+
'src/**/*.test.js',
|
34
|
+
]);
|
35
|
+
return json;
|
36
|
+
});
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
throw new Error(`project is missing tsconfig.lib.json or tsconfig.app.json`);
|
40
|
+
}
|
46
41
|
}
|
47
42
|
const uniq = (value) => [...new Set(value)];
|
@@ -2,5 +2,6 @@ export interface AsyncPushCallbacks<T> {
|
|
2
2
|
next: (value: T) => void;
|
3
3
|
done: () => void;
|
4
4
|
error: (err: unknown) => void;
|
5
|
+
registerCleanup?: (cb: () => void | Promise<void>) => void;
|
5
6
|
}
|
6
7
|
export declare function createAsyncIterable<T = unknown>(listener: (ls: AsyncPushCallbacks<T>) => void): AsyncIterable<T>;
|
@@ -4,6 +4,7 @@ exports.createAsyncIterable = createAsyncIterable;
|
|
4
4
|
function createAsyncIterable(listener) {
|
5
5
|
let done = false;
|
6
6
|
let error = null;
|
7
|
+
let cleanup;
|
7
8
|
const pushQueue = [];
|
8
9
|
const pullQueue = [];
|
9
10
|
return {
|
@@ -33,6 +34,9 @@ function createAsyncIterable(listener) {
|
|
33
34
|
}
|
34
35
|
done = true;
|
35
36
|
},
|
37
|
+
registerCleanup: (cb) => {
|
38
|
+
cleanup = cb;
|
39
|
+
},
|
36
40
|
});
|
37
41
|
return {
|
38
42
|
next() {
|
@@ -51,6 +55,12 @@ function createAsyncIterable(listener) {
|
|
51
55
|
}
|
52
56
|
});
|
53
57
|
},
|
58
|
+
async return() {
|
59
|
+
if (cleanup) {
|
60
|
+
await cleanup();
|
61
|
+
}
|
62
|
+
return { value: undefined, done: true };
|
63
|
+
},
|
54
64
|
};
|
55
65
|
},
|
56
66
|
};
|