@nx/js 22.1.0-rc.5 → 22.1.0

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": "22.1.0-rc.5",
3
+ "version": "22.1.0",
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": "22.1.0-rc.5",
43
- "@nx/workspace": "22.1.0-rc.5",
42
+ "@nx/devkit": "22.1.0",
43
+ "@nx/workspace": "22.1.0",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^3.1.0",
@@ -60,7 +60,7 @@
60
60
  "tslib": "^2.3.0"
61
61
  },
62
62
  "devDependencies": {
63
- "nx": "22.1.0-rc.5"
63
+ "nx": "22.1.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^6.0.5"
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AA2CtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgQ5E;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AA2CtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAyQ5E;AAED,eAAe,aAAa,CAAC"}
@@ -139,11 +139,15 @@ async function syncGenerator(tree) {
139
139
  // Update project references for the runtime tsconfig
140
140
  updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, runtimeTsConfigPath, dependencies, sourceProjectNode.data.root, projectRoots, changedFiles, runtimeTsConfigFileName, runtimeTsConfigFileNames);
141
141
  }
142
- updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, sourceProjectTsconfigPath,
143
- // If we find a runtime tsconfig file, we make sure the external
144
- // dependencies are emptied from the tsconfig.json file instead,
145
- // otherwise we update the project references for the tsconfig.json file
146
- foundRuntimeTsConfig ? [] : dependencies, sourceProjectNode.data.root, projectRoots, changedFiles);
142
+ // We keep the project references in the tsconfig.json file if it has files
143
+ // or if we don't find a runtime tsconfig file, otherwise we don't need to
144
+ // duplicate the project references in the tsconfig.json file
145
+ let keepReferencesInTsconfigJson = true;
146
+ if (foundRuntimeTsConfig) {
147
+ const sourceProjectTsconfig = parseTsconfig(sourceProjectTsconfigPath, tsSysFromTree);
148
+ keepReferencesInTsconfigJson = sourceProjectTsconfig.fileNames.length > 0;
149
+ }
150
+ updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, sourceProjectTsconfigPath, keepReferencesInTsconfigJson ? dependencies : [], sourceProjectNode.data.root, projectRoots, changedFiles);
147
151
  }
148
152
  if (changedFiles.size > 0) {
149
153
  await (0, devkit_1.formatFiles)(tree);
@@ -177,6 +181,9 @@ function readRawTsconfigContents(tree, tsconfigInfoCaches, tsconfigPath) {
177
181
  }
178
182
  return tsconfigInfoCaches.content.get(tsconfigPath);
179
183
  }
184
+ function parseTsconfig(tsconfigPath, sys) {
185
+ return ts.parseJsonConfigFileContent(ts.readConfigFile(tsconfigPath, sys.readFile).config, sys, (0, posix_1.dirname)(tsconfigPath));
186
+ }
180
187
  /**
181
188
  * Within the context of a sync generator, performance is a key concern,
182
189
  * so avoid FS interactions whenever possible.
@@ -391,7 +398,7 @@ function patchTsconfigJsonReferences(tree, tsconfigInfoCaches, tsconfigPath, upd
391
398
  }
392
399
  function hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, tsconfigPath) {
393
400
  if (!tsconfigInfoCaches.composite.has(tsconfigPath)) {
394
- const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(tsconfigPath, tsSysFromTree.readFile).config, tsSysFromTree, (0, posix_1.dirname)(tsconfigPath));
401
+ const parsed = parseTsconfig(tsconfigPath, tsSysFromTree);
395
402
  tsconfigInfoCaches.composite.set(tsconfigPath, parsed.options.composite === true);
396
403
  }
397
404
  return tsconfigInfoCaches.composite.get(tsconfigPath);