@nx/remix 18.0.4 → 18.0.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/remix",
3
- "version": "18.0.4",
3
+ "version": "18.0.6",
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.0.4",
32
- "@nx/js": "18.0.4",
33
- "@nx/react": "18.0.4",
31
+ "@nx/devkit": "18.0.6",
32
+ "@nx/js": "18.0.6",
33
+ "@nx/react": "18.0.6",
34
34
  "tslib": "^2.3.1",
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nrwl/remix": "18.0.4"
36
+ "@nrwl/remix": "18.0.6"
37
37
  },
38
38
  "peerDependencies": {},
39
39
  "publishConfig": {
@@ -53,7 +53,7 @@ async function buildExecutor(options, context) {
53
53
  packageJson.scripts ??= {};
54
54
  // Don't override existing custom script since project may have its own server.
55
55
  if (!packageJson.scripts.start) {
56
- packageJson.scripts['start'] = 'remix-serve ./build';
56
+ packageJson.scripts['start'] = 'remix-serve ./build/index.js';
57
57
  }
58
58
  updatePackageJson(packageJson, context);
59
59
  (0, devkit_1.writeJsonFile)(`${options.outputPath}/package.json`, packageJson);
@@ -151,7 +151,11 @@ import { defineConfig } from 'cypress';
151
151
 
152
152
  export default defineConfig({
153
153
  e2e: {
154
- ...nxE2EPreset(__filename, { cypressDir: 'src' }),
154
+ ...nxE2EPreset(__filename, {
155
+ cypressDir: 'src',
156
+ webServerCommands: { default: 'nx run test:serve:development' },
157
+ ciWebServerCommand: 'nx run test:serve-static',
158
+ }),
155
159
  baseUrl: 'http://localhost:4200',
156
160
  },
157
161
  });
@@ -405,6 +409,39 @@ installGlobals();
405
409
  "
406
410
  `;
407
411
 
412
+ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 4`] = `
413
+ "{
414
+ "extends": "./tsconfig.json",
415
+ "compilerOptions": {
416
+ "outDir": "../dist/out-tsc",
417
+ "types": [
418
+ "vitest/globals",
419
+ "vitest/importMeta",
420
+ "vite/client",
421
+ "node",
422
+ "vitest"
423
+ ]
424
+ },
425
+ "include": [
426
+ "vite.config.ts",
427
+ "vitest.config.ts",
428
+ "app/**/*.ts",
429
+ "app/**/*.tsx",
430
+ "app/**/*.js",
431
+ "app/**/*.jsx",
432
+ "tests/**/*.spec.ts",
433
+ "tests/**/*.test.ts",
434
+ "tests/**/*.spec.tsx",
435
+ "tests/**/*.test.tsx",
436
+ "tests/**/*.spec.js",
437
+ "tests/**/*.test.js",
438
+ "tests/**/*.spec.jsx",
439
+ "tests/**/*.test.jsx"
440
+ ]
441
+ }
442
+ "
443
+ `;
444
+
408
445
  exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 1`] = `
409
446
  "import { createWatchPaths } from '@nx/remix';
410
447
  import { dirname } from 'path';
@@ -628,7 +665,11 @@ import { defineConfig } from 'cypress';
628
665
 
629
666
  export default defineConfig({
630
667
  e2e: {
631
- ...nxE2EPreset(__filename, { cypressDir: 'src' }),
668
+ ...nxE2EPreset(__filename, {
669
+ cypressDir: 'src',
670
+ webServerCommands: { default: 'nx run test:serve:development' },
671
+ ciWebServerCommand: 'nx run test:serve-static',
672
+ }),
632
673
  baseUrl: 'http://localhost:4200',
633
674
  },
634
675
  });
@@ -882,6 +923,39 @@ installGlobals();
882
923
  "
883
924
  `;
884
925
 
926
+ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 4`] = `
927
+ "{
928
+ "extends": "./tsconfig.json",
929
+ "compilerOptions": {
930
+ "outDir": "../../dist/out-tsc",
931
+ "types": [
932
+ "vitest/globals",
933
+ "vitest/importMeta",
934
+ "vite/client",
935
+ "node",
936
+ "vitest"
937
+ ]
938
+ },
939
+ "include": [
940
+ "vite.config.ts",
941
+ "vitest.config.ts",
942
+ "app/**/*.ts",
943
+ "app/**/*.tsx",
944
+ "app/**/*.js",
945
+ "app/**/*.jsx",
946
+ "tests/**/*.spec.ts",
947
+ "tests/**/*.test.ts",
948
+ "tests/**/*.spec.tsx",
949
+ "tests/**/*.test.tsx",
950
+ "tests/**/*.spec.js",
951
+ "tests/**/*.test.js",
952
+ "tests/**/*.spec.jsx",
953
+ "tests/**/*.test.jsx"
954
+ ]
955
+ }
956
+ "
957
+ `;
958
+
885
959
  exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 1`] = `
