@nx/remix 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba

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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/migrations.json +29 -0
  4. package/package.json +8 -7
  5. package/src/generators/action/schema.d.ts +1 -1
  6. package/src/generators/action/schema.json +1 -1
  7. package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +43 -44
  8. package/src/generators/application/application.impl.js +20 -0
  9. package/src/generators/application/files/common/app/root.tsx__tmpl__ +2 -2
  10. package/src/generators/application/lib/add-e2e.js +4 -16
  11. package/src/generators/application/lib/normalize-options.d.ts +3 -0
  12. package/src/generators/application/lib/normalize-options.js +25 -0
  13. package/src/generators/application/schema.json +4 -3
  14. package/src/generators/error-boundary/schema.d.ts +1 -1
  15. package/src/generators/error-boundary/schema.json +1 -1
  16. package/src/generators/init/init.js +11 -26
  17. package/src/generators/library/__snapshots__/library.impl.spec.ts.snap +4 -2
  18. package/src/generators/loader/schema.d.ts +1 -1
  19. package/src/generators/loader/schema.json +1 -1
  20. package/src/generators/meta/schema.d.ts +1 -1
  21. package/src/generators/meta/schema.json +1 -1
  22. package/src/generators/resource-route/schema.d.ts +1 -1
  23. package/src/generators/resource-route/schema.json +1 -1
  24. package/src/generators/route/schema.d.ts +1 -1
  25. package/src/generators/route/schema.json +1 -1
  26. package/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap +7 -7
  27. package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +71 -0
  28. package/src/generators/storybook-configuration/files/vite.config.ts__tpl__ +1 -1
  29. package/src/generators/storybook-configuration/storybook-configuration.impl.js +6 -1
  30. package/src/generators/style/schema.d.ts +1 -1
  31. package/src/generators/style/schema.json +1 -1
  32. package/src/plugins/__snapshots__/plugin.spec.ts.snap +50 -12
  33. package/src/plugins/plugin.d.ts +2 -1
  34. package/src/plugins/plugin.js +28 -28
  35. package/src/utils/testing-config-utils.d.ts +1 -0
  36. package/src/utils/testing-config-utils.js +16 -1
  37. package/src/utils/versions.d.ts +2 -2
  38. package/src/utils/versions.js +3 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
21
21
 
22
- This package is a [Remix plugin for Nx](https://nx.dev/packages/remix).
22
+ This package is a [Remix plugin for Nx](https://nx.dev/nx-api/remix).
23
23
 
24
24
  ## Getting Started
25
25
 
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "0.0.0-pr-22179-271588f",
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.",
3
+ "version": "0.0.0-pr-26482-ebe2dba",
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",
7
7
  "url": "https://github.com/nrwl/nx.git",
@@ -12,7 +12,8 @@
12
12
  "Remix",
13
13
  "React",
14
14
  "Web",
15
- "CLI"
15
+ "CLI",
16
+ "Front-end"
16
17
  ],
17
18
  "author": "Victor Savkin",
18
19
  "license": "MIT",
@@ -28,12 +29,12 @@
28
29
  "migrations": "./migrations.json"
29
30
  },
30
31
  "dependencies": {
31
- "@nx/devkit": "0.0.0-pr-22179-271588f",
32
- "@nx/js": "0.0.0-pr-22179-271588f",
33
- "@nx/react": "0.0.0-pr-22179-271588f",
32
+ "@nx/devkit": "0.0.0-pr-26482-ebe2dba",
33
+ "@nx/js": "0.0.0-pr-26482-ebe2dba",
34
+ "@nx/react": "0.0.0-pr-26482-ebe2dba",
34
35
  "tslib": "^2.3.1",
35
36
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nrwl/remix": "0.0.0-pr-22179-271588f"
37
+ "@nrwl/remix": "0.0.0-pr-26482-ebe2dba"
37
38
  },
38
39
  "peerDependencies": {},
39
40
  "publishConfig": {
@@ -4,7 +4,7 @@ export interface LoaderSchema {
4
4
  path: string;
5
5
  nameAndDirectoryFormat?: NameAndDirectoryFormat;
6
6
  /**
7
- * @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v19.
7
+ * @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
8
8
  */
9
9
  project?: string;
10
10
  }
@@ -22,7 +22,7 @@
22
22
  "type": "string",
23
23
  "description": "The name of the project.",
24
24
  "pattern": "^[a-zA-Z].*$",
25
- "x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v19."
25
+ "x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
26
26
  }
27
27
  },
28
28
  "required": ["path"]
