@nx/remix 19.6.2 → 19.6.4
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 +21 -6
- package/src/generators/application/application.impl.js +1 -1
- package/src/generators/application/lib/add-e2e.js +37 -4
- package/src/generators/application/lib/normalize-options.d.ts +0 -3
- package/src/generators/application/lib/normalize-options.js +0 -25
- package/src/plugins/__snapshots__/plugin.spec.ts.snap +18 -0
- package/src/plugins/plugin.d.ts +4 -0
- package/src/plugins/plugin.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "19.6.
|
|
3
|
+
"version": "19.6.4",
|
|
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.6.
|
|
33
|
-
"@nx/js": "19.6.
|
|
34
|
-
"@nx/react": "19.6.
|
|
32
|
+
"@nx/devkit": "19.6.4",
|
|
33
|
+
"@nx/js": "19.6.4",
|
|
34
|
+
"@nx/react": "19.6.4",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
37
|
-
"@nrwl/remix": "19.6.
|
|
37
|
+
"@nrwl/remix": "19.6.4"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {},
|
|
40
40
|
"publishConfig": {
|
|
@@ -153,7 +153,12 @@ export default defineConfig({
|
|
|
153
153
|
e2e: {
|
|
154
154
|
...nxE2EPreset(__filename, {
|
|
155
155
|
cypressDir: 'src',
|
|
156
|
-
webServerCommands: {
|
|
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
|
|
197
|
+
command: 'npx nx run test:serve-static',
|
|
193
198
|
url: 'http://localhost:3000',
|
|
194
199
|
reuseExistingServer: !process.env.CI,
|
|
195
200
|
cwd: workspaceRoot,
|
|
@@ -664,7 +669,12 @@ export default defineConfig({
|
|
|
664
669
|
e2e: {
|
|
665
670
|
...nxE2EPreset(__filename, {
|
|
666
671
|
cypressDir: 'src',
|
|
667
|
-
webServerCommands: {
|
|
672
|
+
webServerCommands: {
|
|
673
|
+
default: 'npx nx run test:dev',
|
|
674
|
+
production: 'npx nx run test:serve-static',
|
|
675
|
+
},
|
|
676
|
+
ciWebServerCommand: 'npx nx run test:serve-static',
|
|
677
|
+
ciBaseUrl: 'http://localhost:3000',
|
|
668
678
|
}),
|
|
669
679
|
baseUrl: 'http://localhost:3000',
|
|
670
680
|
},
|
|
@@ -700,7 +710,7 @@ export default defineConfig({
|
|
|
700
710
|
},
|
|
701
711
|
/* Run your local dev server before starting the tests */
|
|
702
712
|
webServer: {
|
|
703
|
-
command: 'npx nx
|
|
713
|
+
command: 'npx nx run test:serve-static',
|
|
704
714
|
url: 'http://localhost:3000',
|
|
705
715
|
reuseExistingServer: !process.env.CI,
|
|
706
716
|
cwd: workspaceRoot,
|
|
@@ -1031,7 +1041,12 @@ export default defineConfig({
|
|
|
1031
1041
|
e2e: {
|
|
1032
1042
|
...nxE2EPreset(__filename, {
|
|
1033
1043
|
cypressDir: 'src',
|
|
1034
|
-
webServerCommands: {
|
|
1044
|
+
webServerCommands: {
|
|
1045
|
+
default: 'npx nx run test:dev',
|
|
1046
|
+
production: 'npx nx run test:serve-static',
|
|
1047
|
+
},
|
|
1048
|
+
ciWebServerCommand: 'npx nx run test:serve-static',
|
|
1049
|
+
ciBaseUrl: 'http://localhost:3000',
|
|
1035
1050
|
}),
|
|
1036
1051
|
baseUrl: 'http://localhost:3000',
|
|
1037
1052
|
},
|
|
@@ -1431,7 +1446,7 @@ export default defineConfig({
|
|
|
1431
1446
|
},
|
|
1432
1447
|
/* Run your local dev server before starting the tests */
|
|
1433
1448
|
webServer: {
|
|
1434
|
-
command: 'npx nx
|
|
1449
|
+
command: 'npx nx run test:serve-static',
|
|
1435
1450
|
url: 'http://localhost:3000',
|
|
1436
1451
|
reuseExistingServer: !process.env.CI,
|
|
1437
1452
|
cwd: workspaceRoot,
|
|
@@ -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:
|
|
27
|
-
baseUrl:
|
|
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:
|
|
64
|
-
webServerAddress:
|
|
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
|
}
|
|
@@ -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": [
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -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>;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -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
|
}
|