@nx/remix 16.2.0 → 16.3.0

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.
Files changed (68) hide show
  1. package/generators.json +10 -0
  2. package/migrations.json +29 -0
  3. package/package.json +3 -2
  4. package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +106 -0
  5. package/src/generators/application/application.impl.js +21 -0
  6. package/src/generators/application/application.impl.js.map +1 -1
  7. package/src/generators/application/lib/index.d.ts +1 -0
  8. package/src/generators/application/lib/index.js +1 -0
  9. package/src/generators/application/lib/index.js.map +1 -1
  10. package/src/generators/application/lib/update-vite-test-config.d.ts +2 -0
  11. package/src/generators/application/lib/update-vite-test-config.js +23 -0
  12. package/src/generators/application/lib/update-vite-test-config.js.map +1 -0
  13. package/src/generators/application/schema.d.ts +2 -0
  14. package/src/generators/application/schema.json +13 -0
  15. package/src/generators/error-boundary/__snapshots__/error-boundary.impl.spec.ts.snap +49 -0
  16. package/src/generators/error-boundary/error-boundary.impl.d.ts +3 -0
  17. package/src/generators/error-boundary/error-boundary.impl.js +21 -0
  18. package/src/generators/error-boundary/error-boundary.impl.js.map +1 -0
  19. package/src/generators/error-boundary/lib/add-v1-error-boundary.d.ts +3 -0
  20. package/src/generators/error-boundary/lib/add-v1-error-boundary.js +21 -0
  21. package/src/generators/error-boundary/lib/add-v1-error-boundary.js.map +1 -0
  22. package/src/generators/error-boundary/lib/add-v2-error-boundary.d.ts +3 -0
  23. package/src/generators/error-boundary/lib/add-v2-error-boundary.js +43 -0
  24. package/src/generators/error-boundary/lib/add-v2-error-boundary.js.map +1 -0
  25. package/src/generators/error-boundary/lib/index.d.ts +3 -0
  26. package/src/generators/error-boundary/lib/index.js +7 -0
  27. package/src/generators/error-boundary/lib/index.js.map +1 -0
  28. package/src/generators/error-boundary/lib/normalize-options.d.ts +3 -0
  29. package/src/generators/error-boundary/lib/normalize-options.js +13 -0
  30. package/src/generators/error-boundary/lib/normalize-options.js.map +1 -0
  31. package/src/generators/error-boundary/schema.d.ts +6 -0
  32. package/src/generators/error-boundary/schema.json +39 -0
  33. package/src/generators/library/lib/add-unit-testing.d.ts +3 -0
  34. package/src/generators/library/lib/add-unit-testing.js +33 -0
  35. package/src/generators/library/lib/add-unit-testing.js.map +1 -0
  36. package/src/generators/library/lib/index.d.ts +1 -0
  37. package/src/generators/library/lib/index.js +1 -0
  38. package/src/generators/library/lib/index.js.map +1 -1
  39. package/src/generators/library/lib/normalize-options.js +2 -2
  40. package/src/generators/library/lib/normalize-options.js.map +1 -1
  41. package/src/generators/library/library.impl.js +7 -3
  42. package/src/generators/library/library.impl.js.map +1 -1
  43. package/src/generators/library/schema.d.ts +1 -0
  44. package/src/generators/library/schema.json +9 -7
  45. package/src/generators/route/__snapshots__/route.impl.spec.ts.snap +42 -0
  46. package/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap +152 -0
  47. package/src/generators/setup-tailwind/files/app/tailwind.css__tpl__ +3 -0
  48. package/src/generators/setup-tailwind/files/tailwind.config.ts__tpl__ +13 -0
  49. package/src/generators/setup-tailwind/lib/index.d.ts +1 -0
  50. package/src/generators/setup-tailwind/lib/index.js +5 -0
  51. package/src/generators/setup-tailwind/lib/index.js.map +1 -0
  52. package/src/generators/setup-tailwind/lib/update-remix-config.d.ts +2 -0
  53. package/src/generators/setup-tailwind/lib/update-remix-config.js +39 -0
  54. package/src/generators/setup-tailwind/lib/update-remix-config.js.map +1 -0
  55. package/src/generators/setup-tailwind/schema.d.ts +5 -0
  56. package/src/generators/setup-tailwind/schema.json +35 -0
  57. package/src/generators/setup-tailwind/setup-tailwind.impl.d.ts +3 -0
  58. package/src/generators/setup-tailwind/setup-tailwind.impl.js +38 -0
  59. package/src/generators/setup-tailwind/setup-tailwind.impl.js.map +1 -0
  60. package/src/utils/testing-config-utils.d.ts +4 -0
  61. package/src/utils/testing-config-utils.js +67 -0
  62. package/src/utils/testing-config-utils.js.map +1 -0
  63. package/src/utils/upsert-links-function.d.ts +2 -0
  64. package/src/utils/upsert-links-function.js +32 -0
  65. package/src/utils/upsert-links-function.js.map +1 -0
  66. package/src/utils/versions.d.ts +6 -2
  67. package/src/utils/versions.js +7 -3
  68. package/src/utils/versions.js.map +1 -1