886
960
  "import { createWatchPaths } from '@nx/remix';
887
961
  import { dirname } from 'path';
@@ -961,7 +1035,11 @@ import { defineConfig } from 'cypress';
961
1035
 
962
1036
  export default defineConfig({
963
1037
  e2e: {
964
- ...nxE2EPreset(__filename, { cypressDir: 'src' }),
1038
+ ...nxE2EPreset(__filename, {
1039
+ cypressDir: 'src',
1040
+ webServerCommands: { default: 'nx run test:serve:development' },
1041
+ ciWebServerCommand: 'nx run test:serve-static',
1042
+ }),
965
1043
  baseUrl: 'http://localhost:4200',
966
1044
  },
967
1045
  });
@@ -1181,6 +1259,39 @@ test('renders loader data', async () => {
1181
1259
  `;
1182
1260
 
1183
1261
  exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 4`] = `
1262
+ "{
1263
+ "extends": "./tsconfig.json",
1264
+ "compilerOptions": {
1265
+ "outDir": "./dist/out-tsc",
1266
+ "types": [
1267
+ "vitest/globals",
1268
+ "vitest/importMeta",
1269
+ "vite/client",
1270
+ "node",
1271
+ "vitest"
1272
+ ]
1273
+ },
1274
+ "include": [
1275
+ "vite.config.ts",
1276
+ "vitest.config.ts",
1277
+ "app/**/*.ts",
1278
+ "app/**/*.tsx",
1279
+ "app/**/*.js",
1280
+ "app/**/*.jsx",
1281
+ "tests/**/*.spec.ts",
1282
+ "tests/**/*.test.ts",
1283
+ "tests/**/*.spec.tsx",
1284
+ "tests/**/*.test.tsx",
1285
+ "tests/**/*.spec.js",
1286
+ "tests/**/*.test.js",
1287
+ "tests/**/*.spec.jsx",
1288
+ "tests/**/*.test.jsx"
1289
+ ]
1290
+ }
1291
+ "
1292
+ `;
1293
+
1294
+ exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 5`] = `
1184
1295
  "import { installGlobals } from '@remix-run/node';
1185
1296
  import '@testing-library/jest-dom/matchers';
1186
1297
  installGlobals();
@@ -735,7 +735,7 @@ export function NxWelcome({ title }: { title: string }) {
735
735
  You can activate distributed tasks executions and caching by
736
736
  running:
737
737
  </p>
738
- <pre>nx connect-to-nx-cloud</pre>
738
+ <pre>nx connect</pre>
739
739
  <a
740
740
  href="https://nx.app/?utm_source=nx-project"
741
741
  target="_blank"
@@ -26,7 +26,7 @@ function updateUnitTestConfig(tree, pathToRoot, unitTestRunner, rootProject) {
26
26
  }
27
27
  const pathToTsConfigSpec = (0, devkit_1.joinPathFragments)(pathToRoot, `tsconfig.spec.json`);
28
28
  (0, devkit_1.updateJson)(tree, pathToTsConfigSpec, (json) => {
29
- json.includes = [
29
+ json.include = [
30
30
  'vite.config.ts',
31
31
  'vitest.config.ts',
32
32
  'app/**/*.ts',
@@ -41,6 +41,7 @@ async function remixInitGeneratorInternal(tree, options) {
41
41
  }, undefined, options.keepExistingVersions);
42
42
  tasks.push(installTask);
43
43
  }
44
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
44
45
  if (options.addPlugin) {
45
46
  addPlugin(tree);
46
47
  }
@@ -17,10 +17,11 @@ exports[`@nx/remix/plugin non-root project should create nodes 1`] = `
17
17
  "^production",
18
18
  ],
19
19
  "options": {
20
- "outputPath": "{workspaceRoot}/dist/my-app",
20
+ "outputPath": "my-app",
21
21
  },
22
22
  "outputs": [
23
- "{options.outputPath}",
23
+ "{workspaceRoot}/my-app/build",
24
+ "{workspaceRoot}/my-app/public/build",
24
25
  ],
25
26
  },
26
27
  "serve": {
@@ -72,10 +73,11 @@ exports[`@nx/remix/plugin root project should create nodes 1`] = `
72
73
  "^production",
73
74
  ],
74
75
  "options": {
75
- "outputPath": "{workspaceRoot}/dist",
76
+ "outputPath": ".",
76
77
  },
77
78
  "outputs": [
78
- "{options.outputPath}",
79
+ "{workspaceRoot}/build",
80
+ "{workspaceRoot}/public/build",
79
81
  ],
80
82
  },
81
83
  "serve": {
@@ -54,16 +54,21 @@ exports.createNodes = [
54
54
  ];
55
55
  async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles) {
56
56
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
57
- const serverBuildPath = await getServerBuildPath(configFilePath, context.workspaceRoot);
57
+ const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, context.workspaceRoot);
58
58
  const targets = {};
59
- targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, namedInputs);
59
+ targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs);
60
60
  targets[options.serveTargetName] = serveTarget(serverBuildPath);
