@nx/remix 18.1.0 → 18.1.2

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/migrations.json CHANGED
@@ -102,6 +102,35 @@
102
102
  "alwaysAddToPackageJson": false
103
103
  }
104
104
  }
105
+ },
106
+ "18.1.1": {
107
+ "version": "18.1.1-beta.0",
108
+ "packages": {
109
+ "@remix-run/node": {
110
+ "version": "^2.8.0",
111
+ "alwaysAddToPackageJson": true
112
+ },
113
+ "@remix-run/react": {
114
+ "version": "^2.8.0",
115
+ "alwaysAddToPackageJson": true
116
+ },
117
+ "@remix-run/serve": {
118
+ "version": "^2.8.0",
119
+ "alwaysAddToPackageJson": true
120
+ },
121
+ "@remix-run/dev": {
122
+ "version": "^2.8.0",
123
+ "alwaysAddToPackageJson": true
124
+ },
125
+ "@remix-run/css-bundle": {
126
+ "version": "^2.8.0",
127
+ "alwaysAddToPackageJson": true
128
+ },
129
+ "@remix-run/eslint-config": {
130
+ "version": "^2.8.0",
131
+ "alwaysAddToPackageJson": true
132
+ }
133
+ }
105
134
  }
106
135
  }
107
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "18.1.0",
3
+ "version": "18.1.2",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,12 +28,12 @@
28
28
  "migrations": "./migrations.json"
29
29
  },
30
30
  "dependencies": {
31
- "@nx/devkit": "18.1.0",
32
- "@nx/js": "18.1.0",
33
- "@nx/react": "18.1.0",
31
+ "@nx/devkit": "18.1.2",
32
+ "@nx/js": "18.1.2",
33
+ "@nx/react": "18.1.2",
34
34
  "tslib": "^2.3.1",
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nrwl/remix": "18.1.0"
36
+ "@nrwl/remix": "18.1.2"
37
37
  },
38
38
  "peerDependencies": {},
