@nx/js 22.1.0-beta.5 → 22.1.0-beta.7

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.5",
3
+ "version": "22.1.0-beta.7",
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.5",
43
- "@nx/workspace": "22.1.0-beta.5",
42
+ "@nx/devkit": "22.1.0-beta.7",
43
+ "@nx/workspace": "22.1.0-beta.7",
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.5"
63
+ "nx": "22.1.0-beta.7"
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: {
@@ -1 +1 @@
1
- {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAYjB,IAAI,EAKL,MAAM,YAAY,CAAC;AAyCpB,OAAO,KAAK,EAEV,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AASlB,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAO/B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BA+K/B;AA2HD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,iCAAiC,EAC/B,MAAM,GACN,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,IAAI,GACJ,yBAAyB,GACzB,aAAa,GACb,SAAS,GACT,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA4G5B;AA6uBD,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAYjB,IAAI,EAKL,MAAM,YAAY,CAAC;AAyCpB,OAAO,KAAK,EAEV,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AASlB,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAO/B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BA6K/B;AA2HD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,iCAAiC,EAC/B,MAAM,GACN,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,IAAI,GACJ,yBAAyB,GACzB,aAAa,GACb,SAAS,GACT,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA4G5B;AA6uBD,eAAe,gBAAgB,CAAC"}
@@ -98,8 +98,9 @@ async function libraryGeneratorInternal(tree, schema) {
98
98
  else if (options.unitTestRunner === 'vitest' &&
99
99
  options.bundler !== 'vite' // Test would have been set up already
100
100
  ) {
101
- const { vitestGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
102
- const vitestTask = await vitestGenerator(tree, {
101
+ const { createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
102
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
103
+ const vitestTask = await configurationGenerator(tree, {
103
104
  project: options.name,
104
105
  uiFramework: 'none',
105
106
  coverageProvider: 'v8',
@@ -520,14 +521,14 @@ async function addJest(tree, options) {
520
521
  function replaceJestConfig(tree, options) {
521
522
  const filesDir = (0, path_1.join)(__dirname, './files/jest-config');
522
523
  // 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'}`);
524
+ const existingJestConfig = (0, devkit_1.joinPathFragments)(filesDir, `jest.config.${options.js ? 'js' : 'cts'}`);
524
525
  if (tree.exists(existingJestConfig)) {
525
526
  tree.delete(existingJestConfig);
526
527
  }
527
528
  const jestPreset = findRootJestPreset(tree) ?? 'jest.presets.js';
528
529
  // replace with JS:SWC specific jest config
529
530
  (0, devkit_1.generateFiles)(tree, filesDir, options.projectRoot, {
530
- ext: options.js ? 'js' : 'ts',
531
+ ext: options.js ? 'js' : 'cts',
531
532
  jestPreset,
532
533
  js: !!options.js,
533
534
  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$',