package/generators.json CHANGED
@@ -55,11 +55,21 @@
55
55
  "schema": "./src/generators/style/schema.json",
56
56
  "description": "Generates a new stylesheet and adds it to an existing route"
57
57
  },
58
+ "setup-tailwind": {
59
+ "implementation": "./src/generators/setup-tailwind/setup-tailwind.impl",
60
+ "schema": "./src/generators/setup-tailwind/schema.json",
61
+ "description": "Generates a TailwindCSS configuration for the Remix application"
62
+ },
58
63
  "meta": {
59
64
  "implementation": "./src/generators/meta/meta.impl",
60
65
  "schema": "./src/generators/meta/schema.json",
61
66
  "description": "Add a meta function to an existing route"
62
67
  },
68
+ "error-boundary": {
69
+ "implementation": "./src/generators/error-boundary/error-boundary.impl",
70
+ "schema": "./src/generators/error-boundary/schema.json",
71
+ "description": "Add an ErrorBoundary to an existing route"
72
+ },
63
73
  "cypress": {
64
74
  "implementation": "./src/generators/cypress/cypress.impl",
65
75
  "schema": "./src/generators/cypress/schema.json",
package/migrations.json CHANGED
@@ -120,6 +120,35 @@
120
120
  "version": "^1.15.0",
121
121
  "alwaysAddToPackageJson": true
122
122
  }
123
+ },
124
+ "16.3.0": {
125
+ "version": "16.3.0",
126
+ "packages": {
127
+ "@remix-run/node": {
128
+ "version": "^1.16.1",
129
+ "alwaysAddToPackageJson": true
130
+ },
131
+ "@remix-run/react": {
132
+ "version": "^1.16.1",
133
+ "alwaysAddToPackageJson": true
134
+ },
135
+ "@remix-run/serve": {
136
+ "version": "^1.16.1",
137
+ "alwaysAddToPackageJson": true
138
+ },
139
+ "@remix-run/dev": {
140
+ "version": "^1.16.1",
141
+ "alwaysAddToPackageJson": true
142
+ },
143
+ "@remix-run/eslint-config": {
144
+ "version": "^1.16.1",
145
+ "alwaysAddToPackageJson": true
146
+ },
147
+ "isbot": {
148
+ "version": "^3.6.8",
149
+ "alwaysAddToPackageJson": true
150
+ }
151
+ }
123
152
  }
124
153
  }
125
154
  }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "16.2.0",
3
+ "version": "16.3.0",
4
4
  "main": "src/index.js",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
7
7
  "@nx/devkit": "^16.0.3",
8
8
  "@nx/js": "^16.0.3",
9
9
  "@nx/react": "^16.0.3",
10
+ "@phenomnomnominal/tsquery": "^5.0.1",
10
11
  "tslib": "^2.3.1",
11
- "@nrwl/remix": "16.2.0"
12
+ "@nrwl/remix": "16.3.0"
12
13
  },
