@nx/remix 18.0.4 → 18.0.5

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.5",
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.5",
32
+ "@nx/js": "18.0.5",
33
+ "@nx/react": "18.0.5",
34
34
  "tslib": "^2.3.1",
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nrwl/remix": "18.0.4"
36
+ "@nrwl/remix": "18.0.5"
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);
@@ -405,6 +405,39 @@ installGlobals();
405
405
  "
406
406
  `;
407
407
 
408
+ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 4`] = `
409
+ "{
410
+ "extends": "./tsconfig.json",
411
+ "compilerOptions": {
412
+ "outDir": "../dist/out-tsc",
413
+ "types": [
414
+ "vitest/globals",
415
+ "vitest/importMeta",
416
+ "vite/client",
417
+ "node",
418
+ "vitest"
419
+ ]
420
+ },
421
+ "include": [
422
+ "vite.config.ts",
423
+ "vitest.config.ts",
424
+ "app/**/*.ts",
425
+ "app/**/*.tsx",
426
+ "app/**/*.js",
427
+ "app/**/*.jsx",
428
+ "tests/**/*.spec.ts",
429
+ "tests/**/*.test.ts",
430
+ "tests/**/*.spec.tsx",
431
+ "tests/**/*.test.tsx",
432
+ "tests/**/*.spec.js",
433
+ "tests/**/*.test.js",
434
+ "tests/**/*.spec.jsx",
435
+ "tests/**/*.test.jsx"
436
+ ]
437
+ }
438
+ "
439
+ `;
440
+
408
441
  exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 1`] = `
409
442
  "import { createWatchPaths } from '@nx/remix';
410
443
  import { dirname } from 'path';
@@ -882,6 +915,39 @@ installGlobals();
882
915
  "
883
916
  `;
884
917
 
918
+ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 4`] = `
919
+ "{
920
+ "extends": "./tsconfig.json",
921
+ "compilerOptions": {
922
+ "outDir": "../../dist/out-tsc",
923
+ "types": [
924
+ "vitest/globals",
925
+ "vitest/importMeta",
926
+ "vite/client",
927
+ "node",
928
+ "vitest"
929
+ ]
930
+ },
931
+ "include": [
932
+ "vite.config.ts",
933
+ "vitest.config.ts",
934
+ "app/**/*.ts",
935
+ "app/**/*.tsx",
936
+ "app/**/*.js",
937
+ "app/**/*.jsx",
938
+ "tests/**/*.spec.ts",
939
+ "tests/**/*.test.ts",
940
+ "tests/**/*.spec.tsx",
941
+ "tests/**/*.test.tsx",
942
+ "tests/**/*.spec.js",
943
+ "tests/**/*.test.js",
944
+ "tests/**/*.spec.jsx",
945
+ "tests/**/*.test.jsx"
946
+ ]
947
+ }
948
+ "
949
+ `;
950
+
885
951
  exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 1`] = `
886
952
  "import { createWatchPaths } from '@nx/remix';
887
953
  import { dirname } from 'path';
@@ -1181,6 +1247,39 @@ test('renders loader data', async () => {
1181
1247
  `;
1182
1248
 
1183
1249
  exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 4`] = `
1250
+ "{
1251
+ "extends": "./tsconfig.json",
1252
+ "compilerOptions": {
1253
+ "outDir": "./dist/out-tsc",
1254
+ "types": [
1255
+ "vitest/globals",
1256
+ "vitest/importMeta",
1257
+ "vite/client",
1258
+ "node",
1259
+ "vitest"
1260
+ ]
1261
+ },
1262
+ "include": [
1263
+ "vite.config.ts",
1264
+ "vitest.config.ts",
1265
+ "app/**/*.ts",
1266
+ "app/**/*.tsx",
1267
+ "app/**/*.js",
1268
+ "app/**/*.jsx",
1269
+ "tests/**/*.spec.ts",
1270
+ "tests/**/*.test.ts",
1271
+ "tests/**/*.spec.tsx",
1272
+ "tests/**/*.test.tsx",
1273
+ "tests/**/*.spec.js",
1274
+ "tests/**/*.test.js",
1275
+ "tests/**/*.spec.jsx",
1276
+ "tests/**/*.test.jsx"
1277
+ ]
1278
+ }
1279
+ "
1280
+ `;
1281
+
1282
+ exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 5`] = `
1184
1283
  "import { installGlobals } from '@remix-run/node';
1185
1284
  import '@testing-library/jest-dom/matchers';
1186
1285
  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 ??= {};