@nx/remix 17.3.0-beta.2 → 17.3.0-beta.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/generators.d.ts +1 -0
- package/generators.js +1 -0
- package/generators.json +6 -0
- package/package.json +7 -6
- package/plugin.d.ts +1 -0
- package/plugin.js +6 -0
- package/src/generators/action/schema.json +0 -4
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +144 -48
- package/src/generators/application/application.impl.js +18 -17
- package/src/generators/application/files/common/remix.config.js__tmpl__ +17 -0
- package/src/generators/application/lib/update-unit-test-config.js +4 -4
- package/src/generators/error-boundary/schema.json +0 -4
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +46 -0
- package/src/generators/init/schema.d.ts +4 -0
- package/src/generators/init/schema.json +21 -0
- package/src/generators/library/lib/add-unit-testing.js +1 -1
- package/src/generators/loader/schema.json +0 -4
- package/src/generators/meta/schema.json +0 -4
- package/src/generators/resource-route/schema.json +0 -4
- package/src/generators/route/route.impl.js +1 -0
- package/src/generators/route/schema.json +0 -4
- package/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap +18 -6
- package/src/generators/setup-tailwind/lib/update-remix-config.js +3 -6
- package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +15 -27
- package/src/generators/style/schema.json +0 -4
- package/src/generators/utils/update-dependencies.d.ts +2 -0
- package/src/generators/utils/update-dependencies.js +21 -0
- package/src/plugins/__snapshots__/plugin.spec.ts.snap +111 -0
- package/src/plugins/plugin.d.ts +9 -0
- package/src/plugins/plugin.js +136 -0
- package/src/utils/remix-config.d.ts +1 -0
- package/src/utils/remix-config.js +28 -4
- package/src/utils/testing-config-utils.d.ts +2 -2
- package/src/utils/testing-config-utils.js +9 -9
- package/src/generators/application/files/common/remix.config.cjs__tmpl__ +0 -11
package/generators.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export * from './src/generators/route/route.impl';
|
|
|
12
12
|
export * from './src/generators/setup-tailwind/setup-tailwind.impl';
|
|
13
13
|
export * from './src/generators/storybook-configuration/storybook-configuration.impl';
|
|
14
14
|
export * from './src/generators/style/style.impl';
|
|
15
|
+
export * from './src/generators/init/init';
|
package/generators.js
CHANGED
|
@@ -15,3 +15,4 @@ tslib_1.__exportStar(require("./src/generators/route/route.impl"), exports);
|
|
|
15
15
|
tslib_1.__exportStar(require("./src/generators/setup-tailwind/setup-tailwind.impl"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./src/generators/storybook-configuration/storybook-configuration.impl"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./src/generators/style/style.impl"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./src/generators/init/init"), exports);
|
package/generators.json
CHANGED
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"aliases": ["lib"],
|
|
36
36
|
"x-type": "library"
|
|
37
37
|
},
|
|
38
|
+
"init": {
|
|
39
|
+
"implementation": "./src/generators/init/init",
|
|
40
|
+
"schema": "./src/generators/init/schema.json",
|
|
41
|
+
"description": "Initialize the `@nx/remix` plugin.",
|
|
42
|
+
"hidden": true
|
|
43
|
+
},
|
|
38
44
|
"route": {
|
|
39
45
|
"implementation": "./src/generators/route/route.impl",
|
|
40
46
|
"schema": "./src/generators/route/schema.json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.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, 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,20 +28,21 @@
|
|
|
28
28
|
"migrations": "./migrations.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nx/devkit": "17.3.0-beta.
|
|
32
|
-
"@nx/js": "17.3.0-beta.
|
|
33
|
-
"@nx/react": "17.3.0-beta.
|
|
31
|
+
"@nx/devkit": "17.3.0-beta.4",
|
|
32
|
+
"@nx/js": "17.3.0-beta.4",
|
|
33
|
+
"@nx/react": "17.3.0-beta.4",
|
|
34
34
|
"tslib": "^2.3.1",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
36
|
-
"@nrwl/remix": "17.3.0-beta.
|
|
36
|
+
"@nrwl/remix": "17.3.0-beta.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
|
-
"./package.json": "./package.json",
|
|
44
43
|
".": "./index.js",
|
|
44
|
+
"./plugin": "./plugin.js",
|
|
45
|
+
"./package.json": "./package.json",
|
|
45
46
|
"./executors.json": "./executors.json",
|
|
46
47
|
"./generators.json": "./generators.json",
|
|
47
48
|
"./migrations.json": "./migrations.json",
|
package/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createNodes, createDependencies, RemixPluginOptions, } from './src/plugins/plugin';
|
package/plugin.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDependencies = exports.createNodes = void 0;
|
|
4
|
+
var plugin_1 = require("./src/plugins/plugin");
|
|
5
|
+
Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
|
|
6
|
+
Object.defineProperty(exports, "createDependencies", { enumerable: true, get: function () { return plugin_1.createDependencies; } });
|
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
"project": {
|
|
22
22
|
"type": "string",
|
|
23
23
|
"description": "The name of the project.",
|
|
24
|
-
"$default": {
|
|
25
|
-
"$source": "projectName"
|
|
26
|
-
},
|
|
27
|
-
"x-prompt": "What project is this route for?",
|
|
28
24
|
"pattern": "^[a-zA-Z].*$",
|
|
29
25
|
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v18."
|
|
30
26
|
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should create the application correctly 1`] = `
|
|
4
|
-
"
|
|
4
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
/**
|
|
5
11
|
* @type {import('@remix-run/dev').AppConfig}
|
|
6
12
|
*/
|
|
7
|
-
|
|
13
|
+
export default {
|
|
8
14
|
ignoredRouteFiles: ['**/.*'],
|
|
9
15
|
// appDirectory: "app",
|
|
10
16
|
// assetsBuildDirectory: "public/build",
|
|
11
17
|
// serverBuildPath: "build/index.js",
|
|
12
18
|
// publicPath: "/build/",
|
|
13
|
-
watchPaths: () =>
|
|
19
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
14
20
|
};
|
|
15
21
|
"
|
|
16
22
|
`;
|
|
@@ -90,16 +96,22 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
|
|
|
90
96
|
`;
|
|
91
97
|
|
|
92
98
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --directory should extract the layout directory from the directory options if it exists 1`] = `
|
|
93
|
-
"
|
|
99
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
100
|
+
import { dirname } from 'path';
|
|
101
|
+
import { fileURLToPath } from 'url';
|
|
102
|
+
|
|
103
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
104
|
+
|
|
105
|
+
/**
|
|
94
106
|
* @type {import('@remix-run/dev').AppConfig}
|
|
95
107
|
*/
|
|
96
|
-
|
|
108
|
+
export default {
|
|
97
109
|
ignoredRouteFiles: ['**/.*'],
|
|
98
110
|
// appDirectory: "app",
|
|
99
111
|
// assetsBuildDirectory: "public/build",
|
|
100
112
|
// serverBuildPath: "build/index.js",
|
|
101
113
|
// publicPath: "/build/",
|
|
102
|
-
watchPaths: () =>
|
|
114
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
103
115
|
};
|
|
104
116
|
"
|
|
105
117
|
`;
|
|
@@ -193,16 +205,22 @@ export default defineConfig({
|
|
|
193
205
|
`;
|
|
194
206
|
|
|
195
207
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --js should create the application correctly 1`] = `
|
|
196
|
-
"
|
|
208
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
209
|
+
import { dirname } from 'path';
|
|
210
|
+
import { fileURLToPath } from 'url';
|
|
211
|
+
|
|
212
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
213
|
+
|
|
214
|
+
/**
|
|
197
215
|
* @type {import('@remix-run/dev').AppConfig}
|
|
198
216
|
*/
|
|
199
|
-
|
|
217
|
+
export default {
|
|
200
218
|
ignoredRouteFiles: ['**/.*'],
|
|
201
219
|
// appDirectory: "app",
|
|
202
220
|
// assetsBuildDirectory: "public/build",
|
|
203
221
|
// serverBuildPath: "build/index.js",
|
|
204
222
|
// publicPath: "/build/",
|
|
205
|
-
watchPaths: () =>
|
|
223
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
206
224
|
};
|
|
207
225
|
"
|
|
208
226
|
`;
|
|
@@ -279,16 +297,22 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
|
|
|
279
297
|
`;
|
|
280
298
|
|
|
281
299
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using jest 1`] = `
|
|
282
|
-
"
|
|
300
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
301
|
+
import { dirname } from 'path';
|
|
302
|
+
import { fileURLToPath } from 'url';
|
|
303
|
+
|
|
304
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
305
|
+
|
|
306
|
+
/**
|
|
283
307
|
* @type {import('@remix-run/dev').AppConfig}
|
|
284
308
|
*/
|
|
285
|
-
|
|
309
|
+
export default {
|
|
286
310
|
ignoredRouteFiles: ['**/.*'],
|
|
287
311
|
// appDirectory: "app",
|
|
288
312
|
// assetsBuildDirectory: "public/build",
|
|
289
313
|
// serverBuildPath: "build/index.js",
|
|
290
314
|
// publicPath: "/build/",
|
|
291
|
-
watchPaths: () =>
|
|
315
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
292
316
|
};
|
|
293
317
|
"
|
|
294
318
|
`;
|
|
@@ -316,16 +340,22 @@ installGlobals();
|
|
|
316
340
|
`;
|
|
317
341
|
|
|
318
342
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided --unitTestRunner should generate the correct files for testing using vitest 1`] = `
|
|
319
|
-
"
|
|
343
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
344
|
+
import { dirname } from 'path';
|
|
345
|
+
import { fileURLToPath } from 'url';
|
|
346
|
+
|
|
347
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
348
|
+
|
|
349
|
+
/**
|
|
320
350
|
* @type {import('@remix-run/dev').AppConfig}
|
|
321
351
|
*/
|
|
322
|
-
|
|
352
|
+
export default {
|
|
323
353
|
ignoredRouteFiles: ['**/.*'],
|
|
324
354
|
// appDirectory: "app",
|
|
325
355
|
// assetsBuildDirectory: "public/build",
|
|
326
356
|
// serverBuildPath: "build/index.js",
|
|
327
357
|
// publicPath: "/build/",
|
|
328
|
-
watchPaths: () =>
|
|
358
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
329
359
|
};
|
|
330
360
|
"
|
|
331
361
|
`;
|
|
@@ -374,16 +404,22 @@ installGlobals();
|
|
|
374
404
|
`;
|
|
375
405
|
|
|
376
406
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provided should create the application correctly 1`] = `
|
|
377
|
-
"
|
|
407
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
408
|
+
import { dirname } from 'path';
|
|
409
|
+
import { fileURLToPath } from 'url';
|
|
410
|
+
|
|
411
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
412
|
+
|
|
413
|
+
/**
|
|
378
414
|
* @type {import('@remix-run/dev').AppConfig}
|
|
379
415
|
*/
|
|
380
|
-
|
|
416
|
+
export default {
|
|
381
417
|
ignoredRouteFiles: ['**/.*'],
|
|
382
418
|
// appDirectory: "app",
|
|
383
419
|
// assetsBuildDirectory: "public/build",
|
|
384
420
|
// serverBuildPath: "build/index.js",
|
|
385
421
|
// publicPath: "/build/",
|
|
386
|
-
watchPaths: () =>
|
|
422
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
387
423
|
};
|
|
388
424
|
"
|
|
389
425
|
`;
|
|
@@ -463,16 +499,22 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
|
|
|
463
499
|
`;
|
|
464
500
|
|
|
465
501
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should create the application correctly 1`] = `
|
|
466
|
-
"
|
|
502
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
503
|
+
import { dirname } from 'path';
|
|
504
|
+
import { fileURLToPath } from 'url';
|
|
505
|
+
|
|
506
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
507
|
+
|
|
508
|
+
/**
|
|
467
509
|
* @type {import('@remix-run/dev').AppConfig}
|
|
468
510
|
*/
|
|
469
|
-
|
|
511
|
+
export default {
|
|
470
512
|
ignoredRouteFiles: ['**/.*'],
|
|
471
513
|
// appDirectory: "app",
|
|
472
514
|
// assetsBuildDirectory: "public/build",
|
|
473
515
|
// serverBuildPath: "build/index.js",
|
|
474
516
|
// publicPath: "/build/",
|
|
475
|
-
watchPaths: () =>
|
|
517
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
476
518
|
};
|
|
477
519
|
"
|
|
478
520
|
`;
|
|
@@ -552,16 +594,22 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --
|
|
|
552
594
|
`;
|
|
553
595
|
|
|
554
596
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should extract the layout directory from the directory options if it exists 1`] = `
|
|
555
|
-
"
|
|
597
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
598
|
+
import { dirname } from 'path';
|
|
599
|
+
import { fileURLToPath } from 'url';
|
|
600
|
+
|
|
601
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
602
|
+
|
|
603
|
+
/**
|
|
556
604
|
* @type {import('@remix-run/dev').AppConfig}
|
|
557
605
|
*/
|
|
558
|
-
|
|
606
|
+
export default {
|
|
559
607
|
ignoredRouteFiles: ['**/.*'],
|
|
560
608
|
// appDirectory: "app",
|
|
561
609
|
// assetsBuildDirectory: "public/build",
|
|
562
610
|
// serverBuildPath: "build/index.js",
|
|
563
611
|
// publicPath: "/build/",
|
|
564
|
-
watchPaths: () =>
|
|
612
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
565
613
|
};
|
|
566
614
|
"
|
|
567
615
|
`;
|
|
@@ -655,16 +703,22 @@ export default defineConfig({
|
|
|
655
703
|
`;
|
|
656
704
|
|
|
657
705
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --js should create the application correctly 1`] = `
|
|
658
|
-
"
|
|
706
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
707
|
+
import { dirname } from 'path';
|
|
708
|
+
import { fileURLToPath } from 'url';
|
|
709
|
+
|
|
710
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
711
|
+
|
|
712
|
+
/**
|
|
659
713
|
* @type {import('@remix-run/dev').AppConfig}
|
|
660
714
|
*/
|
|
661
|
-
|
|
715
|
+
export default {
|
|
662
716
|
ignoredRouteFiles: ['**/.*'],
|
|
663
717
|
// appDirectory: "app",
|
|
664
718
|
// assetsBuildDirectory: "public/build",
|
|
665
719
|
// serverBuildPath: "build/index.js",
|
|
666
720
|
// publicPath: "/build/",
|
|
667
|
-
watchPaths: () =>
|
|
721
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
668
722
|
};
|
|
669
723
|
"
|
|
670
724
|
`;
|
|
@@ -741,16 +795,22 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --
|
|
|
741
795
|
`;
|
|
742
796
|
|
|
743
797
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using jest 1`] = `
|
|
744
|
-
"
|
|
798
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
799
|
+
import { dirname } from 'path';
|
|
800
|
+
import { fileURLToPath } from 'url';
|
|
801
|
+
|
|
802
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
803
|
+
|
|
804
|
+
/**
|
|
745
805
|
* @type {import('@remix-run/dev').AppConfig}
|
|
746
806
|
*/
|
|
747
|
-
|
|
807
|
+
export default {
|
|
748
808
|
ignoredRouteFiles: ['**/.*'],
|
|
749
809
|
// appDirectory: "app",
|
|
750
810
|
// assetsBuildDirectory: "public/build",
|
|
751
811
|
// serverBuildPath: "build/index.js",
|
|
752
812
|
// publicPath: "/build/",
|
|
753
|
-
watchPaths: () =>
|
|
813
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
754
814
|
};
|
|
755
815
|
"
|
|
756
816
|
`;
|
|
@@ -778,16 +838,22 @@ installGlobals();
|
|
|
778
838
|
`;
|
|
779
839
|
|
|
780
840
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 1`] = `
|
|
781
|
-
"
|
|
841
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
842
|
+
import { dirname } from 'path';
|
|
843
|
+
import { fileURLToPath } from 'url';
|
|
844
|
+
|
|
845
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
846
|
+
|
|
847
|
+
/**
|
|
782
848
|
* @type {import('@remix-run/dev').AppConfig}
|
|
783
849
|
*/
|
|
784
|
-
|
|
850
|
+
export default {
|
|
785
851
|
ignoredRouteFiles: ['**/.*'],
|
|
786
852
|
// appDirectory: "app",
|
|
787
853
|
// assetsBuildDirectory: "public/build",
|
|
788
854
|
// serverBuildPath: "build/index.js",
|
|
789
855
|
// publicPath: "/build/",
|
|
790
|
-
watchPaths: () =>
|
|
856
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
791
857
|
};
|
|
792
858
|
"
|
|
793
859
|
`;
|
|
@@ -836,16 +902,22 @@ installGlobals();
|
|
|
836
902
|
`;
|
|
837
903
|
|
|
838
904
|
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 1`] = `
|
|
839
|
-
"
|
|
905
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
906
|
+
import { dirname } from 'path';
|
|
907
|
+
import { fileURLToPath } from 'url';
|
|
908
|
+
|
|
909
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
910
|
+
|
|
911
|
+
/**
|
|
840
912
|
* @type {import('@remix-run/dev').AppConfig}
|
|
841
913
|
*/
|
|
842
|
-
|
|
914
|
+
export default {
|
|
843
915
|
ignoredRouteFiles: ['**/.*'],
|
|
844
916
|
// appDirectory: "app",
|
|
845
917
|
// assetsBuildDirectory: "public/build",
|
|
846
918
|
// serverBuildPath: "build/index.js",
|
|
847
919
|
// publicPath: "/build/",
|
|
848
|
-
watchPaths: () =>
|
|
920
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
849
921
|
};
|
|
850
922
|
"
|
|
851
923
|
`;
|
|
@@ -939,16 +1011,22 @@ export default defineConfig({
|
|
|
939
1011
|
`;
|
|
940
1012
|
|
|
941
1013
|
exports[`Remix Application Standalone Project Repo --js should create the application correctly 1`] = `
|
|
942
|
-
"
|
|
1014
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
1015
|
+
import { dirname } from 'path';
|
|
1016
|
+
import { fileURLToPath } from 'url';
|
|
1017
|
+
|
|
1018
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
943
1021
|
* @type {import('@remix-run/dev').AppConfig}
|
|
944
1022
|
*/
|
|
945
|
-
|
|
1023
|
+
export default {
|
|
946
1024
|
ignoredRouteFiles: ['**/.*'],
|
|
947
1025
|
// appDirectory: "app",
|
|
948
1026
|
// assetsBuildDirectory: "public/build",
|
|
949
1027
|
// serverBuildPath: "build/index.js",
|
|
950
1028
|
// publicPath: "/build/",
|
|
951
|
-
watchPaths: () =>
|
|
1029
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
952
1030
|
};
|
|
953
1031
|
"
|
|
954
1032
|
`;
|
|
@@ -1025,16 +1103,22 @@ exports[`Remix Application Standalone Project Repo --js should create the applic
|
|
|
1025
1103
|
`;
|
|
1026
1104
|
|
|
1027
1105
|
exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using jest 1`] = `
|
|
1028
|
-
"
|
|
1106
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
1107
|
+
import { dirname } from 'path';
|
|
1108
|
+
import { fileURLToPath } from 'url';
|
|
1109
|
+
|
|
1110
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1029
1113
|
* @type {import('@remix-run/dev').AppConfig}
|
|
1030
1114
|
*/
|
|
1031
|
-
|
|
1115
|
+
export default {
|
|
1032
1116
|
ignoredRouteFiles: ['**/.*'],
|
|
1033
1117
|
// appDirectory: "app",
|
|
1034
1118
|
// assetsBuildDirectory: "public/build",
|
|
1035
1119
|
// serverBuildPath: "build/index.js",
|
|
1036
1120
|
// publicPath: "/build/",
|
|
1037
|
-
watchPaths: () =>
|
|
1121
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
1038
1122
|
};
|
|
1039
1123
|
"
|
|
1040
1124
|
`;
|
|
@@ -1086,16 +1170,22 @@ test('renders loader data', async () => {
|
|
|
1086
1170
|
`;
|
|
1087
1171
|
|
|
1088
1172
|
exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing using vitest 1`] = `
|
|
1089
|
-
"
|
|
1173
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
1174
|
+
import { dirname } from 'path';
|
|
1175
|
+
import { fileURLToPath } from 'url';
|
|
1176
|
+
|
|
1177
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1090
1180
|
* @type {import('@remix-run/dev').AppConfig}
|
|
1091
1181
|
*/
|
|
1092
|
-
|
|
1182
|
+
export default {
|
|
1093
1183
|
ignoredRouteFiles: ['**/.*'],
|
|
1094
1184
|
// appDirectory: "app",
|
|
1095
1185
|
// assetsBuildDirectory: "public/build",
|
|
1096
1186
|
// serverBuildPath: "build/index.js",
|
|
1097
1187
|
// publicPath: "/build/",
|
|
1098
|
-
watchPaths: () =>
|
|
1188
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
1099
1189
|
};
|
|
1100
1190
|
"
|
|
1101
1191
|
`;
|
|
@@ -1164,16 +1254,22 @@ installGlobals();
|
|
|
1164
1254
|
`;
|
|
1165
1255
|
|
|
1166
1256
|
exports[`Remix Application Standalone Project Repo should create the application correctly 1`] = `
|
|
1167
|
-
"
|
|
1257
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
1258
|
+
import { dirname } from 'path';
|
|
1259
|
+
import { fileURLToPath } from 'url';
|
|
1260
|
+
|
|
1261
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1168
1264
|
* @type {import('@remix-run/dev').AppConfig}
|
|
1169
1265
|
*/
|
|
1170
|
-
|
|
1266
|
+
export default {
|
|
1171
1267
|
ignoredRouteFiles: ['**/.*'],
|
|
1172
1268
|
// appDirectory: "app",
|
|
1173
1269
|
// assetsBuildDirectory: "public/build",
|
|
1174
1270
|
// serverBuildPath: "build/index.js",
|
|
1175
1271
|
// publicPath: "/build/",
|
|
1176
|
-
watchPaths: () =>
|
|
1272
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
1177
1273
|
};
|
|
1178
1274
|
"
|
|
1179
1275
|
`;
|
|
@@ -4,9 +4,15 @@ const devkit_1 = require("@nx/devkit");
|
|
|
4
4
|
const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
5
5
|
const versions_1 = require("../../utils/versions");
|
|
6
6
|
const lib_1 = require("./lib");
|
|
7
|
+
const update_dependencies_1 = require("../utils/update-dependencies");
|
|
8
|
+
const init_1 = require("../init/init");
|
|
9
|
+
const js_1 = require("@nx/js");
|
|
7
10
|
async function default_1(tree, _options) {
|
|
8
11
|
const options = await (0, lib_1.normalizeOptions)(tree, _options);
|
|
9
|
-
const tasks = [
|
|
12
|
+
const tasks = [
|
|
13
|
+
await (0, init_1.default)(tree, { skipFormat: true }),
|
|
14
|
+
await (0, js_1.initGenerator)(tree, { skipFormat: true }),
|
|
15
|
+
];
|
|
10
16
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
11
17
|
root: options.projectRoot,
|
|
12
18
|
sourceRoot: `${options.projectRoot}`,
|
|
@@ -43,21 +49,7 @@ async function default_1(tree, _options) {
|
|
|
43
49
|
},
|
|
44
50
|
},
|
|
45
51
|
});
|
|
46
|
-
const installTask = (0,
|
|
47
|
-
'@remix-run/node': versions_1.remixVersion,
|
|
48
|
-
'@remix-run/react': versions_1.remixVersion,
|
|
49
|
-
'@remix-run/serve': versions_1.remixVersion,
|
|
50
|
-
isbot: versions_1.isbotVersion,
|
|
51
|
-
react: versions_1.reactVersion,
|
|
52
|
-
'react-dom': versions_1.reactDomVersion,
|
|
53
|
-
}, {
|
|
54
|
-
'@remix-run/dev': versions_1.remixVersion,
|
|
55
|
-
'@remix-run/eslint-config': versions_1.remixVersion,
|
|
56
|
-
'@types/react': versions_1.typesReactVersion,
|
|
57
|
-
'@types/react-dom': versions_1.typesReactDomVersion,
|
|
58
|
-
eslint: versions_1.eslintVersion,
|
|
59
|
-
typescript: versions_1.typescriptVersion,
|
|
60
|
-
});
|
|
52
|
+
const installTask = (0, update_dependencies_1.updateDependencies)(tree);
|
|
61
53
|
tasks.push(installTask);
|
|
62
54
|
const vars = {
|
|
63
55
|
...options,
|
|
@@ -82,7 +74,7 @@ async function default_1(tree, _options) {
|
|
|
82
74
|
}
|
|
83
75
|
if (options.unitTestRunner !== 'none') {
|
|
84
76
|
if (options.unitTestRunner === 'vitest') {
|
|
85
|
-
const { vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
77
|
+
const { vitestGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
86
78
|
const vitestTask = await vitestGenerator(tree, {
|
|
87
79
|
uiFramework: 'react',
|
|
88
80
|
project: options.projectName,
|
|
@@ -90,7 +82,16 @@ async function default_1(tree, _options) {
|
|
|
90
82
|
inSourceTests: false,
|
|
91
83
|
skipFormat: true,
|
|
92
84
|
testEnvironment: 'jsdom',
|
|
85
|
+
skipViteConfig: true,
|
|
93
86
|
});
|
|
87
|
+
createOrEditViteConfig(tree, {
|
|
88
|
+
project: options.projectName,
|
|
89
|
+
includeLib: false,
|
|
90
|
+
includeVitest: true,
|
|
91
|
+
testEnvironment: 'jsdom',
|
|
92
|
+
imports: [`import react from '@vitejs/plugin-react';`],
|
|
93
|
+
plugins: [`react()`],
|
|
94
|
+
}, true, undefined, true);
|
|
94
95
|
tasks.push(vitestTask);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {createWatchPaths} from '@nx/remix';
|
|
2
|
+
import {dirname} from 'path';
|
|
3
|
+
import {fileURLToPath} from 'url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @type {import('@remix-run/dev').AppConfig}
|
|
9
|
+
*/
|
|
10
|
+
export default {
|
|
11
|
+
ignoredRouteFiles: ["**/.*"],
|
|
12
|
+
// appDirectory: "app",
|
|
13
|
+
// assetsBuildDirectory: "public/build",
|
|
14
|
+
// serverBuildPath: "build/index.js",
|
|
15
|
+
// publicPath: "/build/",
|
|
16
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
17
|
+
};
|
|
@@ -11,10 +11,10 @@ function updateUnitTestConfig(tree, pathToRoot, unitTestRunner) {
|
|
|
11
11
|
import '@testing-library/jest-dom/matchers';
|
|
12
12
|
installGlobals();`);
|
|
13
13
|
if (unitTestRunner === 'vitest') {
|
|
14
|
-
const pathToViteConfig = (0, devkit_1.joinPathFragments)(pathToRoot, '
|
|
15
|
-
(0, testing_config_utils_1.
|
|
16
|
-
(0, testing_config_utils_1.
|
|
17
|
-
(0, testing_config_utils_1.
|
|
14
|
+
const pathToViteConfig = (0, devkit_1.joinPathFragments)(pathToRoot, 'vitest.config.ts');
|
|
15
|
+
(0, testing_config_utils_1.updateVitestTestIncludes)(tree, pathToViteConfig, './app/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}');
|
|
16
|
+
(0, testing_config_utils_1.updateVitestTestIncludes)(tree, pathToViteConfig, './tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}');
|
|
17
|
+
(0, testing_config_utils_1.updateVitestTestSetup)(tree, pathToViteConfig, 'test-setup.ts');
|
|
18
18
|
}
|
|
19
19
|
else if (unitTestRunner === 'jest') {
|
|
20
20
|
const pathToJestConfig = (0, devkit_1.joinPathFragments)(pathToRoot, 'jest.config.ts');
|
|
@@ -23,10 +23,6 @@
|
|
|
23
23
|
"project": {
|
|
24
24
|
"type": "string",
|
|
25
25
|
"description": "The name of the project.",
|
|
26
|
-
"$default": {
|
|
27
|
-
"$source": "projectName"
|
|
28
|
-
},
|
|
29
|
-
"x-prompt": "What project contains the route file that this ErrorBoundary is for?",
|
|
30
26
|
"pattern": "^[a-zA-Z].*$",
|
|
31
27
|
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v18."
|
|
32
28
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remixInitGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
|
+
function addPlugin(tree) {
|
|
7
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
8
|
+
nxJson.plugins ??= [];
|
|
9
|
+
for (const plugin of nxJson.plugins) {
|
|
10
|
+
if (typeof plugin === 'string'
|
|
11
|
+
? plugin === '@nx/remix/plugin'
|
|
12
|
+
: plugin.plugin === '@nx/remix/plugin') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
nxJson.plugins.push({
|
|
17
|
+
plugin: '@nx/remix/plugin',
|
|
18
|
+
options: {
|
|
19
|
+
buildTargetName: 'build',
|
|
20
|
+
serveTargetName: 'serve',
|
|
21
|
+
startTargetName: 'start',
|
|
22
|
+
typecheckTargetName: 'typecheck',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
26
|
+
}
|
|
27
|
+
async function remixInitGenerator(tree, options) {
|
|
28
|
+
const tasks = [];
|
|
29
|
+
if (!options.skipPackageJson) {
|
|
30
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
31
|
+
'@remix-run/serve': versions_1.remixVersion,
|
|
32
|
+
}, {
|
|
33
|
+
'@remix-run/dev': versions_1.remixVersion,
|
|
34
|
+
});
|
|
35
|
+
tasks.push(installTask);
|
|
36
|
+
}
|
|
37
|
+
if (process.env.NX_PCV3 === 'true') {
|
|
38
|
+
addPlugin(tree);
|
|
39
|
+
}
|
|
40
|
+
if (!options.skipFormat) {
|
|
41
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
42
|
+
}
|
|
43
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
44
|
+
}
|
|
45
|
+
exports.remixInitGenerator = remixInitGenerator;
|
|
46
|
+
exports.default = remixInitGenerator;
|