@nx/js 20.5.0-rc.0 → 20.5.0-rc.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "20.5.0-rc.0",
3
+ "version": "20.5.0-rc.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,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": "20.5.0-rc.0",
43
- "@nx/workspace": "20.5.0-rc.0",
42
+ "@nx/devkit": "20.5.0-rc.1",
43
+ "@nx/workspace": "20.5.0-rc.1",
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",
@@ -719,9 +719,7 @@ function createProjectTsConfigs(tree, options) {
719
719
  .map(([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v)}`)
720
720
  .join(',\n '),
721
721
  tmpl: '',
722
- outDir: options.bundler === 'tsc'
723
- ? 'dist'
724
- : `out-tsc/${options.projectRoot.split('/').pop()}`,
722
+ outDir: 'dist',
725
723
  emitDeclarationOnly: options.bundler === 'tsc' ? false : true,
726
724
  });
727
725
  // tsconfig.json
@@ -734,6 +732,12 @@ function createProjectTsConfigs(tree, options) {
734
732
  json.references.push({
735
733
  path: './tsconfig.lib.json',
736
734
  });
735
+ // If using `tsc` to build, then we do not want a typecheck target that duplicates the work, since both run `tsc`.
736
+ // This applies to `@nx/js/typescript` plugin only.
737
+ if (options.bundler === 'tsc') {
738
+ json['nx'] ??= {};
739
+ json['nx'].addTypecheckTarget = false;
740
+ }
737
741
  return json;
738
742
  });
739
743
  }
@@ -745,6 +749,12 @@ function createProjectTsConfigs(tree, options) {
745
749
  include: [],
746
750
  references: [{ path: './tsconfig.lib.json' }],
747
751
  };
752
+ // If using `tsc` to build, then we do not want a typecheck target that duplicates the work, since both run `tsc`.
753
+ // This applies to `@nx/js/typescript` plugin only.
754
+ if (options.bundler === 'tsc') {
755
+ tsconfig['nx'] ??= {};
756
+ tsconfig['nx'].addTypecheckTarget = false;
757
+ }
748
758
  (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), tsconfig);
749
759
  // update root project tsconfig.json references with the new lib tsconfig
750
760
  (0, devkit_1.updateJson)(tree, 'tsconfig.json', (json) => {
@@ -178,7 +178,9 @@ function buildTscTargets(configFilePath, projectRoot, options, context) {
178
178
  const tsConfig = retrieveTsConfigFromCache(configFilePath, context.workspaceRoot);
179
179
  let internalProjectReferences;
180
180
  // Typecheck target
181
- if ((0, node_path_1.basename)(configFilePath) === 'tsconfig.json' && options.typecheck) {
181
+ if ((0, node_path_1.basename)(configFilePath) === 'tsconfig.json' &&
182
+ options.typecheck &&
183
+ tsConfig.raw?.['nx']?.addTypecheckTarget !== false) {
182
184
  internalProjectReferences = resolveInternalProjectReferences(tsConfig, context.workspaceRoot, projectRoot);
183
185
  const externalProjectReferences = resolveShallowExternalProjectReferences(tsConfig, context.workspaceRoot, projectRoot);
184
186
  const targetName = options.typecheck.targetName;
@@ -737,6 +739,9 @@ function toAbsolutePaths(cache, workspaceRoot) {
737
739
  updatedCache[key] = {
738
740
  data: {
739
741
  options: { noEmit: data.options.noEmit },
742
+ raw: {
743
+ nx: { addTypecheckTarget: data.raw?.['nx']?.addTypecheckTarget },
744
+ },
740
745
  extendedConfigFile: data.extendedConfigFile,
741
746
  },
742
747
  extendedFilesHash,
@@ -769,6 +774,9 @@ function toRelativePaths(cache, workspaceRoot) {
769
774
  updatedCache[key] = {
770
775
  data: {
771
776
  options: { noEmit: data.options.noEmit },
777
+ raw: {
778
+ nx: { addTypecheckTarget: data.raw?.['nx']?.addTypecheckTarget },
779
+ },
772
780
  extendedConfigFile: data.extendedConfigFile,
773
781
  },
774
782
  extendedFilesHash,
@@ -90,9 +90,7 @@ function updateTsconfigFiles(tree, projectRoot, runtimeTsconfigFileName, compile
90
90
  json.extends = (0, devkit_1.joinPathFragments)(offset, 'tsconfig.base.json');
91
91
  json.compilerOptions = {
92
92
  ...json.compilerOptions,
93
- // Make sure d.ts files from typecheck does not conflict with bundlers.
94
- // Other tooling like jest write to "out-tsc/jest" to we just default to "out-tsc/<project-name>".
95
- outDir: (0, devkit_1.joinPathFragments)('out-tsc', projectRoot.split('/').at(-1)),
93
+ outDir: 'dist',
96
94
  rootDir,
97
95
  ...compilerOptions,
98
96
  };