@nx/js 22.1.0-beta.4 → 22.1.0-beta.6

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-beta.4",
3
+ "version": "22.1.0-beta.6",
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-beta.4",
43
- "@nx/workspace": "22.1.0-beta.4",
42
+ "@nx/devkit": "22.1.0-beta.6",
43
+ "@nx/workspace": "22.1.0-beta.6",
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-beta.4"
63
+ "nx": "22.1.0-beta.6"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^6.0.5"
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- <% if(js) {%>const { readFileSync } = require('fs')<% } else { %>import { readFileSync } from 'fs';<% } %>
2
+ <% if(ext === 'js' || ext === 'cts') {%>const { readFileSync } = require('fs')<% } else { %>import { readFileSync } from 'fs';<% } %>
3
3
 
4
4
  // Reading the SWC compilation config and remove the "exclude"
5
5
  // for the test files to be compiled by SWC
@@ -18,7 +18,7 @@ if (swcJestConfig.swcrc === undefined) {
18
18
  // jest needs EsModule Interop to find the default exported setup/teardown functions
19
19
  // swcJestConfig.module.noInterop = false;
20
20
 
21
- <% if(js) {%>module.exports =<% } else { %>export default<% } %> {
21
+ <% if(ext === 'js' || ext === 'cts') {%>module.exports =<% } else { %>export default<% } %> {
22
22
  displayName: '<%= project %>',
23
23
  preset: '<%= offsetFromRoot %><%= jestPreset %>',
24
24
  transform: {
@@ -520,14 +520,14 @@ async function addJest(tree, options) {
520
520
  function replaceJestConfig(tree, options) {
521
521
  const filesDir = (0, path_1.join)(__dirname, './files/jest-config');
522
522
  // the existing config has to be deleted otherwise the new config won't overwrite it
523
- const existingJestConfig = (0, devkit_1.joinPathFragments)(filesDir, `jest.config.${options.js ? 'js' : 'ts'}`);
523
+ const existingJestConfig = (0, devkit_1.joinPathFragments)(filesDir, `jest.config.${options.js ? 'js' : 'cts'}`);
524
524
  if (tree.exists(existingJestConfig)) {
525
525
  tree.delete(existingJestConfig);
526
526
  }
527
527
  const jestPreset = findRootJestPreset(tree) ?? 'jest.presets.js';
528
528
  // replace with JS:SWC specific jest config
529
529
  (0, devkit_1.generateFiles)(tree, filesDir, options.projectRoot, {
530
- ext: options.js ? 'js' : 'ts',
530
+ ext: options.js ? 'js' : 'cts',
531
531
  jestPreset,
532
532
  js: !!options.js,
533
533
  project: options.name,
@@ -5,7 +5,7 @@ exports.addSwcConfig = addSwcConfig;
5
5
  exports.addSwcTestConfig = addSwcTestConfig;
6
6
  const path_1 = require("path");
7
7
  exports.defaultExclude = [
8
- 'jest.config.ts',
8
+ 'jest.config.[ct]s',
9
9
  '.*\\.spec.tsx?$',
10
10
  '.*\\.test.tsx?$',
11
11
  './src/jest-setup.ts$',