@@ -34,9 +34,7 @@ import {
34
34
 
35
35
  export const meta: MetaFunction = () => [
36
36
  {
37
- charset: 'utf-8',
38
37
  title: 'New Remix App',
39
- viewport: 'width=device-width,initial-scale=1',
40
38
  },
41
39
  ];
42
40
 
@@ -44,6 +42,8 @@ export default function App() {
44
42
  return (
45
43
  <html lang="en">
46
44
  <head>
45
+ <meta charSet="utf-8" />
46
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
47
47
  <Meta />
48
48
  <Links />
49
49
  </head>
@@ -106,9 +106,7 @@ import {
106
106
 
107
107
  export const meta: MetaFunction = () => [
108
108
  {
109
- charset: 'utf-8',
110
109
  title: 'New Remix App',
111
- viewport: 'width=device-width,initial-scale=1',
112
110
  },
113
111
  ];
114
112
 
@@ -116,6 +114,8 @@ export default function App() {
116
114
  return (
117
115
  <html lang="en">
118
116
  <head>
117
+ <meta charSet="utf-8" />
118
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
119
119
  <Meta />
120
120
  <Links />
121
121
  </head>
@@ -153,10 +153,9 @@ export default defineConfig({
153
153
  e2e: {
154
154
  ...nxE2EPreset(__filename, {
155
155
  cypressDir: 'src',
156
- webServerCommands: { default: 'nx run test:serve:development' },
157
- ciWebServerCommand: 'nx run test:serve-static',
156
+ webServerCommands: { default: 'nx run test:dev:development' },
158
157
  }),
159
- baseUrl: 'http://localhost:4200',
158
+ baseUrl: 'http://localhost:3000',
160
159
  },
161
160
  });
162
161
  "
@@ -169,7 +168,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
169
168
  import { workspaceRoot } from '@nx/devkit';
170
169
 
171
170
  // For CI, you may want to set BASE_URL to the deployed application.
172
- const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
171
+ const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
173
172
 
174
173
  /**
175
174
  * Read environment variables from file.
@@ -190,8 +189,8 @@ export default defineConfig({
190
189
  },
191
190
  /* Run your local dev server before starting the tests */
192
191
  webServer: {
193
- command: 'pnpm exec nx serve test',
194
- url: 'http://localhost:4200',
192
+ command: 'npx nx dev test',
193
+ url: 'http://localhost:3000',
195
194
  reuseExistingServer: !process.env.CI,
196
195
  cwd: workspaceRoot,
197
196
  },
@@ -267,15 +266,15 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
267
266
  } from '@remix-run/react';
268
267
  export const meta = () => [
269
268
  {
270
- charset: 'utf-8',
271
269
  title: 'New Remix App',
272
- viewport: 'width=device-width,initial-scale=1',
273
270
  },
274
271
  ];
275
272
  export default function App() {
276
273
  return (
277
274
  <html lang="en">
278
275
  <head>
276
+ <meta charSet="utf-8" />
277
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
279
278
  <Meta />
280
279
  <Links />
281
280
  </head>
@@ -385,9 +384,10 @@ export default defineConfig({
385
384
 
386
385
  test: {
387
386
  setupFiles: ['test-setup.ts'],
387
+ watch: false,
388
388
  globals: true,
389
389
  cache: {
390
- dir: '../node_modules/.vitest',
390
+ dir: '../node_modules/.vitest/test',
391
391
  },
392
392
  environment: 'jsdom',
393
393
  include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
@@ -476,9 +476,7 @@ import {
476
476
 
477
477
  export const meta: MetaFunction = () => [
478
478
  {
479
- charset: 'utf-8',
480
479
  title: 'New Remix App',
481
- viewport: 'width=device-width,initial-scale=1',
482
480
  },
483
481
  ];
484
482
 
@@ -486,6 +484,8 @@ export default function App() {
486
484
  return (
487
485
  <html lang="en">
488
486
  <head>
487
+ <meta charSet="utf-8" />
488
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
489
489
  <Meta />
490
490
  <Links />
491
491
  </head>
@@ -548,9 +548,7 @@ import {
548
548
 
549
549
  export const meta: MetaFunction = () => [
550
550
  {
551
- charset: 'utf-8',
552
551
  title: 'New Remix App',
553
- viewport: 'width=device-width,initial-scale=1',
554
552
  },
555
553
  ];
556
554
 
@@ -558,6 +556,8 @@ export default function App() {
558
556
  return (
559
557
  <html lang="en">
560
558
  <head>
559
+ <meta charSet="utf-8" />
560
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
561
561
  <Meta />
562
562
  <Links />
563
563
  </head>
@@ -620,9 +620,7 @@ import {
620
620
 
621
621
  export const meta: MetaFunction = () => [
622
622
  {
623
- charset: 'utf-8',
624
623
  title: 'New Remix App',
625
- viewport: 'width=device-width,initial-scale=1',
626
624
  },
627
625
  ];
628
626
 
@@ -630,6 +628,8 @@ export default function App() {
630
628
  return (
631
629
  <html lang="en">
632
630
  <head>
631
+ <meta charSet="utf-8" />
632
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
633
633
  <Meta />
634
634
  <Links />
635
635
  </head>
@@ -667,10 +667,9 @@ export default defineConfig({
667
667
  e2e: {
668
668
  ...nxE2EPreset(__filename, {
669
669
  cypressDir: 'src',
670
- webServerCommands: { default: 'nx run test:serve:development' },
671
- ciWebServerCommand: 'nx run test:serve-static',
670
+ webServerCommands: { default: 'nx run test:dev:development' },
672
671
  }),
673
- baseUrl: 'http://localhost:4200',
672
+ baseUrl: 'http://localhost:3000',
674
673
  },
675
674
  });
676
675
  "
@@ -683,7 +682,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
683
682
  import { workspaceRoot } from '@nx/devkit';
684
683
 
685
684
  // For CI, you may want to set BASE_URL to the deployed application.
686
- const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
685
+ const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
687
686
 
688
687
  /**
689
688
  * Read environment variables from file.
@@ -704,8 +703,8 @@ export default defineConfig({
704
703
  },
705
704
  /* Run your local dev server before starting the tests */
706
705
  webServer: {
707
- command: 'pnpm exec nx serve test',
708
- url: 'http://localhost:4200',
706
+ command: 'npx nx dev test',
707
+ url: 'http://localhost:3000',
709
708
  reuseExistingServer: !process.env.CI,
710
709
  cwd: workspaceRoot,
711
710
  },
@@ -781,15 +780,15 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --
781
780
  } from '@remix-run/react';
782
781
  export const meta = () => [
783
782
  {
784
- charset: 'utf-8',
785
783
  title: 'New Remix App',
786
- viewport: 'width=device-width,initial-scale=1',
787
784
  },
788
785
  ];
789
786
  export default function App() {
790
787
  return (
791
788
  <html lang="en">
792
789
  <head>
790
+ <meta charSet="utf-8" />
791
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
793
792
  <Meta />
794
793
  <Links />
795
794
  </head>
@@ -899,9 +898,10 @@ export default defineConfig({
899
898
 
900
899
  test: {
901
900
  setupFiles: ['test-setup.ts'],
901
+ watch: false,
902
902
  globals: true,
903
903
  cache: {
904
- dir: '../../node_modules/.vitest',
904
+ dir: '../../node_modules/.vitest/apps/test',
905
905
  },
906
906
  environment: 'jsdom',
907
907
  include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
@@ -990,9 +990,7 @@ import {
990
990
 
991
991
  export const meta: MetaFunction = () => [
992
992
  {
993
- charset: 'utf-8',
994
993
  title: 'New Remix App',
995
- viewport: 'width=device-width,initial-scale=1',
996
994
  },
997
995
  ];
998
996
 
@@ -1000,6 +998,8 @@ export default function App() {
1000
998
  return (
1001
999
  <html lang="en">
1002
1000
  <head>
1001
+ <meta charSet="utf-8" />
1002
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1003
1003
  <Meta />
1004
1004
  <Links />
1005
1005
  </head>
@@ -1037,10 +1037,9 @@ export default defineConfig({
1037
1037
  e2e: {
1038
1038
  ...nxE2EPreset(__filename, {
1039
1039
  cypressDir: 'src',
1040
- webServerCommands: { default: 'nx run test:serve:development' },
1041
- ciWebServerCommand: 'nx run test:serve-static',
1040
+ webServerCommands: { default: 'nx run test:dev:development' },
1042
1041
  }),
1043
- baseUrl: 'http://localhost:4200',
1042
+ baseUrl: 'http://localhost:3000',
1044
1043
  },
1045
1044
  });
1046
1045
  "
@@ -1078,15 +1077,15 @@ exports[`Remix Application Standalone Project Repo --js should create the applic
1078
1077
  } from '@remix-run/react';
1079
1078
  export const meta = () => [
1080
1079
  {
1081
- charset: 'utf-8',
1082
1080
  title: 'New Remix App',
1083
- viewport: 'width=device-width,initial-scale=1',
1084
1081
  },
1085
1082
  ];
1086
1083
  export default function App() {
1087
1084
  return (
1088
1085
  <html lang="en">
1089
1086
  <head>
1087
+ <meta charSet="utf-8" />
1088
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1090
1089
  <Meta />
1091
1090
  <Links />
1092
1091
  </head>
@@ -1147,8 +1146,7 @@ export default {
1147
1146
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
1148
1147
  coverageDirectory: './coverage/test',
1149
1148
  testMatch: [
1150
- '<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
1151
- '<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
1149
+ '<rootDir>/tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
1152
1150
  ],
1153
1151
  };
1154
1152
  "
@@ -1210,7 +1208,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
1210
1208
 
1211
1209
  export default defineConfig({
1212
1210
  root: __dirname,
1213
- cacheDir: './node_modules/.vite/.',
1211
+ cacheDir: './node_modules/.vite/test',
1214
1212
 
1215
1213
  plugins: [react(), nxViteTsPaths()],
1216
1214
 
@@ -1221,9 +1219,10 @@ export default defineConfig({
1221
1219
 
1222
1220
  test: {
1223
1221
  setupFiles: ['test-setup.ts'],
1222
+ watch: false,
1224
1223
  globals: true,
1225
1224
  cache: {
1226
- dir: './node_modules/.vitest',
1225
+ dir: './node_modules/.vitest/test',
1227
1226
  },
1228
1227
  environment: 'jsdom',
1229
1228
  include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
@@ -1332,9 +1331,7 @@ import {
1332
1331
 
1333
1332
  export const meta: MetaFunction = () => [
1334
1333
  {
1335
- charset: 'utf-8',
1336
1334
  title: 'New Remix App',
1337
- viewport: 'width=device-width,initial-scale=1',
1338
1335
  },
1339
1336
  ];
1340
1337
 
@@ -1342,6 +1339,8 @@ export default function App() {
1342
1339
  return (
1343
1340
  <html lang="en">
1344
1341
  <head>
1342
+ <meta charSet="utf-8" />
1343
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
1345
1344
  <Meta />
1346
1345
  <Links />
1347
1346
  </head>
@@ -1420,7 +1419,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
1420
1419
  import { workspaceRoot } from '@nx/devkit';
1421
1420
 
1422
1421
  // For CI, you may want to set BASE_URL to the deployed application.
1423
- const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
1422
+ const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
1424
1423
 
1425
1424
  /**
1426
1425
  * Read environment variables from file.
@@ -1441,8 +1440,8 @@ export default defineConfig({
1441
1440
  },
1442
1441
  /* Run your local dev server before starting the tests */
1443
1442
  webServer: {
1444
- command: 'pnpm exec nx serve test',
1445
- url: 'http://localhost:4200',
1443
+ command: 'npx nx dev test',
1444
+ url: 'http://localhost:3000',
1446
1445
  reuseExistingServer: !process.env.CI,
1447
1446
  cwd: workspaceRoot,
1448
1447
  },
@@ -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,
@@ -56,6 +57,13 @@ async function remixApplicationGeneratorInternal(tree, _options) {
56
57
  cwd: options.projectRoot,
57
58
  },
58
59
  },
60
+ ['static-serve']: {
61
+ dependsOn: ['build'],
62
+ command: `remix-serve build/index.js`,
63
+ options: {
64
+ cwd: options.projectRoot,
65
+ },
66
+ },
59
67
  typecheck: {
60
68
  command: `tsc --project tsconfig.app.json`,
61
69
  options: {
@@ -185,6 +193,18 @@ async function remixApplicationGeneratorInternal(tree, _options) {
185
193
  // Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
186
194
  (0, create_ts_config_1.extractTsConfigBase)(tree);
187
195
  }
196
+ if (options.rootProject) {
197
+ (0, devkit_1.updateJson)(tree, `package.json`, (json) => {
198
+ json.type = 'module';
199
+ return json;
200
+ });
201
+ if (options.unitTestRunner === 'jest') {
202
+ tree.write('jest.preset.js', `import { nxPreset } from '@nx/jest/preset.js';
203
+ export default {...nxPreset};
204
+ `);
205
+ (0, testing_config_utils_1.updateJestTestMatch)(tree, 'jest.config.ts', '<rootDir>/tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}');
206
+ }
207
+ }
188
208
  tasks.push(await (0, lib_1.addE2E)(tree, options));
189
209
  if (!options.skipFormat) {
190
210
  await (0, devkit_1.formatFiles)(tree);
@@ -9,15 +9,15 @@ import {
9
9
  } from "@remix-run/react";
10
10
 
11
11
  export const meta: MetaFunction = () => ([{
12
- charset: "utf-8",
13
12
  title: "New Remix App",
14
- viewport: "width=device-width,initial-scale=1",
15
13
  }]);
16
14
 
17
15
  export default function App() {
18
16
  return (
19
17
  <html lang="en">
20
18
  <head>
19
+ <meta charSet="utf-8" />
20
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
21
21
  <Meta />
22
22
  <Links />
23
23
  </head>
@@ -6,7 +6,6 @@ const versions_1 = require("../../../utils/versions");
6
6
  async function addE2E(tree, options) {
7
7
  if (options.e2eTestRunner === 'cypress') {
8
8
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
9
- addFileServerTarget(tree, options, 'serve-static');
10
9
  (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
11
10
  projectType: 'application',
12
11
  root: options.e2eProjectRoot,
@@ -19,8 +18,8 @@ async function addE2E(tree, options) {
19
18
  project: options.e2eProjectName,
20
19
  directory: 'src',
21
20
  skipFormat: true,
22
- devServerTarget: `${options.projectName}:serve:development`,
23
- baseUrl: 'http://localhost:4200',
21
+ devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}:development`,
22
+ baseUrl: options.e2eWebServerAddress,
24
23
  addPlugin: options.addPlugin,
25
24
  });
26
25
  }
@@ -42,8 +41,8 @@ async function addE2E(tree, options) {
42
41
  js: false,
43
42
  linter: options.linter,
44
43
  setParserOptionsProject: false,
45
- webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
46
- webServerAddress: 'http://localhost:4200',
44
+ webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
45
+ webServerAddress: options.e2eWebServerAddress,
47
46
  rootProject: options.rootProject,
48
47
  addPlugin: options.addPlugin,
49
48
  });
@@ -53,14 +52,3 @@ async function addE2E(tree, options) {
53
52
  }
54
53
  }
55
54
  exports.addE2E = addE2E;
56
- function addFileServerTarget(tree, options, targetName) {
57
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
58
- projectConfig.targets[targetName] = {
59
- executor: '@nx/web:file-server',
60
- options: {
61
- buildTarget: `${options.projectName}:build`,
62
- port: 4200,
63
- },
64
- };
65
- (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
66
- }
@@ -5,6 +5,9 @@ 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;
8
11
  parsedTags: string[];
9
12
  }
10
13
  export declare function normalizeOptions(tree: Tree, options: NxRemixGeneratorSchema): Promise<NormalizedSchema>;
@@ -19,8 +19,30 @@ 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
+ }
22
43
  const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
23
44
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
45
+ const e2eWebServerAddress = `http://localhost:${e2ePort}`;
24
46
  const parsedTags = options.tags
25
47
  ? options.tags.split(',').map((s) => s.trim())
26
48
  : [];
@@ -31,6 +53,9 @@ async function normalizeOptions(tree, options) {
31
53
  projectRoot,
32
54
  e2eProjectName,
33
55
  e2eProjectRoot,
56
+ e2eWebServerAddress,
57
+ e2eWebServerTarget,
58
+ e2ePort,
34
59
  parsedTags,
35
60
  };
36
61
  }
@@ -45,9 +45,10 @@
45
45
  },
46
46
  "e2eTestRunner": {
47
47
  "type": "string",
48
- "enum": ["cypress", "playwright", "none"],
49
- "default": "cypress",
50
- "description": "Test runner to use for e2e tests"
48
+ "enum": ["playwright", "cypress", "none"],
49
+ "default": "playwright",
50
+ "description": "Test runner to use for e2e tests",
51
+ "x-prompt": "Which E2E test runner would you like to use?"
51
52
  },
52
53
  "tags": {
53
54
  "type": "string",
@@ -5,7 +5,7 @@ export interface ErrorBoundarySchema {
5
5
  skipFormat?: false;
6
6
  nameAndDirectoryFormat?: NameAndDirectoryFormat;
7
7
  /**
8
- * @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v19.
8
+ * @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
9
9
  */
10
10
  project?: string;
11
11
  }
@@ -24,7 +24,7 @@
24
24
  "type": "string",
25
25
  "description": "The name of the project.",
26
26
  "pattern": "^[a-zA-Z].*$",
27
- "x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v19."
27
+ "x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
28
28
  },
29
29
  "skipFormat": {
30
30
  "type": "boolean",