@nx/remix 18.2.0-beta.2 → 18.2.0-beta.3
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 +5 -5
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +15 -15
- package/src/generators/application/lib/add-e2e.js +5 -5
- package/src/generators/application/lib/normalize-options.d.ts +3 -0
- package/src/generators/application/lib/normalize-options.js +26 -0
- package/src/generators/application/schema.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "18.2.0-beta.
|
|
3
|
+
"version": "18.2.0-beta.3",
|
|
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.2.0-beta.
|
|
32
|
-
"@nx/js": "18.2.0-beta.
|
|
33
|
-
"@nx/react": "18.2.0-beta.
|
|
31
|
+
"@nx/devkit": "18.2.0-beta.3",
|
|
32
|
+
"@nx/js": "18.2.0-beta.3",
|
|
33
|
+
"@nx/react": "18.2.0-beta.3",
|
|
34
34
|
"tslib": "^2.3.1",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
36
|
-
"@nrwl/remix": "18.2.0-beta.
|
|
36
|
+
"@nrwl/remix": "18.2.0-beta.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {},
|
|
39
39
|
"publishConfig": {
|
|
@@ -153,9 +153,9 @@ export default defineConfig({
|
|
|
153
153
|
e2e: {
|
|
154
154
|
...nxE2EPreset(__filename, {
|
|
155
155
|
cypressDir: 'src',
|
|
156
|
-
webServerCommands: { default: 'nx run test:
|
|
156
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
157
157
|
}),
|
|
158
|
-
baseUrl: 'http://localhost:
|
|
158
|
+
baseUrl: 'http://localhost:3000',
|
|
159
159
|
},
|
|
160
160
|
});
|
|
161
161
|
"
|
|
@@ -168,7 +168,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
|
|
|
168
168
|
import { workspaceRoot } from '@nx/devkit';
|
|
169
169
|
|
|
170
170
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
171
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:
|
|
171
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Read environment variables from file.
|
|
@@ -189,8 +189,8 @@ export default defineConfig({
|
|
|
189
189
|
},
|
|
190
190
|
/* Run your local dev server before starting the tests */
|
|
191
191
|
webServer: {
|
|
192
|
-
command: 'pnpm exec nx
|
|
193
|
-
url: 'http://localhost:
|
|
192
|
+
command: 'pnpm exec nx dev test',
|
|
193
|
+
url: 'http://localhost:3000',
|
|
194
194
|
reuseExistingServer: !process.env.CI,
|
|
195
195
|
cwd: workspaceRoot,
|
|
196
196
|
},
|
|
@@ -666,9 +666,9 @@ export default defineConfig({
|
|
|
666
666
|
e2e: {
|
|
667
667
|
...nxE2EPreset(__filename, {
|
|
668
668
|
cypressDir: 'src',
|
|
669
|
-
webServerCommands: { default: 'nx run test:
|
|
669
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
670
670
|
}),
|
|
671
|
-
baseUrl: 'http://localhost:
|
|
671
|
+
baseUrl: 'http://localhost:3000',
|
|
672
672
|
},
|
|
673
673
|
});
|
|
674
674
|
"
|
|
@@ -681,7 +681,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
|
|
|
681
681
|
import { workspaceRoot } from '@nx/devkit';
|
|
682
682
|
|
|
683
683
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
684
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:
|
|
684
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
685
685
|
|
|
686
686
|
/**
|
|
687
687
|
* Read environment variables from file.
|
|
@@ -702,8 +702,8 @@ export default defineConfig({
|
|
|
702
702
|
},
|
|
703
703
|
/* Run your local dev server before starting the tests */
|
|
704
704
|
webServer: {
|
|
705
|
-
command: 'pnpm exec nx
|
|
706
|
-
url: 'http://localhost:
|
|
705
|
+
command: 'pnpm exec nx dev test',
|
|
706
|
+
url: 'http://localhost:3000',
|
|
707
707
|
reuseExistingServer: !process.env.CI,
|
|
708
708
|
cwd: workspaceRoot,
|
|
709
709
|
},
|
|
@@ -1035,9 +1035,9 @@ export default defineConfig({
|
|
|
1035
1035
|
e2e: {
|
|
1036
1036
|
...nxE2EPreset(__filename, {
|
|
1037
1037
|
cypressDir: 'src',
|
|
1038
|
-
webServerCommands: { default: 'nx run test:
|
|
1038
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
1039
1039
|
}),
|
|
1040
|
-
baseUrl: 'http://localhost:
|
|
1040
|
+
baseUrl: 'http://localhost:3000',
|
|
1041
1041
|
},
|
|
1042
1042
|
});
|
|
1043
1043
|
"
|
|
@@ -1416,7 +1416,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
|
|
|
1416
1416
|
import { workspaceRoot } from '@nx/devkit';
|
|
1417
1417
|
|
|
1418
1418
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
1419
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:
|
|
1419
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
1420
1420
|
|
|
1421
1421
|
/**
|
|
1422
1422
|
* Read environment variables from file.
|
|
@@ -1437,8 +1437,8 @@ export default defineConfig({
|
|
|
1437
1437
|
},
|
|
1438
1438
|
/* Run your local dev server before starting the tests */
|
|
1439
1439
|
webServer: {
|
|
1440
|
-
command: 'pnpm exec nx
|
|
1441
|
-
url: 'http://localhost:
|
|
1440
|
+
command: 'pnpm exec nx dev test',
|
|
1441
|
+
url: 'http://localhost:3000',
|
|
1442
1442
|
reuseExistingServer: !process.env.CI,
|
|
1443
1443
|
cwd: workspaceRoot,
|
|
1444
1444
|
},
|
|
@@ -21,8 +21,8 @@ async function addE2E(tree, options) {
|
|
|
21
21
|
project: options.e2eProjectName,
|
|
22
22
|
directory: 'src',
|
|
23
23
|
skipFormat: true,
|
|
24
|
-
devServerTarget: `${options.projectName}:
|
|
25
|
-
baseUrl:
|
|
24
|
+
devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}:development`,
|
|
25
|
+
baseUrl: options.e2eWebServerAddress,
|
|
26
26
|
addPlugin: options.addPlugin,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -44,8 +44,8 @@ async function addE2E(tree, options) {
|
|
|
44
44
|
js: false,
|
|
45
45
|
linter: options.linter,
|
|
46
46
|
setParserOptionsProject: false,
|
|
47
|
-
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx
|
|
48
|
-
webServerAddress:
|
|
47
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
|
|
48
|
+
webServerAddress: options.e2eWebServerAddress,
|
|
49
49
|
rootProject: options.rootProject,
|
|
50
50
|
addPlugin: options.addPlugin,
|
|
51
51
|
});
|
|
@@ -61,7 +61,7 @@ function addFileServerTarget(tree, options, targetName) {
|
|
|
61
61
|
executor: '@nx/web:file-server',
|
|
62
62
|
options: {
|
|
63
63
|
buildTarget: `${options.projectName}:build`,
|
|
64
|
-
port:
|
|
64
|
+
port: options.e2ePort,
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
@@ -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,31 @@ 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
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
25
|
+
if (nxJson.plugins) {
|
|
26
|
+
for (const plugin of nxJson.plugins) {
|
|
27
|
+
if (typeof plugin === 'object' &&
|
|
28
|
+
plugin.plugin === '@nx/remix/plugin' &&
|
|
29
|
+
plugin.options.devTargetName) {
|
|
30
|
+
e2eWebServerTarget = plugin.options
|
|
31
|
+
.devTargetName;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let e2ePort = options.addPlugin ? 3000 : 4200;
|
|
37
|
+
if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
|
|
38
|
+
(nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
|
39
|
+
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT)) {
|
|
40
|
+
e2ePort =
|
|
41
|
+
nxJson.targetDefaults?.[e2eWebServerTarget].options?.port ||
|
|
42
|
+
nxJson.targetDefaults?.[e2eWebServerTarget].options?.env?.PORT;
|
|
43
|
+
}
|
|
22
44
|
const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
|
|
23
45
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
|
|
46
|
+
const e2eWebServerAddress = `http://localhost:${e2ePort}`;
|
|
24
47
|
const parsedTags = options.tags
|
|
25
48
|
? options.tags.split(',').map((s) => s.trim())
|
|
26
49
|
: [];
|
|
@@ -31,6 +54,9 @@ async function normalizeOptions(tree, options) {
|
|
|
31
54
|
projectRoot,
|
|
32
55
|
e2eProjectName,
|
|
33
56
|
e2eProjectRoot,
|
|
57
|
+
e2eWebServerAddress,
|
|
58
|
+
e2eWebServerTarget,
|
|
59
|
+
e2ePort,
|
|
34
60
|
parsedTags,
|
|
35
61
|
};
|
|
36
62
|
}
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"type": "string",
|
|
48
48
|
"enum": ["cypress", "playwright", "none"],
|
|
49
49
|
"default": "cypress",
|
|
50
|
-
"description": "Test runner to use for e2e tests"
|
|
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",
|