@nx/remix 19.7.0-beta.0 → 19.7.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "19.7.0-beta.0",
3
+ "version": "19.7.0-beta.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, Playwright, 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",
@@ -29,12 +29,12 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "19.7.0-beta.0",
33
- "@nx/js": "19.7.0-beta.0",
34
- "@nx/react": "19.7.0-beta.0",
32
+ "@nx/devkit": "19.7.0-beta.2",
33
+ "@nx/js": "19.7.0-beta.2",
34
+ "@nx/react": "19.7.0-beta.2",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1",
37
- "@nrwl/remix": "19.7.0-beta.0"
37
+ "@nrwl/remix": "19.7.0-beta.2"
38
38
  },
39
39
  "peerDependencies": {},
40
40
  "publishConfig": {
@@ -28,6 +28,10 @@
28
28
  "description": "Generate a lockfile (e.g. package-lock.json) that matches the workspace lockfile to ensure package versions match.",
29
29
  "default": false
30
30
  },
31
+ "skipOverrides": {
32
+ "type": "boolean",
33
+ "description": "Do not add a `overrides` and `resolutions` entries to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
34
+ },
31
35
  "skipPackageManager": {
32
36
  "type": "boolean",
33
37
  "description": "Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
@@ -153,7 +153,12 @@ export default defineConfig({
153
153
  e2e: {
154
154
  ...nxE2EPreset(__filename, {
155
155
  cypressDir: 'src',
156
- webServerCommands: { default: 'nx run test:dev:development' },
156
+ webServerCommands: {
157
+ default: 'npx nx run test:dev',
158
+ production: 'npx nx run test:serve-static',
159
+ },
160
+ ciWebServerCommand: 'npx nx run test:serve-static',
161
+ ciBaseUrl: 'http://localhost:3000',
157
162
  }),
158
163
  baseUrl: 'http://localhost:3000',
159
164
  },
@@ -189,7 +194,7 @@ export default defineConfig({
189
194
  },
190
195
  /* Run your local dev server before starting the tests */
191
196
  webServer: {
192
- command: 'npx nx dev test',
197
+ command: 'npx nx run test:serve-static',
193
198
  url: 'http://localhost:3000',
194
199
  reuseExistingServer: !process.env.CI,
195
200
  cwd: workspaceRoot,
@@ -370,12 +375,13 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
370
375
  import { defineConfig } from 'vite';
371
376
  import react from '@vitejs/plugin-react';
372
377
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
378
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
373
379
 
374
380
  export default defineConfig({
375
381
  root: __dirname,
376
382
  cacheDir: '../node_modules/.vite/test',
377
383
 
378
- plugins: [react(), nxViteTsPaths()],
384
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
379
385
 
380
386
  // Uncomment this if you are using workers.
381
387
  // worker: {
@@ -664,7 +670,12 @@ export default defineConfig({
664
670
  e2e: {
665
671
  ...nxE2EPreset(__filename, {
666
672
  cypressDir: 'src',
667
- webServerCommands: { default: 'nx run test:dev:development' },
673
+ webServerCommands: {
674
+ default: 'npx nx run test:dev',
675
+ production: 'npx nx run test:serve-static',
676
+ },
677
+ ciWebServerCommand: 'npx nx run test:serve-static',
678
+ ciBaseUrl: 'http://localhost:3000',
668
679
  }),
669
680
  baseUrl: 'http://localhost:3000',
670
681
  },
@@ -700,7 +711,7 @@ export default defineConfig({
700
711
  },
701
712
  /* Run your local dev server before starting the tests */
702
713
  webServer: {
703
- command: 'npx nx dev test',
714
+ command: 'npx nx run test:serve-static',
704
715
  url: 'http://localhost:3000',
705
716
  reuseExistingServer: !process.env.CI,
706
717
  cwd: workspaceRoot,
@@ -881,12 +892,13 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --
881
892
  import { defineConfig } from 'vite';
882
893
  import react from '@vitejs/plugin-react';
883
894
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
895
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
884
896
 
885
897
  export default defineConfig({
886
898
  root: __dirname,
887
899
  cacheDir: '../../node_modules/.vite/apps/test',
888
900
 
889
- plugins: [react(), nxViteTsPaths()],
901
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
890
902
 
891
903
  // Uncomment this if you are using workers.
892
904
  // worker: {
@@ -1031,7 +1043,12 @@ export default defineConfig({
1031
1043
  e2e: {
1032
1044
  ...nxE2EPreset(__filename, {
1033
1045
  cypressDir: 'src',
1034
- webServerCommands: { default: 'nx run test:dev:development' },
1046
+ webServerCommands: {
1047
+ default: 'npx nx run test:dev',
1048
+ production: 'npx nx run test:serve-static',
1049
+ },
1050
+ ciWebServerCommand: 'npx nx run test:serve-static',
1051
+ ciBaseUrl: 'http://localhost:3000',
1035
1052
  }),
1036
1053
  baseUrl: 'http://localhost:3000',
1037
1054
  },
@@ -1199,12 +1216,13 @@ exports[`Remix Application Standalone Project Repo --unitTestRunner should gener
1199
1216
  import { defineConfig } from 'vite';
1200
1217
  import react from '@vitejs/plugin-react';
1201
1218
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
1219
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
1202
1220
 
1203
1221
  export default defineConfig({
1204
1222
  root: __dirname,
1205
1223
  cacheDir: './node_modules/.vite/test',
1206
1224
 
1207
- plugins: [react(), nxViteTsPaths()],
1225
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
1208
1226
 
1209
1227
  // Uncomment this if you are using workers.
1210
1228
  // worker: {
@@ -1431,7 +1449,7 @@ export default defineConfig({
1431
1449
  },
1432
1450
  /* Run your local dev server before starting the tests */
1433
1451
  webServer: {
1434
- command: 'npx nx dev test',
1452
+ command: 'npx nx run test:serve-static',
1435
1453
  url: 'http://localhost:3000',
1436
1454
  reuseExistingServer: !process.env.CI,
1437
1455
  cwd: workspaceRoot,
@@ -58,7 +58,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
58
58
  cwd: options.projectRoot,
59
59
  },
60
60
  },
61
- ['static-serve']: {
61
+ ['serve-static']: {
62
62
  dependsOn: ['build'],
63
63
  command: `remix-serve build/index.js`,
64
64
  options: {
@@ -5,10 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../../utils/versions");
6
6
  const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
7
7
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
8
+ const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
8
9
  async function addE2E(tree, options) {
9
10
  const hasRemixPlugin = (0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
10
11
  ? p === '@nx/remix/plugin'
11
12
  : p.plugin === '@nx/remix/plugin');
13
+ let e2eWebsServerInfo = await getRemixE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.projectRoot, 'remix.config.js'), options.addPlugin ?? Boolean(hasRemixPlugin));
12
14
  if (options.e2eTestRunner === 'cypress') {
13
15
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
14
16
  (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
@@ -23,8 +25,18 @@ async function addE2E(tree, options) {
23
25
  project: options.e2eProjectName,
24
26
  directory: 'src',
25
27
  skipFormat: true,
26
- devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}:development`,
27
- baseUrl: options.e2eWebServerAddress,
28
+ devServerTarget: e2eWebsServerInfo.e2eDevServerTarget,
29
+ baseUrl: e2eWebsServerInfo.e2eWebServerAddress,
30
+ webServerCommands: hasRemixPlugin
31
+ ? {
32
+ default: e2eWebsServerInfo.e2eWebServerCommand,
33
+ production: e2eWebsServerInfo.e2eCiWebServerCommand,
34
+ }
35
+ : undefined,
36
+ ciWebServerCommand: hasRemixPlugin
37
+ ? e2eWebsServerInfo.e2eCiWebServerCommand
38
+ : undefined,
39
+ ciBaseUrl: e2eWebsServerInfo.e2eCiBaseUrl,
28
40
  addPlugin: options.addPlugin,
29
41
  });
30
42
  if (options.addPlugin ||
@@ -60,8 +72,8 @@ async function addE2E(tree, options) {
60
72
  js: false,
61
73
  linter: options.linter,
62
74
  setParserOptionsProject: false,
63
- webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
64
- webServerAddress: options.e2eWebServerAddress,
75
+ webServerCommand: e2eWebsServerInfo.e2eCiWebServerCommand,
76
+ webServerAddress: e2eWebsServerInfo.e2eCiBaseUrl,
65
77
  rootProject: options.rootProject,
66
78
  addPlugin: options.addPlugin,
67
79
  });
@@ -84,3 +96,24 @@ async function addE2E(tree, options) {
84
96
  return () => { };
85
97
  }
86
98
  }
99
+ async function getRemixE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded) {
100
+ const nxJson = (0, devkit_1.readNxJson)(tree);
101
+ let e2ePort = isPluginBeingAdded ? 3000 : 4200;
102
+ const defaultServeTarget = isPluginBeingAdded ? 'dev' : 'serve';
103
+ if (nxJson.targetDefaults?.[defaultServeTarget] &&
104
+ nxJson.targetDefaults?.[defaultServeTarget].options?.port) {
105
+ e2ePort = nxJson.targetDefaults?.[defaultServeTarget].options?.port;
106
+ }
107
+ return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
108
+ plugin: '@nx/remix/plugin',
109
+ serveTargetName: 'serveTargetName',
110
+ serveStaticTargetName: 'serveStaticTargetName',
111
+ configFilePath,
112
+ }, {
113
+ defaultServeTargetName: defaultServeTarget,
114
+ defaultServeStaticTargetName: 'serve-static',
115
+ defaultE2EWebServerAddress: `http://localhost:${e2ePort}`,
116
+ defaultE2ECiBaseUrl: 'http://localhost:3000',
117
+ defaultE2EPort: e2ePort,
118
+ }, isPluginBeingAdded);
119
+ }
@@ -5,9 +5,6 @@ export interface NormalizedSchema extends NxRemixGeneratorSchema {
5
5
  projectRoot: string;
6
6
  e2eProjectName: string;
7
7
  e2eProjectRoot: string;
8
- e2eWebServerAddress: string;
9
- e2eWebServerTarget: string;
10
- e2ePort: number;
11
8
  parsedTags: string[];
12
9
  }
13
10
  export declare function normalizeOptions(tree: Tree, options: NxRemixGeneratorSchema): Promise<NormalizedSchema>;
@@ -19,30 +19,8 @@ async function normalizeOptions(tree, options) {
19
19
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
20
20
  nxJson.useInferencePlugins !== false;
21
21
  options.addPlugin ??= addPluginDefault;
22
- let e2eWebServerTarget = options.addPlugin ? 'dev' : 'serve';
23
- if (options.addPlugin) {
24
- if (nxJson.plugins) {
25
- for (const plugin of nxJson.plugins) {
26
- if (typeof plugin === 'object' &&
27
- plugin.plugin === '@nx/remix/plugin' &&
28
- plugin.options.devTargetName) {
29
- e2eWebServerTarget = plugin.options
30
- .devTargetName;
31
- }
32
- }
33
- }
34
- }
35
- let e2ePort = options.addPlugin ? 3000 : 4200;
36
- if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
37
- (nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
38
- nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT)) {
39
- e2ePort =
40
- nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
41
- nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT;
42
- }
43
22
  const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
44
23
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
45
- const e2eWebServerAddress = `http://localhost:${e2ePort}`;
46
24
  const parsedTags = options.tags
47
25
  ? options.tags.split(',').map((s) => s.trim())
48
26
  : [];
@@ -53,9 +31,6 @@ async function normalizeOptions(tree, options) {
53
31
  projectRoot,
54
32
  e2eProjectName,
55
33
  e2eProjectRoot,
56
- e2eWebServerAddress,
57
- e2eWebServerTarget,
58
- e2ePort,
59
34
  parsedTags,
60
35
  };
61
36
  }
@@ -27,12 +27,13 @@ exports[`Remix Library Generator -projectNameAndRootFormat=as-provided --unitTes
27
27
  "import { defineConfig } from 'vite';
28
28
  import react from '@vitejs/plugin-react';
29
29
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
30
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
30
31
 
31
32
  export default defineConfig({
32
33
  root: __dirname,
33
34
  cacheDir: '../node_modules/.vite/test',
34
35
 
35
- plugins: [react(), nxViteTsPaths()],
36
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
36
37
 
37
38
  // Uncomment this if you are using workers.
38
39
  // worker: {
@@ -105,12 +106,13 @@ exports[`Remix Library Generator -projectNameAndRootFormat=derived --unitTestRun
105
106
  "import { defineConfig } from 'vite';
106
107
  import react from '@vitejs/plugin-react';
107
108
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
109
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
108
110
 
109
111
  export default defineConfig({
110
112
  root: __dirname,
111
113
  cacheDir: '../../node_modules/.vite/libs/test',
112
114
 
113
- plugins: [react(), nxViteTsPaths()],
115
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
114
116
 
115
117
  // Uncomment this if you are using workers.
116
118
  // worker: {
@@ -90,12 +90,13 @@ exports[`Storybook Configuration it should create a storybook configuration and
90
90
  "import { defineConfig } from 'vite';
91
91
  import react from '@vitejs/plugin-react';
92
92
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
93
+ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
93
94
 
94
95
  export default defineConfig({
95
96
  root: __dirname,
96
97
  cacheDir: '../../node_modules/.vite/libs/storybook-test',
97
98
 
98
- plugins: [react(), nxViteTsPaths()],
99
+ plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
99
100
 
100
101
  // Uncomment this if you are using workers.
101
102
  // worker: {
@@ -35,6 +35,15 @@ exports[`@nx/remix/plugin non-root project should create nodes 1`] = `
35
35
  "cwd": "my-app",
36
36
  },
37
37
  },
38
+ "serve-static": {
39
+ "command": "remix-serve build/index.js",
40
+ "dependsOn": [
41
+ "build",
42
+ ],
43
+ "options": {
44
+ "cwd": "my-app",
45
+ },
46
+ },
38
47
  "start": {
39
48
  "command": "remix-serve build/index.js",
40
49
  "dependsOn": [
@@ -110,6 +119,15 @@ exports[`@nx/remix/plugin root project should create nodes 1`] = `
110
119
  "cwd": ".",
111
120
  },
112
121
  },
122
+ "serve-static": {
123
+ "command": "remix-serve build/index.js",
124
+ "dependsOn": [
125
+ "build",
126
+ ],
127
+ "options": {
128
+ "cwd": ".",
129
+ },
130
+ },
113
131
  "start": {
114
132
  "command": "remix-serve build/index.js",
115
133
  "dependsOn": [
@@ -5,6 +5,10 @@ export interface RemixPluginOptions {
5
5
  devTargetName?: string;
6
6
  startTargetName?: string;
7
7
  typecheckTargetName?: string;
8
+ /**
9
+ * @deprecated Use serveStaticTargetName instead. This option will be removed in Nx 21.
10
+ */
8
11
  staticServeTargetName?: string;
12
+ serveStaticTargetName?: string;
9
13
  }
10
14
  export declare const createNodes: CreateNodes<RemixPluginOptions>;
@@ -59,7 +59,9 @@ async function buildRemixTargets(configFilePath, projectRoot, options, context,
59
59
  targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs);
60
60
  targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot);
61
61
  targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
62
+ // TODO(colum): Remove for Nx 21
62
63
  targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
64
+ targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
63
65
  targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
64
66
  return targets;
65
67
  }
@@ -131,6 +133,8 @@ function normalizeOptions(options) {
131
133
  options.devTargetName ??= 'dev';
132
134
  options.startTargetName ??= 'start';
133
135
  options.typecheckTargetName ??= 'typecheck';
136
+ // TODO(colum): remove for Nx 21
134
137
  options.staticServeTargetName ??= 'static-serve';
138
+ options.serveStaticTargetName ??= 'serve-static';
135
139
  return options;
136
140
  }