@nx/remix 20.5.0-beta.3 → 20.5.0-canary.20250128-e0c49d3
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 +4 -4
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +13 -22
- package/src/generators/application/application.impl.js +1 -2
- package/src/generators/application/files/common/tests/routes/_index.spec.tsx__tmpl__ +2 -3
- package/src/generators/application/lib/add-vite-temp-files-to-gitignore.d.ts +2 -0
- package/src/generators/application/lib/add-vite-temp-files-to-gitignore.js +18 -0
- package/src/generators/application/lib/index.d.ts +1 -1
- package/src/generators/application/lib/index.js +1 -1
- package/src/generators/application/lib/update-unit-test-config.js +0 -1
- package/src/generators/library/__snapshots__/library.impl.spec.ts.snap +3 -6
- package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +3 -3
- package/src/plugins/__snapshots__/plugin.spec.ts.snap +5 -75
- package/src/plugins/plugin.js +24 -53
- package/src/utils/versions.d.ts +0 -1
- package/src/utils/versions.js +1 -2
- package/src/generators/application/lib/ignore-vite-temp-files.d.ts +0 -3
- package/src/generators/application/lib/ignore-vite-temp-files.js +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "20.5.0-
|
|
3
|
+
"version": "20.5.0-canary.20250128-e0c49d3",
|
|
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,9 +29,9 @@
|
|
|
29
29
|
"migrations": "./migrations.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nx/devkit": "20.5.0-
|
|
33
|
-
"@nx/js": "20.5.0-
|
|
34
|
-
"@nx/react": "20.5.0-
|
|
32
|
+
"@nx/devkit": "20.5.0-canary.20250128-e0c49d3",
|
|
33
|
+
"@nx/js": "20.5.0-canary.20250128-e0c49d3",
|
|
34
|
+
"@nx/react": "20.5.0-canary.20250128-e0c49d3",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
37
37
|
},
|
|
@@ -252,7 +252,7 @@ import react from '@vitejs/plugin-react';
|
|
|
252
252
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
253
253
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
254
254
|
|
|
255
|
-
export default defineConfig(
|
|
255
|
+
export default defineConfig({
|
|
256
256
|
root: __dirname,
|
|
257
257
|
cacheDir: '../node_modules/.vite/test',
|
|
258
258
|
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
@@ -269,10 +269,10 @@ export default defineConfig(() => ({
|
|
|
269
269
|
reporters: ['default'],
|
|
270
270
|
coverage: {
|
|
271
271
|
reportsDirectory: '../coverage/test',
|
|
272
|
-
provider: 'v8'
|
|
272
|
+
provider: 'v8',
|
|
273
273
|
},
|
|
274
274
|
},
|
|
275
|
-
})
|
|
275
|
+
});
|
|
276
276
|
"
|
|
277
277
|
`;
|
|
278
278
|
|
|
@@ -429,8 +429,7 @@ installGlobals();
|
|
|
429
429
|
|
|
430
430
|
exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using jest 3`] = `
|
|
431
431
|
"import { createRemixStub } from '@remix-run/testing';
|
|
432
|
-
import { render } from '@testing-library/react';
|
|
433
|
-
import { screen } from '@testing-library/dom';
|
|
432
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
434
433
|
import Index from '../../app/routes/_index';
|
|
435
434
|
|
|
436
435
|
test('renders loader data', async () => {
|
|
@@ -443,7 +442,7 @@ test('renders loader data', async () => {
|
|
|
443
442
|
|
|
444
443
|
render(<RemixStub />);
|
|
445
444
|
|
|
446
|
-
await screen.findByText('Hello there,');
|
|
445
|
+
await waitFor(() => screen.findByText('Hello there,'));
|
|
447
446
|
});
|
|
448
447
|
"
|
|
449
448
|
`;
|
|
@@ -455,7 +454,7 @@ import react from '@vitejs/plugin-react';
|
|
|
455
454
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
456
455
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
457
456
|
|
|
458
|
-
export default defineConfig(
|
|
457
|
+
export default defineConfig({
|
|
459
458
|
root: __dirname,
|
|
460
459
|
cacheDir: './node_modules/.vite/test',
|
|
461
460
|
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
@@ -472,17 +471,16 @@ export default defineConfig(() => ({
|
|
|
472
471
|
reporters: ['default'],
|
|
473
472
|
coverage: {
|
|
474
473
|
reportsDirectory: './coverage/test',
|
|
475
|
-
provider: 'v8'
|
|
474
|
+
provider: 'v8',
|
|
476
475
|
},
|
|
477
476
|
},
|
|
478
|
-
})
|
|
477
|
+
});
|
|
479
478
|
"
|
|
480
479
|
`;
|
|
481
480
|
|
|
482
481
|
exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 2`] = `
|
|
483
482
|
"import { createRemixStub } from '@remix-run/testing';
|
|
484
|
-
import { render } from '@testing-library/react';
|
|
485
|
-
import { screen } from '@testing-library/dom';
|
|
483
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
486
484
|
import Index from '../../app/routes/_index';
|
|
487
485
|
|
|
488
486
|
test('renders loader data', async () => {
|
|
@@ -495,7 +493,7 @@ test('renders loader data', async () => {
|
|
|
495
493
|
|
|
496
494
|
render(<RemixStub />);
|
|
497
495
|
|
|
498
|
-
await screen.findByText('Hello there,');
|
|
496
|
+
await waitFor(() => screen.findByText('Hello there,'));
|
|
499
497
|
});
|
|
500
498
|
"
|
|
501
499
|
`;
|
|
@@ -608,8 +606,7 @@ export default function Index() {
|
|
|
608
606
|
|
|
609
607
|
exports[`Remix Application Standalone Project Repo should create the application correctly 3`] = `
|
|
610
608
|
"import { createRemixStub } from '@remix-run/testing';
|
|
611
|
-
import { render } from '@testing-library/react';
|
|
612
|
-
import { screen } from '@testing-library/dom';
|
|
609
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
613
610
|
import Index from '../../app/routes/_index';
|
|
614
611
|
|
|
615
612
|
test('renders loader data', async () => {
|
|
@@ -622,7 +619,7 @@ test('renders loader data', async () => {
|
|
|
622
619
|
|
|
623
620
|
render(<RemixStub />);
|
|
624
621
|
|
|
625
|
-
await screen.findByText('Hello there,');
|
|
622
|
+
await waitFor(() => screen.findByText('Hello there,'));
|
|
626
623
|
});
|
|
627
624
|
"
|
|
628
625
|
`;
|
|
@@ -659,13 +656,7 @@ export default defineConfig({
|
|
|
659
656
|
exports[`Remix Application Standalone Project Repo should create the application correctly 5`] = `
|
|
660
657
|
"{
|
|
661
658
|
"root": true,
|
|
662
|
-
"ignorePatterns": [
|
|
663
|
-
"!**/*",
|
|
664
|
-
"build",
|
|
665
|
-
"public/build",
|
|
666
|
-
"**/vite.config.*.timestamp*",
|
|
667
|
-
"**/vitest.config.*.timestamp*"
|
|
668
|
-
],
|
|
659
|
+
"ignorePatterns": ["!**/*", "build", "public/build"],
|
|
669
660
|
"plugins": ["@nx"],
|
|
670
661
|
"overrides": [
|
|
671
662
|
{
|
|
@@ -115,7 +115,6 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
115
115
|
skipPackageJson: false,
|
|
116
116
|
skipFormat: true,
|
|
117
117
|
addPlugin: true,
|
|
118
|
-
compiler: options.useTsSolution ? 'swc' : undefined,
|
|
119
118
|
});
|
|
120
119
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
121
120
|
if (projectConfig.targets?.['test']?.options) {
|
|
@@ -193,7 +192,7 @@ export default {...nxPreset};
|
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
tasks.push(await (0, lib_1.addE2E)(tree, options));
|
|
196
|
-
|
|
195
|
+
(0, lib_1.addViteTempFilesToGitIgnore)(tree);
|
|
197
196
|
(0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.app.json', {
|
|
198
197
|
jsx: 'react-jsx',
|
|
199
198
|
module: 'esnext',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRemixStub } from '@remix-run/testing';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { screen } from '@testing-library/dom';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
3
|
import Index from '../../app/routes/_index';
|
|
5
4
|
|
|
6
5
|
test('renders loader data', async () => {
|
|
@@ -13,5 +12,5 @@ test('renders loader data', async () => {
|
|
|
13
12
|
|
|
14
13
|
render(<RemixStub />);
|
|
15
14
|
|
|
16
|
-
await screen.findByText('Hello there,');
|
|
15
|
+
await waitFor(() => screen.findByText('Hello there,'));
|
|
17
16
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addViteTempFilesToGitIgnore = addViteTempFilesToGitIgnore;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function addViteTempFilesToGitIgnore(tree) {
|
|
6
|
+
let newGitIgnoreContents = `vite.config.*.timestamp*`;
|
|
7
|
+
if (tree.exists('.gitignore')) {
|
|
8
|
+
const gitIgnoreContents = tree.read('.gitignore', 'utf-8');
|
|
9
|
+
if (!gitIgnoreContents.includes(newGitIgnoreContents)) {
|
|
10
|
+
newGitIgnoreContents = (0, devkit_1.stripIndents) `${gitIgnoreContents}
|
|
11
|
+
${newGitIgnoreContents}`;
|
|
12
|
+
tree.write('.gitignore', newGitIgnoreContents);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
tree.write('.gitignore', newGitIgnoreContents);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -4,4 +4,4 @@ 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
6
|
tslib_1.__exportStar(require("./add-e2e"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
7
|
+
tslib_1.__exportStar(require("./add-vite-temp-files-to-gitignore"), exports);
|
|
@@ -46,7 +46,6 @@ function updateUnitTestConfig(tree, pathToRoot, unitTestRunner, rootProject) {
|
|
|
46
46
|
});
|
|
47
47
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
48
48
|
'@testing-library/jest-dom': versions_1.testingLibraryJestDomVersion,
|
|
49
|
-
'@testing-library/dom': versions_1.testingLibraryDomVersion,
|
|
50
49
|
'@testing-library/react': versions_1.testingLibraryReactVersion,
|
|
51
50
|
'@testing-library/user-event': versions_1.testingLibraryUserEventsVersion,
|
|
52
51
|
'@remix-run/node': (0, versions_1.getRemixVersion)(tree),
|
|
@@ -28,7 +28,7 @@ import react from '@vitejs/plugin-react';
|
|
|
28
28
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
29
29
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
30
30
|
|
|
31
|
-
export default defineConfig(
|
|
31
|
+
export default defineConfig({
|
|
32
32
|
root: __dirname,
|
|
33
33
|
cacheDir: '../node_modules/.vite/test',
|
|
34
34
|
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
@@ -43,12 +43,9 @@ export default defineConfig(() => ({
|
|
|
43
43
|
environment: 'jsdom',
|
|
44
44
|
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
45
45
|
reporters: ['default'],
|
|
46
|
-
coverage: {
|
|
47
|
-
reportsDirectory: '../coverage/test',
|
|
48
|
-
provider: 'v8' as const,
|
|
49
|
-
},
|
|
46
|
+
coverage: { reportsDirectory: '../coverage/test', provider: 'v8' },
|
|
50
47
|
},
|
|
51
|
-
})
|
|
48
|
+
});
|
|
52
49
|
"
|
|
53
50
|
`;
|
|
54
51
|
|
|
@@ -92,7 +92,7 @@ import react from '@vitejs/plugin-react';
|
|
|
92
92
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
93
93
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
94
94
|
|
|
95
|
-
export default defineConfig(
|
|
95
|
+
export default defineConfig({
|
|
96
96
|
root: __dirname,
|
|
97
97
|
cacheDir: '../../node_modules/.vite/libs/storybook-test',
|
|
98
98
|
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
@@ -109,10 +109,10 @@ export default defineConfig(() => ({
|
|
|
109
109
|
reporters: ['default'],
|
|
110
110
|
coverage: {
|
|
111
111
|
reportsDirectory: '../../coverage/libs/storybook-test',
|
|
112
|
-
provider: 'v8'
|
|
112
|
+
provider: 'v8',
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
|
-
})
|
|
115
|
+
});
|
|
116
116
|
"
|
|
117
117
|
`;
|
|
118
118
|
|
|
@@ -73,7 +73,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
|
|
|
73
73
|
},
|
|
74
74
|
"tsc": {
|
|
75
75
|
"cache": true,
|
|
76
|
-
"command": "tsc
|
|
76
|
+
"command": "tsc",
|
|
77
77
|
"inputs": [
|
|
78
78
|
"production",
|
|
79
79
|
"^production",
|
|
@@ -83,20 +83,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
|
|
|
83
83
|
],
|
|
84
84
|
},
|
|
85
85
|
],
|
|
86
|
-
"metadata": {
|
|
87
|
-
"description": "Runs type-checking for the project.",
|
|
88
|
-
"help": {
|
|
89
|
-
"command": "npx tsc --help",
|
|
90
|
-
"example": {
|
|
91
|
-
"options": {
|
|
92
|
-
"noEmit": true,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
"technologies": [
|
|
97
|
-
"typescript",
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
86
|
"options": {
|
|
101
87
|
"cwd": "my-app",
|
|
102
88
|
},
|
|
@@ -188,7 +174,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
|
|
|
188
174
|
},
|
|
189
175
|
"tsc": {
|
|
190
176
|
"cache": true,
|
|
191
|
-
"command": "tsc
|
|
177
|
+
"command": "tsc",
|
|
192
178
|
"inputs": [
|
|
193
179
|
"production",
|
|
194
180
|
"^production",
|
|
@@ -198,20 +184,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
|
|
|
198
184
|
],
|
|
199
185
|
},
|
|
200
186
|
],
|
|
201
|
-
"metadata": {
|
|
202
|
-
"description": "Runs type-checking for the project.",
|
|
203
|
-
"help": {
|
|
204
|
-
"command": "npx tsc --help",
|
|
205
|
-
"example": {
|
|
206
|
-
"options": {
|
|
207
|
-
"noEmit": true,
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
"technologies": [
|
|
212
|
-
"typescript",
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
187
|
"options": {
|
|
216
188
|
"cwd": "my-app",
|
|
217
189
|
},
|
|
@@ -298,7 +270,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
|
|
|
298
270
|
},
|
|
299
271
|
"typecheck": {
|
|
300
272
|
"cache": true,
|
|
301
|
-
"command": "tsc
|
|
273
|
+
"command": "tsc",
|
|
302
274
|
"inputs": [
|
|
303
275
|
"production",
|
|
304
276
|
"^production",
|
|
@@ -308,20 +280,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
|
|
|
308
280
|
],
|
|
309
281
|
},
|
|
310
282
|
],
|
|
311
|
-
"metadata": {
|
|
312
|
-
"description": "Runs type-checking for the project.",
|
|
313
|
-
"help": {
|
|
314
|
-
"command": "npx tsc --help",
|
|
315
|
-
"example": {
|
|
316
|
-
"options": {
|
|
317
|
-
"noEmit": true,
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
},
|
|
321
|
-
"technologies": [
|
|
322
|
-
"typescript",
|
|
323
|
-
],
|
|
324
|
-
},
|
|
325
283
|
"options": {
|
|
326
284
|
"cwd": ".",
|
|
327
285
|
},
|
|
@@ -406,7 +364,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
|
|
|
406
364
|
},
|
|
407
365
|
"tsc": {
|
|
408
366
|
"cache": true,
|
|
409
|
-
"command": "tsc
|
|
367
|
+
"command": "tsc",
|
|
410
368
|
"inputs": [
|
|
411
369
|
"production",
|
|
412
370
|
"^production",
|
|
@@ -416,20 +374,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
|
|
|
416
374
|
],
|
|
417
375
|
},
|
|
418
376
|
],
|
|
419
|
-
"metadata": {
|
|
420
|
-
"description": "Runs type-checking for the project.",
|
|
421
|
-
"help": {
|
|
422
|
-
"command": "npx tsc --help",
|
|
423
|
-
"example": {
|
|
424
|
-
"options": {
|
|
425
|
-
"noEmit": true,
|
|
426
|
-
},
|
|
427
|
-
},
|
|
428
|
-
},
|
|
429
|
-
"technologies": [
|
|
430
|
-
"typescript",
|
|
431
|
-
],
|
|
432
|
-
},
|
|
433
377
|
"options": {
|
|
434
378
|
"cwd": "my-app",
|
|
435
379
|
},
|
|
@@ -515,7 +459,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
|
|
|
515
459
|
},
|
|
516
460
|
"typecheck": {
|
|
517
461
|
"cache": true,
|
|
518
|
-
"command": "tsc
|
|
462
|
+
"command": "tsc",
|
|
519
463
|
"inputs": [
|
|
520
464
|
"production",
|
|
521
465
|
"^production",
|
|
@@ -525,20 +469,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
|
|
|
525
469
|
],
|
|
526
470
|
},
|
|
527
471
|
],
|
|
528
|
-
"metadata": {
|
|
529
|
-
"description": "Runs type-checking for the project.",
|
|
530
|
-
"help": {
|
|
531
|
-
"command": "npx tsc --help",
|
|
532
|
-
"example": {
|
|
533
|
-
"options": {
|
|
534
|
-
"noEmit": true,
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
},
|
|
538
|
-
"technologies": [
|
|
539
|
-
"typescript",
|
|
540
|
-
],
|
|
541
|
-
},
|
|
542
472
|
"options": {
|
|
543
473
|
"cwd": ".",
|
|
544
474
|
},
|
package/src/plugins/plugin.js
CHANGED
|
@@ -12,7 +12,6 @@ const path_1 = require("path");
|
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const executor_utils_1 = require("../utils/executor-utils");
|
|
14
14
|
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
15
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
16
15
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
17
16
|
function readTargetsCache(cachePath) {
|
|
18
17
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
@@ -35,7 +34,7 @@ exports.createNodesV2 = [
|
|
|
35
34
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `remix-${optionsHash}.hash`);
|
|
36
35
|
const targetsCache = readTargetsCache(cachePath);
|
|
37
36
|
try {
|
|
38
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache
|
|
37
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
|
|
39
38
|
}
|
|
40
39
|
finally {
|
|
41
40
|
writeTargetsToCache(cachePath, targetsCache);
|
|
@@ -46,10 +45,10 @@ exports.createNodes = [
|
|
|
46
45
|
remixConfigGlob,
|
|
47
46
|
async (configFilePath, options, context) => {
|
|
48
47
|
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
49
|
-
return createNodesInternal(configFilePath, options, context, {}
|
|
48
|
+
return createNodesInternal(configFilePath, options, context, {});
|
|
50
49
|
},
|
|
51
50
|
];
|
|
52
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache
|
|
51
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
53
52
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
54
53
|
const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
|
|
55
54
|
// Do not create a project if package.json and project.json isn't there
|
|
@@ -63,8 +62,10 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
63
62
|
if (remixCompiler === RemixCompiler.IsNotRemix) {
|
|
64
63
|
return {};
|
|
65
64
|
}
|
|
66
|
-
const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot,
|
|
67
|
-
|
|
65
|
+
const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
66
|
+
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
|
67
|
+
])) + configFilePath;
|
|
68
|
+
targetsCache[hash] ??= await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler);
|
|
68
69
|
const { targets, metadata } = targetsCache[hash];
|
|
69
70
|
const project = {
|
|
70
71
|
root: projectRoot,
|
|
@@ -77,21 +78,21 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
77
78
|
},
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler
|
|
81
|
+
async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler) {
|
|
81
82
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
82
83
|
const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, projectRoot, context.workspaceRoot, remixCompiler);
|
|
83
84
|
const targets = {};
|
|
84
|
-
targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler
|
|
85
|
-
targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler
|
|
86
|
-
targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
85
|
+
targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler);
|
|
86
|
+
targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler);
|
|
87
|
+
targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
|
|
87
88
|
// TODO(colum): Remove for Nx 21
|
|
88
|
-
targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
89
|
-
targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
90
|
-
targets[options.typecheckTargetName] = typecheckTarget(
|
|
89
|
+
targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
|
|
90
|
+
targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
|
|
91
|
+
targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
|
|
91
92
|
(0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
92
93
|
return { targets, metadata: {} };
|
|
93
94
|
}
|
|
94
|
-
function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler
|
|
95
|
+
function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler) {
|
|
95
96
|
const serverBuildOutputPath = projectRoot === '.'
|
|
96
97
|
? (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, buildDirectory)
|
|
97
98
|
: (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory);
|
|
@@ -105,7 +106,7 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
|
|
|
105
106
|
: (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory),
|
|
106
107
|
]
|
|
107
108
|
: [serverBuildOutputPath, assetsBuildOutputPath];
|
|
108
|
-
|
|
109
|
+
return {
|
|
109
110
|
cache: true,
|
|
110
111
|
dependsOn: [`^${buildTargetName}`],
|
|
111
112
|
inputs: [
|
|
@@ -120,45 +121,35 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
|
|
|
120
121
|
: 'remix build',
|
|
121
122
|
options: { cwd: projectRoot },
|
|
122
123
|
};
|
|
123
|
-
if (isUsingTsSolutionSetup) {
|
|
124
|
-
buildTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
125
|
-
}
|
|
126
|
-
return buildTarget;
|
|
127
124
|
}
|
|
128
|
-
function devTarget(serverBuildPath, projectRoot, remixCompiler
|
|
129
|
-
|
|
125
|
+
function devTarget(serverBuildPath, projectRoot, remixCompiler) {
|
|
126
|
+
return {
|
|
130
127
|
command: remixCompiler === RemixCompiler.IsVte
|
|
131
128
|
? 'remix vite:dev'
|
|
132
129
|
: 'remix dev --manual',
|
|
133
130
|
options: { cwd: projectRoot },
|
|
134
131
|
};
|
|
135
|
-
if (isUsingTsSolutionSetup) {
|
|
136
|
-
devTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
137
|
-
}
|
|
138
|
-
return devTarget;
|
|
139
132
|
}
|
|
140
|
-
function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler
|
|
133
|
+
function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler) {
|
|
141
134
|
let serverPath = serverBuildPath;
|
|
142
135
|
if (remixCompiler === RemixCompiler.IsVte) {
|
|
143
136
|
if (serverBuildPath === 'build') {
|
|
144
137
|
serverPath = `${serverBuildPath}/server/index.js`;
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
|
-
|
|
140
|
+
return {
|
|
148
141
|
dependsOn: [buildTargetName],
|
|
149
142
|
command: `remix-serve ${serverPath}`,
|
|
150
143
|
options: {
|
|
151
144
|
cwd: projectRoot,
|
|
152
145
|
},
|
|
153
146
|
};
|
|
154
|
-
if (isUsingTsSolutionSetup) {
|
|
155
|
-
startTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
156
|
-
}
|
|
157
|
-
return startTarget;
|
|
158
147
|
}
|
|
159
|
-
function typecheckTarget(
|
|
148
|
+
function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
|
|
160
149
|
const hasTsConfigAppJson = siblingFiles.includes('tsconfig.app.json');
|
|
161
|
-
const
|
|
150
|
+
const command = `tsc${hasTsConfigAppJson ? ` --project tsconfig.app.json` : ``}`;
|
|
151
|
+
return {
|
|
152
|
+
command,
|
|
162
153
|
cache: true,
|
|
163
154
|
inputs: [
|
|
164
155
|
...('production' in namedInputs
|
|
@@ -166,30 +157,10 @@ function typecheckTarget(typecheckTargetName, projectRoot, namedInputs, siblingF
|
|
|
166
157
|
: ['default', '^default']),
|
|
167
158
|
{ externalDependencies: ['typescript'] },
|
|
168
159
|
],
|
|
169
|
-
command: isUsingTsSolutionSetup
|
|
170
|
-
? `tsc --build --emitDeclarationOnly`
|
|
171
|
-
: `tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --noEmit`,
|
|
172
160
|
options: {
|
|
173
161
|
cwd: projectRoot,
|
|
174
162
|
},
|
|
175
|
-
metadata: {
|
|
176
|
-
description: `Runs type-checking for the project.`,
|
|
177
|
-
technologies: ['typescript'],
|
|
178
|
-
help: {
|
|
179
|
-
command: isUsingTsSolutionSetup
|
|
180
|
-
? `${pmc.exec} tsc --build --help`
|
|
181
|
-
: `${pmc.exec} tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --help`,
|
|
182
|
-
example: isUsingTsSolutionSetup
|
|
183
|
-
? { args: ['--force'] }
|
|
184
|
-
: { options: { noEmit: true } },
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
163
|
};
|
|
188
|
-
if (isUsingTsSolutionSetup) {
|
|
189
|
-
typecheckTarget.dependsOn = [`^${typecheckTargetName}`];
|
|
190
|
-
typecheckTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
191
|
-
}
|
|
192
|
-
return typecheckTarget;
|
|
193
164
|
}
|
|
194
165
|
async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCompiler) {
|
|
195
166
|
const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare const postcssVersion = "^8.4.38";
|
|
|
13
13
|
export declare const autoprefixerVersion = "^10.4.19";
|
|
14
14
|
export declare const testingLibraryReactVersion = "^14.1.2";
|
|
15
15
|
export declare const testingLibraryJestDomVersion = "6.4.2";
|
|
16
|
-
export declare const testingLibraryDomVersion = "^10.4.0";
|
|
17
16
|
export declare const testingLibraryUserEventsVersion = "^14.5.2";
|
|
18
17
|
export declare const viteVersion = "^5.0.0";
|
|
19
18
|
export declare function getRemixVersion(tree: Tree): string;
|
package/src/utils/versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.viteVersion = exports.testingLibraryUserEventsVersion = exports.
|
|
3
|
+
exports.viteVersion = exports.testingLibraryUserEventsVersion = exports.testingLibraryJestDomVersion = exports.testingLibraryReactVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptVersion = exports.eslintVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactDomVersion = exports.reactVersion = exports.isbotVersion = exports.remixVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.getRemixVersion = getRemixVersion;
|
|
5
5
|
exports.getPackageVersion = getPackageVersion;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -19,7 +19,6 @@ exports.autoprefixerVersion = '^10.4.19';
|
|
|
19
19
|
exports.testingLibraryReactVersion = '^14.1.2';
|
|
20
20
|
// TODO(colum): Unpin this when @testing-library/jest-dom pushes a fix
|
|
21
21
|
exports.testingLibraryJestDomVersion = '6.4.2';
|
|
22
|
-
exports.testingLibraryDomVersion = '^10.4.0';
|
|
23
22
|
exports.testingLibraryUserEventsVersion = '^14.5.2';
|
|
24
23
|
exports.viteVersion = '^5.0.0';
|
|
25
24
|
function getRemixVersion(tree) {
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ignoreViteTempFiles = ignoreViteTempFiles;
|
|
4
|
-
exports.isEslintInstalled = isEslintInstalled;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const versions_1 = require("../../../utils/versions");
|
|
7
|
-
async function ignoreViteTempFiles(tree, projectRoot) {
|
|
8
|
-
addViteTempFilesToGitIgnore(tree);
|
|
9
|
-
await ignoreViteTempFilesInEslintConfig(tree, projectRoot);
|
|
10
|
-
}
|
|
11
|
-
function addViteTempFilesToGitIgnore(tree) {
|
|
12
|
-
let gitIgnoreContents = tree.exists('.gitignore')
|
|
13
|
-
? tree.read('.gitignore', 'utf-8')
|
|
14
|
-
: '';
|
|
15
|
-
if (!/^vite\.config\.\*\.timestamp\*$/m.test(gitIgnoreContents)) {
|
|
16
|
-
gitIgnoreContents = (0, devkit_1.stripIndents) `${gitIgnoreContents}
|
|
17
|
-
vite.config.*.timestamp*`;
|
|
18
|
-
}
|
|
19
|
-
if (!/^vitest\.config\.\*\.timestamp\*$/m.test(gitIgnoreContents)) {
|
|
20
|
-
gitIgnoreContents = (0, devkit_1.stripIndents) `${gitIgnoreContents}
|
|
21
|
-
vitest.config.*.timestamp*`;
|
|
22
|
-
}
|
|
23
|
-
tree.write('.gitignore', gitIgnoreContents);
|
|
24
|
-
}
|
|
25
|
-
async function ignoreViteTempFilesInEslintConfig(tree, projectRoot) {
|
|
26
|
-
if (!isEslintInstalled(tree)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
(0, devkit_1.ensurePackage)('@nx/eslint', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
30
|
-
const { addIgnoresToLintConfig, isEslintConfigSupported } = await Promise.resolve().then(() => require('@nx/eslint/src/generators/utils/eslint-file'));
|
|
31
|
-
if (!isEslintConfigSupported(tree)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const { useFlatConfig } = await Promise.resolve().then(() => require('@nx/eslint/src/utils/flat-config'));
|
|
35
|
-
const isUsingFlatConfig = useFlatConfig(tree);
|
|
36
|
-
if (!projectRoot && !isUsingFlatConfig) {
|
|
37
|
-
// root eslintrc files ignore all files and the root eslintrc files add
|
|
38
|
-
// back all the project files, so we only add the ignores to the project
|
|
39
|
-
// eslintrc files
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// for flat config, we update the root config file
|
|
43
|
-
const directory = isUsingFlatConfig ? '' : projectRoot ?? '';
|
|
44
|
-
addIgnoresToLintConfig(tree, directory, [
|
|
45
|
-
'**/vite.config.*.timestamp*',
|
|
46
|
-
'**/vitest.config.*.timestamp*',
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
49
|
-
function isEslintInstalled(tree) {
|
|
50
|
-
try {
|
|
51
|
-
require('eslint');
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
catch { }
|
|
55
|
-
// it might not be installed yet, but it might be in the tree pending install
|
|
56
|
-
const { devDependencies, dependencies } = tree.exists('package.json')
|
|
57
|
-
? (0, devkit_1.readJson)(tree, 'package.json')
|
|
58
|
-
: {};
|
|
59
|
-
return !!devDependencies?.['eslint'] || !!dependencies?.['eslint'];
|
|
60
|
-
}
|