39
39
  "publishConfig": {
@@ -1147,8 +1147,7 @@ export default {
1147
1147
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
1148
1148
  coverageDirectory: './coverage/test',
1149
1149
  testMatch: [
1150
- '<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
1151
- '<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
1150
+ '<rootDir>/tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
1152
1151
  ],
1153
1152
  };
1154
1153
  "
@@ -10,6 +10,7 @@ const init_1 = require("../init/init");
10
10
  const js_1 = require("@nx/js");
11
11
  const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
12
12
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
13
+ const testing_config_utils_1 = require("../../utils/testing-config-utils");
13
14
  function remixApplicationGenerator(tree, options) {
14
15
  return remixApplicationGeneratorInternal(tree, {
15
16
  addPlugin: false,
@@ -185,6 +186,18 @@ async function remixApplicationGeneratorInternal(tree, _options) {
185
186
  // Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
186
187
  (0, create_ts_config_1.extractTsConfigBase)(tree);
187
188
  }
189
+ if (options.rootProject) {
190
+ (0, devkit_1.updateJson)(tree, `package.json`, (json) => {
191
+ json.type = 'module';
192
+ return json;
193
+ });
194
+ if (options.unitTestRunner === 'jest') {
195
+ tree.write('jest.preset.js', `import { nxPreset } from '@nx/jest/preset/jest-preset.js';
196
+ export default {...nxPreset};
197
+ `);
198
+ (0, testing_config_utils_1.updateJestTestMatch)(tree, 'jest.config.ts', '<rootDir>/tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}');
199
+ }
200
+ }
188
201
  tasks.push(await (0, lib_1.addE2E)(tree, options));
189
202
  if (!options.skipFormat) {
190
203
  await (0, devkit_1.formatFiles)(tree);
@@ -19,7 +19,7 @@ function addPlugin(tree) {
19
19
  plugin: '@nx/remix/plugin',
20
20
  options: {
21
21
  buildTargetName: 'build',
22
- serveTargetName: 'serve',
22
+ devTargetName: 'dev',
23
23
  startTargetName: 'start',
24
24
  typecheckTargetName: 'typecheck',
25
25
  },
@@ -8,30 +8,30 @@ exports[`@nx/remix/plugin non-root project should create nodes 1`] = `
8
8
  "targets": {
9
9
  "build": {
10
10
  "cache": true,
11
+ "command": "remix build",
11
12
  "dependsOn": [
12
13
  "^build",
13
14
  ],
14
- "executor": "@nx/remix:build",
15
15
  "inputs": [
16
16
  "production",
17
17
  "^production",
18
18
  ],
19
19
  "options": {
20
- "outputPath": "my-app",
20
+ "cwd": "my-app",
21
21
  },
22
22
  "outputs": [
23
23
  "{workspaceRoot}/my-app/build",
24
24
  "{workspaceRoot}/my-app/public/build",
25
25
  ],
26
26
  },
27
- "serve": {
28
- "executor": "@nx/remix:serve",
27
+ "dev": {
28
+ "command": "remix dev --manual",
29
29
  "options": {
30
- "command": "npx remix-serve build/index.js",
30
+ "cwd": "my-app",
31
31
  },
32
32
  },
33
33
  "start": {
34
- "command": "npx remix-serve build/index.js",
34
+ "command": "remix-serve build/index.js",
35
35
  "dependsOn": [
36
36
  "build",
37
37
  ],
@@ -64,30 +64,30 @@ exports[`@nx/remix/plugin root project should create nodes 1`] = `
64
64
  "targets": {
65
65
  "build": {
66
66
  "cache": true,
67
+ "command": "remix build",
67
68
  "dependsOn": [
68
69
  "^build",
69
70
  ],
70
- "executor": "@nx/remix:build",
71
71
  "inputs": [
72
72
  "production",
73
73
  "^production",
74
74
  ],
75
75
  "options": {
76
- "outputPath": ".",
76
+ "cwd": ".",
77
77
  },
78
78
  "outputs": [
79
79
  "{workspaceRoot}/build",
80
80
  "{workspaceRoot}/public/build",
81
81
  ],
82
82
  },
83
- "serve": {
84
- "executor": "@nx/remix:serve",
83
+ "dev": {
84
+ "command": "remix dev --manual",
85
85
  "options": {
86
- "command": "npx remix-serve build/index.js",
86
+ "cwd": ".",
87
87
  },
88
88
  },
89
89
  "start": {
90
- "command": "npx remix-serve build/index.js",
90
+ "command": "remix-serve build/index.js",
91
91
  "dependsOn": [
92
92
  "build",
93
93
  ],
@@ -2,7 +2,7 @@ import { type CreateDependencies, type CreateNodes } from '@nx/devkit';
2
2
  export declare const createDependencies: CreateDependencies;
3
3
  export interface RemixPluginOptions {
4
4
  buildTargetName?: string;
5
- serveTargetName?: string;
5
+ devTargetName?: string;
6
6
  startTargetName?: string;
7
7
  typecheckTargetName?: string;
8
8
  }
@@ -31,7 +31,9 @@ exports.createNodes = [
31
31
  // Do not create a project if package.json and project.json isn't there
32
32
  const siblingFiles = (0, fs_1.readdirSync)(fullyQualifiedProjectRoot);
33
33
  if (!siblingFiles.includes('package.json') &&
34
- !siblingFiles.includes('project.json')) {
34
+ !siblingFiles.includes('project.json') &&
35
+ !siblingFiles.includes('vite.config.ts') &&
36
+ !siblingFiles.includes('vite.config.js')) {
35
37
  return {};
36
38
  }
37
39
  options = normalizeOptions(options);
@@ -57,7 +59,7 @@ async function buildRemixTargets(configFilePath, projectRoot, options, context,
57
59
  const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, context.workspaceRoot);
58
60
  const targets = {};
59
61
  targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs);
60
- targets[options.serveTargetName] = serveTarget(serverBuildPath);
62
+ targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot);
61
63
  targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
62
64
  targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
63
65
  return targets;
@@ -78,24 +80,20 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
78
80
  : ['default', '^default']),
79
81
  ],
80
82
  outputs: [serverBuildOutputPath, assetsBuildOutputPath],
81
- executor: '@nx/remix:build',
82
- options: {
83
- outputPath: projectRoot,
84
- },
83
+ command: 'remix build',
84
+ options: { cwd: projectRoot },
85
85
  };
86
86
  }
87
- function serveTarget(serverBuildPath) {
87
+ function devTarget(serverBuildPath, projectRoot) {
88
88
  return {
89
- executor: '@nx/remix:serve',
90
- options: {
91
- command: `npx remix-serve ${serverBuildPath}`,
92
- },
89
+ command: 'remix dev --manual',
90
+ options: { cwd: projectRoot },
93
91
  };
94
92
  }
95
93
  function startTarget(projectRoot, serverBuildPath, buildTargetName) {
96
94
  return {
97
95
  dependsOn: [buildTargetName],
98
- command: `npx remix-serve ${serverBuildPath}`,
96
+ command: `remix-serve ${serverBuildPath}`,
99
97
  options: {
100
98
  cwd: projectRoot,
101
99
  },
@@ -129,7 +127,7 @@ async function getBuildPaths(configFilePath, workspaceRoot) {
129
127
  function normalizeOptions(options) {
130
128
  options ??= {};
131
129
  options.buildTargetName ??= 'build';
132
- options.serveTargetName ??= 'serve';
130
+ options.devTargetName ??= 'dev';
133
131
  options.startTargetName ??= 'start';
134
132
  options.typecheckTargetName ??= 'typecheck';
135
133
  return options;
@@ -1,4 +1,5 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  export declare function updateVitestTestSetup(tree: Tree, pathToVitestConfig: string, pathToTestSetup: string): void;
3
3
  export declare function updateJestTestSetup(tree: Tree, pathToJestConfig: string, pathToTestSetup: string): void;
4
+ export declare function updateJestTestMatch(tree: Tree, pathToJestConfig: string, includesString: string): void;
4
5
  export declare function updateVitestTestIncludes(tree: Tree, pathToVitestConfig: string, includesString: string): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateVitestTestIncludes = exports.updateJestTestSetup = exports.updateVitestTestSetup = void 0;
3
+ exports.updateVitestTestIncludes = exports.updateJestTestMatch = exports.updateJestTestSetup = exports.updateVitestTestSetup = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
6
6
  let tsModule;
@@ -62,6 +62,21 @@ function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
62
62
  }
63
63
  }
64
64
  exports.updateJestTestSetup = updateJestTestSetup;
65
+ function updateJestTestMatch(tree, pathToJestConfig, includesString) {
66
+ if (!tsModule) {
67
+ tsModule = (0, ensure_typescript_1.ensureTypescript)();
68
+ }
69
+ const { tsquery } = require('@phenomnomnominal/tsquery');
70
+ const fileContents = tree.read(pathToJestConfig, 'utf-8');
71
+ const ast = tsquery.ast(fileContents);
72
+ const TEST_MATCH_SELECTOR = 'PropertyAssignment:has(Identifier[name=testMatch])';
73
+ const nodes = tsquery(ast, TEST_MATCH_SELECTOR, { visitAllChildren: true });
74
+ if (nodes.length !== 0) {
75
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}testMatch: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
76
+ tree.write(pathToJestConfig, updatedFileContents);
77
+ }
78
+ }
79
+ exports.updateJestTestMatch = updateJestTestMatch;
65
80
  function updateVitestTestIncludes(tree, pathToVitestConfig, includesString) {
66
81
  if (!tsModule) {
67
82
  tsModule = (0, ensure_typescript_1.ensureTypescript)();
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export declare const nxVersion: any;
3
- export declare const remixVersion = "^2.6.0";
3
+ export declare const remixVersion = "^2.8.1";
4
4
  export declare const isbotVersion = "^4.4.0";
5
5
  export declare const reactVersion = "^18.2.0";
6
6
  export declare const reactDomVersion = "^18.2.0";
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPackageVersion = exports.getRemixVersion = exports.testingLibraryUserEventsVersion = exports.testingLibraryJestDomVersion = exports.testingLibraryReactVersion = exports.tailwindVersion = exports.typescriptVersion = exports.eslintVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactDomVersion = exports.reactVersion = exports.isbotVersion = exports.remixVersion = exports.nxVersion = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  exports.nxVersion = require('../../package.json').version;
6
- exports.remixVersion = '^2.6.0';
6
+ exports.remixVersion = '^2.8.1';
7
7
  exports.isbotVersion = '^4.4.0';
8
8
  exports.reactVersion = '^18.2.0';
9
9
  exports.reactDomVersion = '^18.2.0';