@nx/remix 18.0.2 → 18.0.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 +222 -3
- package/src/generators/application/application.impl.js +1 -32
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +66 -0
- package/src/generators/application/lib/index.d.ts +1 -0
- package/src/generators/application/lib/index.js +1 -0
- package/src/generators/application/schema.d.ts +1 -1
- package/src/generators/application/schema.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.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.0.
|
|
32
|
-
"@nx/js": "18.0.
|
|
33
|
-
"@nx/react": "18.0.
|
|
31
|
+
"@nx/devkit": "18.0.3",
|
|
32
|
+
"@nx/js": "18.0.3",
|
|
33
|
+
"@nx/react": "18.0.3",
|
|
34
34
|
"tslib": "^2.3.1",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
36
|
-
"@nrwl/remix": "18.0.
|
|
36
|
+
"@nrwl/remix": "18.0.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {},
|
|
39
39
|
"publishConfig": {
|
|
@@ -144,7 +144,7 @@ export default function Index() {
|
|
|
144
144
|
"
|
|
145
145
|
`;
|
|
146
146
|
|
|
147
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate
|
|
147
|
+
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
148
148
|
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
149
149
|
|
|
150
150
|
import { defineConfig } from 'cypress';
|
|
@@ -158,6 +158,79 @@ export default defineConfig({
|
|
|
158
158
|
"
|
|
159
159
|
`;
|
|
160
160
|
|
|
161
|
+
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --e2eTestRunner should generate a playwright e2e application for the app 1`] = `
|
|
162
|
+
"import { defineConfig, devices } from '@playwright/test';
|
|
163
|
+
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
164
|
+
|
|
165
|
+
import { workspaceRoot } from '@nx/devkit';
|
|
166
|
+
|
|
167
|
+
// For CI, you may want to set BASE_URL to the deployed application.
|
|
168
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Read environment variables from file.
|
|
172
|
+
* https://github.com/motdotla/dotenv
|
|
173
|
+
*/
|
|
174
|
+
// require('dotenv').config();
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
178
|
+
*/
|
|
179
|
+
export default defineConfig({
|
|
180
|
+
...nxE2EPreset(__filename, { testDir: './src' }),
|
|
181
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
182
|
+
use: {
|
|
183
|
+
baseURL,
|
|
184
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
185
|
+
trace: 'on-first-retry',
|
|
186
|
+
},
|
|
187
|
+
/* Run your local dev server before starting the tests */
|
|
188
|
+
webServer: {
|
|
189
|
+
command: 'pnpm exec nx serve test',
|
|
190
|
+
url: 'http://localhost:4200',
|
|
191
|
+
reuseExistingServer: !process.env.CI,
|
|
192
|
+
cwd: workspaceRoot,
|
|
193
|
+
},
|
|
194
|
+
projects: [
|
|
195
|
+
{
|
|
196
|
+
name: 'chromium',
|
|
197
|
+
use: { ...devices['Desktop Chrome'] },
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
{
|
|
201
|
+
name: 'firefox',
|
|
202
|
+
use: { ...devices['Desktop Firefox'] },
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
{
|
|
206
|
+
name: 'webkit',
|
|
207
|
+
use: { ...devices['Desktop Safari'] },
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
// Uncomment for mobile browsers support
|
|
211
|
+
/* {
|
|
212
|
+
name: 'Mobile Chrome',
|
|
213
|
+
use: { ...devices['Pixel 5'] },
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'Mobile Safari',
|
|
217
|
+
use: { ...devices['iPhone 12'] },
|
|
218
|
+
}, */
|
|
219
|
+
|
|
220
|
+
// Uncomment for branded browsers
|
|
221
|
+
/* {
|
|
222
|
+
name: 'Microsoft Edge',
|
|
223
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: 'Google Chrome',
|
|
227
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
228
|
+
} */
|
|
229
|
+
],
|
|
230
|
+
});
|
|
231
|
+
"
|
|
232
|
+
`;
|
|
233
|
+
|
|
161
234
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 1`] = `
|
|
162
235
|
"import { createWatchPaths } from '@nx/remix';
|
|
163
236
|
import { dirname } from 'path';
|
|
@@ -549,7 +622,7 @@ export default function Index() {
|
|
|
549
622
|
"
|
|
550
623
|
`;
|
|
551
624
|
|
|
552
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --e2eTestRunner should generate
|
|
625
|
+
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
553
626
|
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
554
627
|
|
|
555
628
|
import { defineConfig } from 'cypress';
|
|
@@ -563,6 +636,79 @@ export default defineConfig({
|
|
|
563
636
|
"
|
|
564
637
|
`;
|
|
565
638
|
|
|
639
|
+
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --e2eTestRunner should generate a playwright e2e application for the app 1`] = `
|
|
640
|
+
"import { defineConfig, devices } from '@playwright/test';
|
|
641
|
+
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
642
|
+
|
|
643
|
+
import { workspaceRoot } from '@nx/devkit';
|
|
644
|
+
|
|
645
|
+
// For CI, you may want to set BASE_URL to the deployed application.
|
|
646
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Read environment variables from file.
|
|
650
|
+
* https://github.com/motdotla/dotenv
|
|
651
|
+
*/
|
|
652
|
+
// require('dotenv').config();
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
656
|
+
*/
|
|
657
|
+
export default defineConfig({
|
|
658
|
+
...nxE2EPreset(__filename, { testDir: './src' }),
|
|
659
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
660
|
+
use: {
|
|
661
|
+
baseURL,
|
|
662
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
663
|
+
trace: 'on-first-retry',
|
|
664
|
+
},
|
|
665
|
+
/* Run your local dev server before starting the tests */
|
|
666
|
+
webServer: {
|
|
667
|
+
command: 'pnpm exec nx serve test',
|
|
668
|
+
url: 'http://localhost:4200',
|
|
669
|
+
reuseExistingServer: !process.env.CI,
|
|
670
|
+
cwd: workspaceRoot,
|
|
671
|
+
},
|
|
672
|
+
projects: [
|
|
673
|
+
{
|
|
674
|
+
name: 'chromium',
|
|
675
|
+
use: { ...devices['Desktop Chrome'] },
|
|
676
|
+
},
|
|
677
|
+
|
|
678
|
+
{
|
|
679
|
+
name: 'firefox',
|
|
680
|
+
use: { ...devices['Desktop Firefox'] },
|
|
681
|
+
},
|
|
682
|
+
|
|
683
|
+
{
|
|
684
|
+
name: 'webkit',
|
|
685
|
+
use: { ...devices['Desktop Safari'] },
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
// Uncomment for mobile browsers support
|
|
689
|
+
/* {
|
|
690
|
+
name: 'Mobile Chrome',
|
|
691
|
+
use: { ...devices['Pixel 5'] },
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
name: 'Mobile Safari',
|
|
695
|
+
use: { ...devices['iPhone 12'] },
|
|
696
|
+
}, */
|
|
697
|
+
|
|
698
|
+
// Uncomment for branded browsers
|
|
699
|
+
/* {
|
|
700
|
+
name: 'Microsoft Edge',
|
|
701
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: 'Google Chrome',
|
|
705
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
706
|
+
} */
|
|
707
|
+
],
|
|
708
|
+
});
|
|
709
|
+
"
|
|
710
|
+
`;
|
|
711
|
+
|
|
566
712
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --js should create the application correctly 1`] = `
|
|
567
713
|
"import { createWatchPaths } from '@nx/remix';
|
|
568
714
|
import { dirname } from 'path';
|
|
@@ -810,7 +956,7 @@ export default function Index() {
|
|
|
810
956
|
"
|
|
811
957
|
`;
|
|
812
958
|
|
|
813
|
-
exports[`Remix Application Standalone Project Repo --e2eTestRunner should generate
|
|
959
|
+
exports[`Remix Application Standalone Project Repo --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
814
960
|
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
815
961
|
|
|
816
962
|
import { defineConfig } from 'cypress';
|
|
@@ -1157,3 +1303,76 @@ exports[`Remix Application Standalone Project Repo should create the application
|
|
|
1157
1303
|
}
|
|
1158
1304
|
"
|
|
1159
1305
|
`;
|
|
1306
|
+
|
|
1307
|
+
exports[`Remix Application Standalone Project Repo should generate a playwright e2e application for the app 1`] = `
|
|
1308
|
+
"import { defineConfig, devices } from '@playwright/test';
|
|
1309
|
+
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
1310
|
+
|
|
1311
|
+
import { workspaceRoot } from '@nx/devkit';
|
|
1312
|
+
|
|
1313
|
+
// For CI, you may want to set BASE_URL to the deployed application.
|
|
1314
|
+
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Read environment variables from file.
|
|
1318
|
+
* https://github.com/motdotla/dotenv
|
|
1319
|
+
*/
|
|
1320
|
+
// require('dotenv').config();
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
1324
|
+
*/
|
|
1325
|
+
export default defineConfig({
|
|
1326
|
+
...nxE2EPreset(__filename, { testDir: './src' }),
|
|
1327
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
1328
|
+
use: {
|
|
1329
|
+
baseURL,
|
|
1330
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
1331
|
+
trace: 'on-first-retry',
|
|
1332
|
+
},
|
|
1333
|
+
/* Run your local dev server before starting the tests */
|
|
1334
|
+
webServer: {
|
|
1335
|
+
command: 'pnpm exec nx serve test',
|
|
1336
|
+
url: 'http://localhost:4200',
|
|
1337
|
+
reuseExistingServer: !process.env.CI,
|
|
1338
|
+
cwd: workspaceRoot,
|
|
1339
|
+
},
|
|
1340
|
+
projects: [
|
|
1341
|
+
{
|
|
1342
|
+
name: 'chromium',
|
|
1343
|
+
use: { ...devices['Desktop Chrome'] },
|
|
1344
|
+
},
|
|
1345
|
+
|
|
1346
|
+
{
|
|
1347
|
+
name: 'firefox',
|
|
1348
|
+
use: { ...devices['Desktop Firefox'] },
|
|
1349
|
+
},
|
|
1350
|
+
|
|
1351
|
+
{
|
|
1352
|
+
name: 'webkit',
|
|
1353
|
+
use: { ...devices['Desktop Safari'] },
|
|
1354
|
+
},
|
|
1355
|
+
|
|
1356
|
+
// Uncomment for mobile browsers support
|
|
1357
|
+
/* {
|
|
1358
|
+
name: 'Mobile Chrome',
|
|
1359
|
+
use: { ...devices['Pixel 5'] },
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
name: 'Mobile Safari',
|
|
1363
|
+
use: { ...devices['iPhone 12'] },
|
|
1364
|
+
}, */
|
|
1365
|
+
|
|
1366
|
+
// Uncomment for branded browsers
|
|
1367
|
+
/* {
|
|
1368
|
+
name: 'Microsoft Edge',
|
|
1369
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
name: 'Google Chrome',
|
|
1373
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
1374
|
+
} */
|
|
1375
|
+
],
|
|
1376
|
+
});
|
|
1377
|
+
"
|
|
1378
|
+
`;
|
|
@@ -185,27 +185,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
185
185
|
// Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
|
|
186
186
|
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
if (options.e2eTestRunner === 'cypress') {
|
|
190
|
-
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
191
|
-
addFileServerTarget(tree, options, 'serve-static');
|
|
192
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
193
|
-
projectType: 'application',
|
|
194
|
-
root: options.e2eProjectRoot,
|
|
195
|
-
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
196
|
-
targets: {},
|
|
197
|
-
tags: [],
|
|
198
|
-
implicitDependencies: [options.projectName],
|
|
199
|
-
});
|
|
200
|
-
tasks.push(await configurationGenerator(tree, {
|
|
201
|
-
project: options.e2eProjectName,
|
|
202
|
-
directory: 'src',
|
|
203
|
-
skipFormat: true,
|
|
204
|
-
devServerTarget: `${options.projectName}:serve:development`,
|
|
205
|
-
baseUrl: 'http://localhost:4200',
|
|
206
|
-
addPlugin: options.addPlugin,
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
188
|
+
tasks.push(await (0, lib_1.addE2E)(tree, options));
|
|
209
189
|
if (!options.skipFormat) {
|
|
210
190
|
await (0, devkit_1.formatFiles)(tree);
|
|
211
191
|
}
|
|
@@ -215,15 +195,4 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
215
195
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
216
196
|
}
|
|
217
197
|
exports.remixApplicationGeneratorInternal = remixApplicationGeneratorInternal;
|
|
218
|
-
function addFileServerTarget(tree, options, targetName) {
|
|
219
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
220
|
-
projectConfig.targets[targetName] = {
|
|
221
|
-
executor: '@nx/web:file-server',
|
|
222
|
-
options: {
|
|
223
|
-
buildTarget: `${options.projectName}:build`,
|
|
224
|
-
port: 4200,
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
228
|
-
}
|
|
229
198
|
exports.default = remixApplicationGenerator;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addE2E = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../../utils/versions");
|
|
6
|
+
async function addE2E(tree, options) {
|
|
7
|
+
if (options.e2eTestRunner === 'cypress') {
|
|
8
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
9
|
+
addFileServerTarget(tree, options, 'serve-static');
|
|
10
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
11
|
+
projectType: 'application',
|
|
12
|
+
root: options.e2eProjectRoot,
|
|
13
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
14
|
+
targets: {},
|
|
15
|
+
tags: [],
|
|
16
|
+
implicitDependencies: [options.projectName],
|
|
17
|
+
});
|
|
18
|
+
return await configurationGenerator(tree, {
|
|
19
|
+
project: options.e2eProjectName,
|
|
20
|
+
directory: 'src',
|
|
21
|
+
skipFormat: true,
|
|
22
|
+
devServerTarget: `${options.projectName}:serve:development`,
|
|
23
|
+
baseUrl: 'http://localhost:4200',
|
|
24
|
+
addPlugin: options.addPlugin,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else if (options.e2eTestRunner === 'playwright') {
|
|
28
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
29
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
30
|
+
projectType: 'application',
|
|
31
|
+
root: options.e2eProjectRoot,
|
|
32
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
33
|
+
targets: {},
|
|
34
|
+
tags: [],
|
|
35
|
+
implicitDependencies: [options.projectName],
|
|
36
|
+
});
|
|
37
|
+
return configurationGenerator(tree, {
|
|
38
|
+
project: options.e2eProjectName,
|
|
39
|
+
skipFormat: true,
|
|
40
|
+
skipPackageJson: false,
|
|
41
|
+
directory: 'src',
|
|
42
|
+
js: false,
|
|
43
|
+
linter: options.linter,
|
|
44
|
+
setParserOptionsProject: false,
|
|
45
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
|
|
46
|
+
webServerAddress: 'http://localhost:4200',
|
|
47
|
+
rootProject: options.rootProject,
|
|
48
|
+
addPlugin: options.addPlugin,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return () => { };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
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
|
+
}
|
|
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./update-unit-test-config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./add-e2e"), exports);
|
|
@@ -9,7 +9,7 @@ export interface NxRemixGeneratorSchema {
|
|
|
9
9
|
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
10
10
|
linter?: Linter;
|
|
11
11
|
unitTestRunner?: 'vitest' | 'jest' | 'none';
|
|
12
|
-
e2eTestRunner?: 'cypress' | 'none';
|
|
12
|
+
e2eTestRunner?: 'cypress' | 'playwright' | 'none';
|
|
13
13
|
skipFormat?: boolean;
|
|
14
14
|
rootProject?: boolean;
|
|
15
15
|
addPlugin?: boolean;
|