@nx/js 19.8.1 → 19.8.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "19.8.
|
|
3
|
+
"version": "19.8.3",
|
|
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,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "19.8.
|
|
43
|
-
"@nx/workspace": "19.8.
|
|
42
|
+
"@nx/devkit": "19.8.3",
|
|
43
|
+
"@nx/workspace": "19.8.3",
|
|
44
44
|
"babel-plugin-const-enum": "^1.0.1",
|
|
45
45
|
"babel-plugin-macros": "^2.8.0",
|
|
46
46
|
"babel-plugin-transform-typescript-metadata": "^0.3.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ts-node": "10.9.1",
|
|
62
62
|
"tsconfig-paths": "^4.1.2",
|
|
63
63
|
"tslib": "^2.3.0",
|
|
64
|
-
"@nrwl/js": "19.8.
|
|
64
|
+
"@nrwl/js": "19.8.3"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"verdaccio": "^5.0.4"
|
|
@@ -109,6 +109,15 @@ async function initGeneratorInternal(tree, schema) {
|
|
|
109
109
|
return json;
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
+
const rootTsConfigFileName = (0, ts_config_1.getRootTsConfigFileName)(tree);
|
|
113
|
+
// If the root tsconfig file uses `importHelpers` then we must install tslib
|
|
114
|
+
// in order to run tsc for build and typecheck.
|
|
115
|
+
if (rootTsConfigFileName) {
|
|
116
|
+
const rootTsConfig = (0, devkit_1.readJson)(tree, rootTsConfigFileName);
|
|
117
|
+
if (rootTsConfig.compilerOptions?.importHelpers) {
|
|
118
|
+
devDependencies['tslib'] = versions_1.tsLibVersion;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
112
121
|
const installTask = !schema.skipPackageJson
|
|
113
122
|
? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions)
|
|
114
123
|
: () => { };
|
|
@@ -105,9 +105,6 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
105
105
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
106
106
|
]);
|
|
107
107
|
}
|
|
108
|
-
if (options.bundler !== 'none') {
|
|
109
|
-
addBundlerDependencies(tree, options);
|
|
110
|
-
}
|
|
111
108
|
if (!options.skipFormat) {
|
|
112
109
|
await (0, devkit_1.formatFiles)(tree);
|
|
113
110
|
}
|
|
@@ -269,23 +266,6 @@ async function addLint(tree, options) {
|
|
|
269
266
|
}
|
|
270
267
|
return task;
|
|
271
268
|
}
|
|
272
|
-
function addBundlerDependencies(tree, options) {
|
|
273
|
-
(0, devkit_1.updateJson)(tree, `${options.projectRoot}/package.json`, (json) => {
|
|
274
|
-
if (options.bundler === 'tsc') {
|
|
275
|
-
json.dependencies = {
|
|
276
|
-
...json.dependencies,
|
|
277
|
-
tslib: versions_1.tsLibVersion,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
else if (options.bundler === 'swc') {
|
|
281
|
-
json.dependencies = {
|
|
282
|
-
...json.dependencies,
|
|
283
|
-
'@swc/helpers': versions_1.swcHelpersVersion,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
return json;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
269
|
function updateTsConfig(tree, options) {
|
|
290
270
|
(0, devkit_1.updateJson)(tree, (0, path_1.join)(options.projectRoot, 'tsconfig.json'), (json) => {
|
|
291
271
|
if (options.strict) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import type
|
|
2
|
+
import { type SyncGeneratorResult } from 'nx/src/utils/sync-generators';
|
|
3
3
|
export declare function syncGenerator(tree: Tree): Promise<SyncGeneratorResult>;
|
|
4
4
|
export default syncGenerator;
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const ignore_1 = require("ignore");
|
|
6
6
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
7
|
const posix_1 = require("node:path/posix");
|
|
8
|
+
const sync_generators_1 = require("nx/src/utils/sync-generators");
|
|
8
9
|
const ts = require("typescript");
|
|
9
10
|
const plugin_1 = require("../../plugins/typescript/plugin");
|
|
10
11
|
const COMMON_RUNTIME_TS_CONFIG_FILE_NAMES = [
|
|
@@ -25,12 +26,16 @@ async function syncGenerator(tree) {
|
|
|
25
26
|
return p.plugin === plugin_1.PLUGIN_NAME;
|
|
26
27
|
});
|
|
27
28
|
if (!tscPluginConfig) {
|
|
28
|
-
throw new
|
|
29
|
+
throw new sync_generators_1.SyncError(`The "${plugin_1.PLUGIN_NAME}" plugin is not registered`, [
|
|
30
|
+
`The "${plugin_1.PLUGIN_NAME}" plugin must be added to the "plugins" array in "nx.json" in order to sync the project graph information to the TypeScript configuration files.`,
|
|
31
|
+
]);
|
|
29
32
|
}
|
|
30
33
|
// Root tsconfig containing project references for the whole workspace
|
|
31
34
|
const rootTsconfigPath = 'tsconfig.json';
|
|
32
35
|
if (!tree.exists(rootTsconfigPath)) {
|
|
33
|
-
throw new
|
|
36
|
+
throw new sync_generators_1.SyncError('Missing root "tsconfig.json"', [
|
|
37
|
+
`A "tsconfig.json" file must exist in the workspace root in order to sync the project graph information to the TypeScript configuration files.`,
|
|
38
|
+
]);
|
|
34
39
|
}
|
|
35
40
|
const rawTsconfigContentsCache = new Map();
|
|
36
41
|
const stringifiedRootJsonContents = readRawTsconfigContents(tree, rawTsconfigContentsCache, rootTsconfigPath);
|
|
@@ -128,7 +133,7 @@ async function syncGenerator(tree) {
|
|
|
128
133
|
if (hasChanges) {
|
|
129
134
|
await (0, devkit_1.formatFiles)(tree);
|
|
130
135
|
return {
|
|
131
|
-
outOfSyncMessage: 'Based on the workspace project graph, some TypeScript configuration files are missing project references to the projects they depend on.',
|
|
136
|
+
outOfSyncMessage: 'Based on the workspace project graph, some TypeScript configuration files are missing project references to the projects they depend on or contain outdated project references.',
|
|
132
137
|
};
|
|
133
138
|
}
|
|
134
139
|
}
|