13
14
  "ng-update": {
14
15
  "requirements": {},
@@ -258,6 +258,59 @@ exports[`Remix Application Integrated Repo --js should create the application co
258
258
  "
259
259
  `;
260
260
 
261
+ exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing 1`] = `
262
+ "/**
263
+ * @type {import('@remix-run/dev').AppConfig}
264
+ */
265
+ module.exports = {
266
+ ignoredRouteFiles: ['**/.*'],
267
+ // appDirectory: \\"app\\",
268
+ // assetsBuildDirectory: \\"public/build\\",
269
+ // serverBuildPath: \\"build/index.js\\",
270
+ // publicPath: \\"/build/\\",
271
+ watchPaths: () => require('@nx/remix').createWatchPaths(__dirname),
272
+ };
273
+ "
274
+ `;
275
+
276
+ exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing 2`] = `
277
+ "/// <reference types=\\"vitest\\" />
278
+ import react from '@vitejs/plugin-react';
279
+ import { defineConfig } from 'vite';
280
+ import viteTsConfigPaths from 'vite-tsconfig-paths';
281
+
282
+ export default defineConfig({
283
+ cacheDir: '../../node_modules/.vite/test',
284
+
285
+ plugins: [
286
+ react(),
287
+ viteTsConfigPaths({
288
+ root: '../../',
289
+ }),
290
+ ],
291
+
292
+ // Uncomment this if you are using workers.
293
+ // worker: {
294
+ // plugins: [
295
+ // viteTsConfigPaths({
296
+ // root: '../../',
297
+ // }),
298
+ // ],
299
+ // },
300
+
301
+ test: {
302
+ setupFiles: ['./test-setup.ts'],
303
+ globals: true,
304
+ cache: {
305
+ dir: '../../node_modules/.vitest',
306
+ },
307
+ environment: 'jsdom',
308
+ include: ['./app/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
309
+ },
310
+ });
311
+ "
312
+ `;
313
+
261
314
  exports[`Remix Application Integrated Repo should create the application correctly 1`] = `
262
315
  "/**
263
316
  * @type {import('@remix-run/dev').AppConfig}
@@ -429,6 +482,59 @@ exports[`Remix Application Standalone Project Repo --js should create the applic
429
482
  "
430
483
  `;
431
484
 
485
+ exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing 1`] = `
486
+ "/**
487
+ * @type {import('@remix-run/dev').AppConfig}
488
+ */
489
+ module.exports = {
490
+ ignoredRouteFiles: ['**/.*'],
491
+ // appDirectory: \\"app\\",
492
+ // assetsBuildDirectory: \\"public/build\\",
493
+ // serverBuildPath: \\"build/index.js\\",
494
+ // publicPath: \\"/build/\\",
495
+ watchPaths: () => require('@nx/remix').createWatchPaths(__dirname),
496
+ };
497
+ "
498
+ `;
499
+
500
+ exports[`Remix Application Standalone Project Repo --unitTestRunner should generate the correct files for testing 2`] = `
501
+ "/// <reference types=\\"vitest\\" />
502
+ import react from '@vitejs/plugin-react';
503
+ import { defineConfig } from 'vite';
504
+ import viteTsConfigPaths from 'vite-tsconfig-paths';
505
+
506
+ export default defineConfig({
507
+ cacheDir: './node_modules/.vite/test',
508
+
509
+ plugins: [
510
+ react(),
511
+ viteTsConfigPaths({
512
+ root: './',
513
+ }),
514
+ ],
515
+
516
+ // Uncomment this if you are using workers.
517
+ // worker: {
518
+ // plugins: [
519
+ // viteTsConfigPaths({
520
+ // root: './',
521
+ // }),
522
+ // ],
523
+ // },
524
+
525
+ test: {
526
+ setupFiles: ['./test-setup.ts'],
527
+ globals: true,
528
+ cache: {
529
+ dir: './node_modules/.vitest',
530
+ },
531
+ environment: 'jsdom',
532
+ include: ['./app/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
533
+ },
534
+ });
535
+ "
536
+ `;
537
+
432
538
  exports[`Remix Application Standalone Project Repo should create the application correctly 1`] = `
433
539
  "/**
434
540
  * @type {import('@remix-run/dev').AppConfig}
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
6
6
  const versions_1 = require("../../utils/versions");
7
+ const cypress_impl_1 = require("../cypress/cypress.impl");
7
8
  const lib_1 = require("./lib");
8
9
  function default_1(tree, _options) {
9
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -74,6 +75,19 @@ function default_1(tree, _options) {
74
75
  else {
75
76
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/integrated'), options.projectRoot, vars);
76
77
  }
78
+ if (options.unitTestRunner === 'vitest') {
79
+ const { vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', (0, versions_1.getPackageVersion)(tree, 'nx'));
80
+ const vitestTask = yield vitestGenerator(tree, {
81
+ uiFramework: 'react',
82
+ project: options.projectName,
83
+ coverageProvider: 'c8',
84
+ inSourceTests: false,
85
+ skipFormat: true,
86
+ });
87
+ const pkgInstallTask = (0, lib_1.updateViteTestConfig)(tree, options.projectRoot);
88
+ tasks.push(vitestTask);
89
+ tasks.push(pkgInstallTask);
90
+ }
77
91
  if (options.js) {
78
92
  (0, devkit_1.toJS)(tree);
79
93
  }
@@ -105,6 +119,13 @@ function default_1(tree, _options) {
105
119
  // Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
106
120
  (0, create_ts_config_1.extractTsConfigBase)(tree);
107
121
  }
122
+ if (options.e2eTestRunner === 'cypress') {
123
+ const cypressTasks = yield (0, cypress_impl_1.default)(tree, {
124
+ project: options.projectName,
125
+ name: options.rootProject ? `e2e` : `${options.projectName}-e2e`,
126
+ });
127
+ tasks.push(cypressTasks);
128
+ }
108
129
  if (!options.skipFormat) {
109
130
  yield (0, devkit_1.formatFiles)(tree);
110
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,uCAaoB;AACpB,mFAAmF;AACnF,mDAS8B;AAC9B,+BAAyC;AAGzC,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,UAAU,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;YACxB,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,OAAO,EAAE,aAAa;oBACtB,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,WAAW;oBACpB,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,KAAK,EAAE;oBACL,SAAS,EAAE,CAAC,OAAO,CAAC;oBACpB,OAAO,EAAE,mBAAmB;oBAC5B,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,SAAS,EAAE;oBACT,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;YACE,iBAAiB,EAA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oot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,uCAcoB;AACpB,mFAAmF;AACnF,mDAU8B;AAC9B,0DAAuD;AACvD,+BAA+D;AAG/D,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,UAAU,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;YACxB,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,OAAO,EAAE,aAAa;oBACtB,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,KAAK,EAAE;oBACL,OAAO,EAAE,WAAW;oBACpB,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,KAAK,EAAE;oBACL,SAAS,EAAE,CAAC,OAAO,CAAC;oBACpB,OAAO,EAAE,mBAAmB;oBAC5B,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;gBACD,SAAS,EAAE;oBACT,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE;wBACP,GAAG,EAAE,OAAO,CAAC,WAAW;qBACzB;iBACF;aACF;SACF,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;YACE,iBAAiB,EAAE,uBAAY;YAC/B,kBAAkB,EAAE,uBAAY;YAChC,kBAAkB,EAAE,uBAAY;YAChC,KAAK,EAAE,uBAAY;YACnB,KAAK,EAAE,uBAAY;YACnB,WAAW,EAAE,0BAAe;S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,CAAC,OAAO,mCAAI,EAAE,CAAC;iBACxB,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;SACnC;aAAM;YACL,yFAAyF;YACzF,IAAA,sCAAmB,EAAC,IAAI,CAAC,CAAC;SAC3B;QAED,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;YACvC,MAAM,YAAY,GAAG,MAAM,IAAA,sBAAgB,EAAC,IAAI,EAAE;gBAChD,OAAO,EAAE,OAAO,CAAC,WAAW;gBAC5B,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,MAAM;aACjE,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC1B;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAlKD,4BAkKC"}
@@ -1 +1,2 @@
1
1
  export * from './normalize-options';
2
+ export * from './update-vite-test-config';
@@ -2,4 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./normalize-options"), exports);
5
+ tslib_1.__exportStar(require("./update-vite-test-config"), exports);
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,oEAA0C"}
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function updateViteTestConfig(tree: Tree, pathToRoot: string): import("@nx/devkit").GeneratorCallback;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateViteTestConfig = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const testing_config_utils_1 = require("../../../utils/testing-config-utils");
6
+ const versions_1 = require("../../../utils/versions");
7
+ function updateViteTestConfig(tree, pathToRoot) {
8
+ const pathToViteConfig = (0, devkit_1.joinPathFragments)(pathToRoot, 'vite.config.ts');
9
+ const pathToTestSetup = (0, devkit_1.joinPathFragments)(pathToRoot, `test-setup.ts`);
10
+ tree.write(pathToTestSetup, (0, devkit_1.stripIndents) `
11
+ import { installGlobals } from '@remix-run/node';
12
+ import '@testing-library/jest-dom/extend-expect';
13
+ installGlobals();`);
14
+ (0, testing_config_utils_1.updateViteTestIncludes)(tree, pathToViteConfig, './app/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}');
15
+ (0, testing_config_utils_1.updateViteTestSetup)(tree, pathToViteConfig, './test-setup.ts');
16
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
17
+ '@testing-library/jest-dom': versions_1.testingLibraryJestDomVersion,
18
+ '@testing-library/react': versions_1.testingLibraryReactVersion,
19
+ '@testing-library/user-event': versions_1.testingLibraryUserEventsVersion,
20
+ });
21
+ }
22
+ exports.updateViteTestConfig = updateViteTestConfig;
23
+ //# sourceMappingURL=update-vite-test-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-vite-test-config.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/update-vite-test-config.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,8EAG6C;AAC7C,sDAIiC;AAEjC,SAAgB,oBAAoB,CAAC,IAAU,EAAE,UAAkB;IACjE,MAAM,gBAAgB,GAAG,IAAA,0BAAiB,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACzE,MAAM,eAAe,GAAG,IAAA,0BAAiB,EAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IACvE,IAAI,CAAC,KAAK,CACR,eAAe,EACf,IAAA,qBAAY,EAAA;;;oBAGI,CACjB,CAAC;IAEF,IAAA,6CAAsB,EACpB,IAAI,EACJ,gBAAgB,EAChB,wDAAwD,CACzD,CAAC;IACF,IAAA,0CAAmB,EAAC,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAE/D,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ,EAAE,EACF;QACE,2BAA2B,EAAE,uCAA4B;QACzD,wBAAwB,EAAE,qCAA0B;QACpD,6BAA6B,EAAE,0CAA+B;KAC/D,CACF,CAAC;AACJ,CAAC;AA3BD,oDA2BC"}
@@ -3,6 +3,8 @@ export interface NxRemixGeneratorSchema {
3
3
  tags?: string;
4
4
  js?: boolean;
5
5
  directory?: string;
6
+ unitTestRunner?: 'vitest' | 'none';
7
+ e2eTestRunner?: 'cypress' | 'none';
6
8
  skipFormat?: boolean;
7
9
  rootProject?: boolean;
8
10
  }
@@ -24,6 +24,19 @@
24
24
  "alias": "dir",
25
25
  "x-priority": "important"
26
26
  },
27
+ "unitTestRunner": {
28
+ "type": "string",
29
+ "enum": ["vitest", "none"],
30
+ "default": "vitest",
31
+ "description": "Test runner to use for unit tests.",
32
+ "x-prompt": "What unit test runner should be used?"
33
+ },
34
+ "e2eTestRunner": {
35
+ "type": "string",
36
+ "enum": ["cypress", "none"],
37
+ "default": "cypress",
38
+ "description": "Test runner to use for e2e tests"
39
+ },
27
40
  "tags": {
28
41
  "type": "string",
29
42
  "description": "Add tags to the project (used for linting)",
@@ -0,0 +1,49 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ErrorBoundary --apiVersion=1 should correctly add the ErrorBoundary to the route file 1`] = `
4
+ "export function ErrorBoundary({ error }) {
5
+ console.error(error);
6
+ return (
7
+ <div>
8
+ <h1>Uh oh ...</h1>
9
+ <p>Something went wrong</p>
10
+ <pre>{error.message || 'Unknown error'}</pre>
11
+ </div>
12
+ );
13
+ }
14
+ "
15
+ `;
16
+
17
+ exports[`ErrorBoundary --apiVersion=2 should correctly add the ErrorBoundary to the route file 1`] = `
18
+ "import { isRouteErrorResponse, useRouteError } from '@remix-run/react';
19
+ export function ErrorBoundary() {
20
+ const error = useRouteError();
21
+
22
+ // when true, this is what used to go to 'CatchBoundary'
23
+ if (isRouteErrorResponse(error)) {
24
+ return (
25
+ <div>
26
+ <h1>Oops</h1>
27
+ <p>Status: {error.status}</p>
28
+ <p>{error.data.message}</p>
29
+ </div>
30
+ );
31
+ }
32
+
33
+ // Don't forget to typecheck with your own logic.
34
+ // Any value can be thrown, not just errors!
35
+ let errorMessage = 'Unknown error';
36
+ // if (isDefinitelyAnError(error)) {
37
+ // errorMessage = error.message;
38
+ // }
39
+
40
+ return (
41
+ <div>
42
+ <h1>Uh oh ...</h1>
43
+ <p>Something went wrong.</p>
44
+ <pre>{errorMessage}</pre>
45
+ </div>
46
+ );
47
+ }
48
+ "
49
+ `;
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { ErrorBoundarySchema } from './schema';
3
+ export default function errorBoundaryGenerator(tree: Tree, schema: ErrorBoundarySchema): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const lib_1 = require("./lib");
6
+ function errorBoundaryGenerator(tree, schema) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ const options = (0, lib_1.normalizeOptions)(tree, schema);
9
+ if (options.apiVersion === 1) {
10
+ (0, lib_1.addV1ErrorBoundary)(tree, options);
11
+ }
12
+ else {
13
+ (0, lib_1.addV2ErrorBoundary)(tree, options);
14
+ }
15
+ if (!options.skipFormat) {
16
+ yield (0, devkit_1.formatFiles)(tree);
17
+ }
18
+ });
19
+ }
20
+ exports.default = errorBoundaryGenerator;
21
+ //# sourceMappingURL=error-boundary.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/error-boundary/error-boundary.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,+BAIe;AAGf,SAA8B,sBAAsB,CAClD,IAAU,EACV,MAA2B;;QAE3B,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,IAAI,OAAO,CAAC,UAAU,KAAK,CAAC,EAAE;YAC5B,IAAA,wBAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACnC;aAAM;YACL,IAAA,wBAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACnC;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AAfD,yCAeC"}
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { ErrorBoundarySchema } from '../schema';
3
+ export declare function addV1ErrorBoundary(tree: Tree, options: ErrorBoundarySchema): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addV1ErrorBoundary = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
6
+ function addV1ErrorBoundary(tree, options) {
7
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, options.path, (0, devkit_1.stripIndents) `
8
+ export function ErrorBoundary({ error }) {
9
+ console.error(error);
10
+ return (
11
+ <div>
12
+ <h1>Uh oh ...</h1>
13
+ <p>Something went wrong</p>
14
+ <pre>{error.message || "Unknown error"}</pre>
15
+ </div>
16
+ );
17
+ }
18
+ `);
19
+ }
20
+ exports.addV1ErrorBoundary = addV1ErrorBoundary;
21
+ //# sourceMappingURL=add-v1-error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-v1-error-boundary.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/error-boundary/lib/add-v1-error-boundary.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,kGAA4F;AAG5F,SAAgB,kBAAkB,CAAC,IAAU,EAAE,OAA4B;IACzE,IAAA,4DAA2B,EACzB,IAAI,EACJ,OAAO,CAAC,IAAI,EACZ,IAAA,qBAAY,EAAA;;;;;;;;;;;GAWb,CACA,CAAC;AACJ,CAAC;AAjBD,gDAiBC"}
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { ErrorBoundarySchema } from '../schema';
3
+ export declare function addV2ErrorBoundary(tree: Tree, options: ErrorBoundarySchema): void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addV2ErrorBoundary = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const insert_import_1 = require("../../../utils/insert-import");
6
+ const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
7
+ function addV2ErrorBoundary(tree, options) {
8
+ (0, insert_import_1.insertImport)(tree, options.path, `useRouteError`, '@remix-run/react');
9
+ (0, insert_import_1.insertImport)(tree, options.path, `isRouteErrorResponse`, '@remix-run/react');
10
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, options.path, (0, devkit_1.stripIndents) `
11
+ export function ErrorBoundary() {
12
+ const error = useRouteError();
13
+
14
+ // when true, this is what used to go to 'CatchBoundary'
15
+ if (isRouteErrorResponse(error)) {
16
+ return (
17
+ <div>
18
+ <h1>Oops</h1>
19
+ <p>Status: {error.status}</p>
20
+ <p>{error.data.message}</p>
21
+ </div>
22
+ );
23
+ }
24
+
25
+ // Don't forget to typecheck with your own logic.
26
+ // Any value can be thrown, not just errors!
27
+ let errorMessage = "Unknown error";
28
+ // if (isDefinitelyAnError(error)) {
29
+ // errorMessage = error.message;
30
+ // }
31
+
32
+ return (
33
+ <div>
34
+ <h1>Uh oh ...</h1>
35
+ <p>Something went wrong.</p>
36
+ <pre>{errorMessage}</pre>
37
+ </div>
38
+ );
39
+ }
40
+ `);
41
+ }
42
+ exports.addV2ErrorBoundary = addV2ErrorBoundary;
43
+ //# sourceMappingURL=add-v2-error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-v2-error-boundary.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/error-boundary/lib/add-v2-error-boundary.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,gEAA4D;AAC5D,kGAA4F;AAG5F,SAAgB,kBAAkB,CAAC,IAAU,EAAE,OAA4B;IACzE,IAAA,4BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;IACtE,IAAA,4BAAY,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;IAE7E,IAAA,4DAA2B,EACzB,IAAI,EACJ,OAAO,CAAC,IAAI,EACZ,IAAA,qBAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8Bb,CACA,CAAC;AACJ,CAAC;AAvCD,gDAuCC"}
@@ -0,0 +1,3 @@
1
+ export * from './add-v1-error-boundary';
2
+ export * from './add-v2-error-boundary';
3
+ export * from './normalize-options';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./add-v1-error-boundary"), exports);
5
+ tslib_1.__exportStar(require("./add-v2-error-boundary"), exports);
6
+ tslib_1.__exportStar(require("./normalize-options"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/error-boundary/lib/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,kEAAwC;AACxC,8DAAoC"}
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { ErrorBoundarySchema } from '../schema';
3
+ export declare function normalizeOptions(tree: Tree, schema: ErrorBoundarySchema): ErrorBoundarySchema;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = void 0;
4
+ const remix_route_utils_1 = require("../../../utils/remix-route-utils");
5
+ function normalizeOptions(tree, schema) {
6
+ const pathToRouteFile = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
7
+ if (!tree.exists(pathToRouteFile)) {
8
+ throw new Error(`Route file specified does not exist "${pathToRouteFile}". Please ensure you pass a correct path to the file, relative to the project root.`);
9
+ }
10
+ return Object.assign(Object.assign({}, schema), { path: pathToRouteFile });
11
+ }
12
+ exports.normalizeOptions = normalizeOptions;
13
+ //# sourceMappingURL=normalize-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/error-boundary/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,wEAAyE;AAGzE,SAAgB,gBAAgB,CAC9B,IAAU,EACV,MAA2B;IAE3B,MAAM,eAAe,GAAG,IAAA,yCAAqB,EAC3C,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,wCAAwC,eAAe,qFAAqF,CAC7I,CAAC;KACH;IAED,uCACK,MAAM,KACT,IAAI,EAAE,eAAe,IACrB;AACJ,CAAC;AApBD,4CAoBC"}
@@ -0,0 +1,6 @@
1
+ export interface ErrorBoundarySchema {
2
+ project: string;
3
+ path: string;
4
+ apiVersion: number;
5
+ skipFormat?: false;
6
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixErrorBoundary",
4
+ "title": "Create an ErrorBoundary for a Route",
5
+ "type": "object",
6
+ "examples": [
7
+ {
8
+ "command": "g error-boundary --project=myapp --routePath=app/routes/my-route.tsx",
9
+ "description": "Generate an ErrorBoundary for my-route.tsx"
10
+ }
11
+ ],
12
+ "properties": {
13
+ "project": {
14
+ "type": "string",
15
+ "description": "The name of the project.",
16
+ "$default": {
17
+ "$source": "projectName"
18
+ },
19
+ "x-prompt": "What project contains the route file that this ErrorBoundary is for?",
20
+ "pattern": "^[a-zA-Z].*$"
21
+ },
22
+ "path": {
23
+ "type": "string",
24
+ "description": "The path to route file relative to the project root."
25
+ },
26
+ "apiVersion": {
27
+ "type": "number",
28
+ "description": "Which version of the ErrorBoundary convention to use for the route.",
29
+ "default": 1
30
+ },
31
+ "skipFormat": {
32
+ "type": "boolean",
33
+ "description": "Skip formatting files after generation.",
34
+ "default": false,
35
+ "x-priority": "internal"
36
+ }
37
+ },
38
+ "required": ["project", "path"]
39
+ }
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { RemixLibraryOptions } from './normalize-options';
3
+ export declare function addUnitTestingSetup(tree: Tree, options: RemixLibraryOptions): import("@nx/devkit").GeneratorCallback;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addUnitTestingSetup = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const testing_config_utils_1 = require("../../../utils/testing-config-utils");
6
+ const versions_1 = require("../../../utils/versions");
7
+ function addUnitTestingSetup(tree, options) {
8
+ const { root: projectRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
9
+ const pathToTestSetup = (0, devkit_1.joinPathFragments)(projectRoot, 'src/test-setup.ts');
10
+ let testSetupFileContents = '';
11
+ if (tree.exists(pathToTestSetup)) {
12
+ testSetupFileContents = tree.read(pathToTestSetup, 'utf-8');
13
+ }
14
+ tree.write(pathToTestSetup, (0, devkit_1.stripIndents) `${testSetupFileContents}
15
+ import { installGlobals } from '@remix-run/node';
16
+ import "@testing-library/jest-dom/extend-expect";
17
+ installGlobals();`);
18
+ if (options.unitTestRunner === 'vitest') {
19
+ const pathToVitestConfig = (0, devkit_1.joinPathFragments)(projectRoot, `vite.config.ts`);
20
+ (0, testing_config_utils_1.updateViteTestSetup)(tree, pathToVitestConfig, './src/test-setup.ts');
21
+ }
22
+ else if (options.unitTestRunner === 'jest') {
23
+ const pathToJestConfig = (0, devkit_1.joinPathFragments)(projectRoot, `jest.config.ts`);
24
+ (0, testing_config_utils_1.updateJestTestSetup)(tree, pathToJestConfig, './src/test-setup.ts');
25
+ }
26
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
27
+ '@testing-library/jest-dom': versions_1.testingLibraryJestDomVersion,
28
+ '@testing-library/react': versions_1.testingLibraryReactVersion,
29
+ '@testing-library/user-event': versions_1.testingLibraryUserEventsVersion,
30
+ });
31
+ }
32
+ exports.addUnitTestingSetup = addUnitTestingSetup;
33
+ //# sourceMappingURL=add-unit-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-unit-testing.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/library/lib/add-unit-testing.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AACpB,8EAG6C;AAC7C,sDAIiC;AAGjC,SAAgB,mBAAmB,CAAC,IAAU,EAAE,OAA4B;IAC1E,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EACpD,IAAI,EACJ,OAAO,CAAC,WAAW,CACpB,CAAC;IACF,MAAM,eAAe,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAC5E,IAAI,qBAAqB,GAAG,EAAE,CAAC;IAE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