@nx/remix 18.2.0-beta.1 → 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 -18
- package/src/generators/application/lib/add-e2e.js +8 -6
- 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,10 +153,9 @@ export default defineConfig({
|
|
|
153
153
|
e2e: {
|
|
154
154
|
...nxE2EPreset(__filename, {
|
|
155
155
|
cypressDir: 'src',
|
|
156
|
-
webServerCommands: { default: 'nx run test:
|
|
157
|
-
ciWebServerCommand: 'nx run test:serve-static',
|
|
156
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
158
157
|
}),
|
|
159
|
-
baseUrl: 'http://localhost:
|
|
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:
|
|
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
|
|
194
|
-
url: 'http://localhost:
|
|
192
|
+
command: 'pnpm exec nx dev test',
|
|
193
|
+
url: 'http://localhost:3000',
|
|
195
194
|
reuseExistingServer: !process.env.CI,
|
|
196
195
|
cwd: workspaceRoot,
|
|
197
196
|
},
|
|
@@ -667,10 +666,9 @@ export default defineConfig({
|
|
|
667
666
|
e2e: {
|
|
668
667
|
...nxE2EPreset(__filename, {
|
|
669
668
|
cypressDir: 'src',
|
|
670
|
-
webServerCommands: { default: 'nx run test:
|
|
671
|
-
ciWebServerCommand: 'nx run test:serve-static',
|
|
669
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
672
670
|
}),
|
|
673
|
-
baseUrl: 'http://localhost:
|
|
671
|
+
baseUrl: 'http://localhost:3000',
|
|
674
672
|
},
|
|
675
673
|
});
|
|
676
674
|
"
|
|
@@ -683,7 +681,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
|
|
|
683
681
|
import { workspaceRoot } from '@nx/devkit';
|
|
684
682
|
|
|
685
683
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
686
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:
|
|
684
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
687
685
|
|
|
688
686
|
/**
|
|
689
687
|
* Read environment variables from file.
|
|
@@ -704,8 +702,8 @@ export default defineConfig({
|
|
|
704
702
|
},
|
|
705
703
|
/* Run your local dev server before starting the tests */
|
|
706
704
|
webServer: {
|
|
707
|
-
command: 'pnpm exec nx
|
|
708
|
-
url: 'http://localhost:
|
|
705
|
+
command: 'pnpm exec nx dev test',
|
|
706
|
+
url: 'http://localhost:3000',
|
|
709
707
|
reuseExistingServer: !process.env.CI,
|
|
710
708
|
cwd: workspaceRoot,
|
|
711
709
|
},
|
|
@@ -1037,10 +1035,9 @@ export default defineConfig({
|
|
|
1037
1035
|
e2e: {
|
|
1038
1036
|
...nxE2EPreset(__filename, {
|
|
1039
1037
|
cypressDir: 'src',
|
|
1040
|
-
webServerCommands: { default: 'nx run test:
|
|
1041
|
-
ciWebServerCommand: 'nx run test:serve-static',
|
|
1038
|
+
webServerCommands: { default: 'nx run test:dev:development' },
|
|
1042
1039
|
}),
|
|
1043
|
-
baseUrl: 'http://localhost:
|
|
1040
|
+
baseUrl: 'http://localhost:3000',
|
|
1044
1041
|
},
|
|
1045
1042
|
});
|
|
1046
1043
|
"
|
|
@@ -1419,7 +1416,7 @@ import { nxE2EPreset } from '@nx/playwright/preset';
|
|
|
1419
1416
|
import { workspaceRoot } from '@nx/devkit';
|
|
1420
1417
|
|
|
1421
1418
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
1422
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:
|
|
1419
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
1423
1420
|
|
|
1424
1421
|
/**
|
|
1425
1422
|
* Read environment variables from file.
|
|
@@ -1440,8 +1437,8 @@ export default defineConfig({
|
|
|
1440
1437
|
},
|
|
1441
1438
|
/* Run your local dev server before starting the tests */
|
|
1442
1439
|
webServer: {
|
|
1443
|
-
command: 'pnpm exec nx
|
|
1444
|
-
url: 'http://localhost:
|
|
1440
|
+
command: 'pnpm exec nx dev test',
|
|
1441
|
+
url: 'http://localhost:3000',
|
|
1445
1442
|
reuseExistingServer: !process.env.CI,
|
|
1446
1443
|
cwd: workspaceRoot,
|
|
1447
1444
|
},
|
|
@@ -6,7 +6,9 @@ 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
|
-
|
|
9
|
+
// TODO(colum): Remix needs a different approach to serve-static
|
|
10
|
+
// Likely via remix start
|
|
11
|
+
// addFileServerTarget(tree, options, 'serve-static');
|
|
10
12
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
11
13
|
projectType: 'application',
|
|
12
14
|
root: options.e2eProjectRoot,
|
|
@@ -19,8 +21,8 @@ async function addE2E(tree, options) {
|
|
|
19
21
|
project: options.e2eProjectName,
|
|
20
22
|
directory: 'src',
|
|
21
23
|
skipFormat: true,
|
|
22
|
-
devServerTarget: `${options.projectName}:
|
|
23
|
-
baseUrl:
|
|
24
|
+
devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}:development`,
|
|
25
|
+
baseUrl: options.e2eWebServerAddress,
|
|
24
26
|
addPlugin: options.addPlugin,
|
|
25
27
|
});
|
|
26
28
|
}
|
|
@@ -42,8 +44,8 @@ async function addE2E(tree, options) {
|
|
|
42
44
|
js: false,
|
|
43
45
|
linter: options.linter,
|
|
44
46
|
setParserOptionsProject: false,
|
|
45
|
-
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx
|
|
46
|
-
webServerAddress:
|
|
47
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
|
|
48
|
+
webServerAddress: options.e2eWebServerAddress,
|
|
47
49
|
rootProject: options.rootProject,
|
|
48
50
|
addPlugin: options.addPlugin,
|
|
49
51
|
});
|
|
@@ -59,7 +61,7 @@ function addFileServerTarget(tree, options, targetName) {
|
|
|
59
61
|
executor: '@nx/web:file-server',
|
|
60
62
|
options: {
|
|
61
63
|
buildTarget: `${options.projectName}:build`,
|
|
62
|
-
port:
|
|
64
|
+
port: options.e2ePort,
|
|
63
65
|
},
|
|
64
66
|
};
|
|
65
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",
|