61
61
  targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
62
62
  targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
63
63
  return targets;
64
64
  }
65
- function buildTarget(buildTargetName, projectRoot, namedInputs) {
66
- const pathToOutput = projectRoot === '.' ? '' : `/${projectRoot}`;
65
+ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs) {
66
+ const serverBuildOutputPath = projectRoot === '.'
67
+ ? (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, buildDirectory)
68
+ : (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory);
69
+ const assetsBuildOutputPath = projectRoot === '.'
70
+ ? (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, assetsBuildDirectory)
71
+ : (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, assetsBuildDirectory);
67
72
  return {
68
73
  cache: true,
69
74
  dependsOn: [`^${buildTargetName}`],
@@ -72,10 +77,10 @@ function buildTarget(buildTargetName, projectRoot, namedInputs) {
72
77
  ? ['production', '^production']
73
78
  : ['default', '^default']),
74
79
  ],
75
- outputs: ['{options.outputPath}'],
80
+ outputs: [serverBuildOutputPath, assetsBuildOutputPath],
76
81
  executor: '@nx/remix:build',
77
82
  options: {
78
- outputPath: `{workspaceRoot}/dist${pathToOutput}`,
83
+ outputPath: projectRoot,
79
84
  },
80
85
  };
81
86
  }
@@ -112,10 +117,14 @@ function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
112
117
  },
113
118
  };
114
119
  }
115
- async function getServerBuildPath(configFilePath, workspaceRoot) {
120
+ async function getBuildPaths(configFilePath, workspaceRoot) {
116
121
  const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
117
122
  let appConfig = await (0, config_utils_1.loadConfigFile)(configPath);
118
- return appConfig.serverBuildPath ?? 'build/index.js';
123
+ return {
124
+ buildDirectory: 'build',
125
+ serverBuildPath: appConfig.serverBuildPath ?? 'build/index.js',
126
+ assetsBuildDirectory: appConfig.assetsBuildDirectory ?? 'public/build',
127
+ };
119
128
  }
120
129
  function normalizeOptions(options) {
121
130
  options ??= {};