@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
@@ -1,3 +1,4 @@
1
1
  export * from './add-tsconfig-entry-points';
2
+ export * from './add-unit-testing';
2
3
  export * from './normalize-options';
3
4
  export * from './update-buildable-config';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./add-tsconfig-entry-points"), exports);
5
+ tslib_1.__exportStar(require("./add-unit-testing"), exports);
5
6
  tslib_1.__exportStar(require("./normalize-options"), exports);
6
7
  tslib_1.__exportStar(require("./update-buildable-config"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/library/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,8DAAoC;AACpC,oEAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/library/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,6DAAmC;AACnC,8DAAoC;AACpC,oEAA0C"}
@@ -5,14 +5,14 @@ const devkit_1 = require("@nx/devkit");
5
5
  const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
6
6
  const project_1 = require("../../../utils/project");
7
7
  function normalizeOptions(tree, options) {
8
- var _a;
8
+ var _a, _b;
9
9
  const name = (0, devkit_1.names)(options.name).fileName;
10
10
  const { projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
11
11
  const fullProjectDirectory = (0, project_1.normalizeDirectory)(name, projectDirectory);
12
12
  const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
13
13
  const importPath = (_a = options.importPath) !== null && _a !== void 0 ? _a : (0, get_import_path_1.getImportPath)(tree, fullProjectDirectory);
14
14
  const projectName = (0, project_1.normalizeProjectName)(name, projectDirectory);
15
- return Object.assign(Object.assign({}, options), { name,
15
+ return Object.assign(Object.assign({}, options), { unitTestRunner: (_b = options.unitTestRunner) !== null && _b !== void 0 ? _b : 'vitest', name,
16
16
  importPath,
17
17
  projectName });
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,uCAA+E;AAC/E,sEAAiE;AACjE,oDAGgC;AAOhC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAE1C,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,oBAAoB,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAE9C,MAAM,UAAU,GACd,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAA,+BAAa,EAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAElE,MAAM,WAAW,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAEjE,uCACK,OAAO,KACV,IAAI;QACJ,UAAU;QACV,WAAW,IACX;AACJ,CAAC;AArBD,4CAqBC"}
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,uCAA+E;AAC/E,sEAAiE;AACjE,oDAGgC;AAOhC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAE1C,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,MAAM,oBAAoB,GAAG,IAAA,4BAAkB,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAE9C,MAAM,UAAU,GACd,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAA,+BAAa,EAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAElE,MAAM,WAAW,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAEjE,uCACK,OAAO,KACV,cAAc,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,QAAQ,EAClD,IAAI;QACJ,UAAU;QACV,WAAW,IACX;AACJ,CAAC;AAtBD,4CAsBC"}
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const linter_1 = require("@nx/linter");
6
- const library_1 = require("@nx/react/src/generators/library/library");
6
+ const react_1 = require("@nx/react");
7
7
  const lib_1 = require("./lib");
8
8
  function default_1(tree, schema) {
9
9
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
10
  const tasks = [];
11
11
  const options = (0, lib_1.normalizeOptions)(tree, schema);
12
- const libGenTask = yield (0, library_1.libraryGenerator)(tree, {
12
+ const libGenTask = yield (0, react_1.libraryGenerator)(tree, {
13
13
  name: options.name,
14
14
  style: options.style,
15
- unitTestRunner: 'jest',
15
+ unitTestRunner: options.unitTestRunner,
16
16
  tags: options.tags,
17
17
  importPath: options.importPath,
18
18
  directory: options.directory,
@@ -23,6 +23,10 @@ function default_1(tree, schema) {
23
23
  buildable: options.buildable,
24
24
  });
25
25
  tasks.push(libGenTask);
26
+ if (options.unitTestRunner && options.unitTestRunner !== 'none') {
27
+ const pkgInstallTask = (0, lib_1.addUnitTestingSetup)(tree, options);
28
+ tasks.push(pkgInstallTask);
29
+ }
26
30
  (0, lib_1.addTsconfigEntryPoints)(tree, options);
27
31
  if (options.buildable) {
28
32
  (0, lib_1.updateBuildableConfig)(tree, options.projectName);
@@ -1 +1 @@
1
- {"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AACA,uCAA8E;AAC9E,uCAAoC;AACpC,sEAA4E;AAC5E,+BAIe;AAGf,mBAA+B,IAAU,EAAE,MAA8B;;QACvE,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAgB,EAAC,IAAI,EAAE;YAC9C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,eAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,IAAA,4BAAsB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEtC,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,IAAA,2BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;SAClD;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;AA9BD,4BA8BC"}
1
+ {"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AACA,uCAA8E;AAC9E,uCAAoC;AACpC,qCAA6C;AAC7C,+BAKe;AAGf,mBAA+B,IAAU,EAAE,MAA8B;;QACvE,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,UAAU,GAAG,MAAM,IAAA,wBAAgB,EAAC,IAAI,EAAE;YAC9C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,eAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,IAAI,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;YAC/D,MAAM,cAAc,GAAG,IAAA,yBAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC5B;QAED,IAAA,4BAAsB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEtC,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,IAAA,2BAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;SAClD;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;AAnCD,4BAmCC"}
@@ -7,6 +7,7 @@ export interface NxRemixGeneratorSchema {
7
7
  tags?: string;
8
8
  importPath?: string;
9
9
  buildable?: boolean;
10
+ unitTestRunner?: 'jest' | 'vitest' | 'none';
10
11
  js?: boolean;
11
12
  skipFormat?: boolean;
12
13
  }
@@ -33,10 +33,7 @@
33
33
  "style": {
34
34
  "type": "string",
35
35
  "description": "Generate a stylesheet",
36
- "enum": [
37
- "none",
38
- "css"
39
- ],
36
+ "enum": ["none", "css"],
40
37
  "default": "css"
41
38
  },
42
39
  "buildable": {
@@ -44,6 +41,13 @@
44
41
  "description": "Should the library be buildable?",
45
42
  "default": false
46
43
  },
44
+ "unitTestRunner": {
45
+ "type": "string",
46
+ "enum": ["jest", "vitest", "none"],
47
+ "description": "Test Runner to use for Unit Tests",
48
+ "x-prompt": "What test runner should be used?",
49
+ "default": "vitest"
50
+ },
47
51
  "importPath": {
48
52
  "type": "string",
49
53
  "description": "The library name used to import it, like @myorg/my-awesome-lib"
@@ -60,7 +64,5 @@
60
64
  "x-priority": "internal"
61
65
  }
62
66
  },
63
- "required": [
64
- "name"
65
- ]
67
+ "required": ["name"]
66
68
  }
@@ -0,0 +1,42 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`route should add route component 1`] = `
4
+ "import type {
5
+ ActionArgs,
6
+ LinksFunction,
7
+ LoaderArgs,
8
+ MetaFunction,
9
+ } from '@remix-run/node';
10
+ import { json } from '@remix-run/node';
11
+ import { useActionData, useLoaderData } from '@remix-run/react';
12
+
13
+ import stylesUrl from '../../../styles/path/to/example.css';
14
+
15
+ export const links: LinksFunction = () => {
16
+ return [{ rel: 'stylesheet', href: stylesUrl }];
17
+ };
18
+
19
+ export const action = async ({ request }: ActionArgs) => {
20
+ let formData = await request.formData();
21
+
22
+ return json({ message: formData.toString() }, { status: 200 });
23
+ };
24
+
25
+ export const meta: MetaFunction = () => {
26
+ return { title: 'PathToExample Route' };
27
+ };
28
+
29
+ export const loader = async ({ request }: LoaderArgs) => {
30
+ return json({
31
+ message: 'Hello, world!',
32
+ });
33
+ };
34
+
35
+ export default function PathToExample() {
36
+ const actionMessage = useActionData<typeof action>();
37
+ const data = useLoaderData<typeof loader>();
38
+
39
+ return <p>Message: {data.message}</p>;
40
+ }
41
+ "
42
+ `;
@@ -0,0 +1,152 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`setup-tailwind generator should add a js tailwind config to an application correctly 1`] = `
4
+ "import { createGlobPatternsForDependencies } from '@nx/react/tailwind';
5
+ export default {
6
+ content: [
7
+ './app/**/*.{js,jsx,ts,tsx}',
8
+ ...createGlobPatternsForDependencies(__dirname),
9
+ ],
10
+ theme: {
11
+ extend: {},
12
+ },
13
+ plugins: [],
14
+ };
15
+ "
16
+ `;
17
+
18
+ exports[`setup-tailwind generator should add a js tailwind config to an application correctly 2`] = `
19
+ "@tailwind base;
20
+ @tailwind components;
21
+ @tailwind utilities;
22
+ "
23
+ `;
24
+
25
+ exports[`setup-tailwind generator should add a js tailwind config to an application correctly 3`] = `
26
+ "import {
27
+ Links,
28
+ LiveReload,
29
+ Meta,
30
+ Outlet,
31
+ Scripts,
32
+ ScrollRestoration,
33
+ } from '@remix-run/react';
34
+ import styles from './tailwind.css';
35
+ export const links = () => [{ rel: 'stylesheet', href: styles }];
36
+ export const meta = () => ({
37
+ charset: 'utf-8',
38
+ title: 'New Remix App',
39
+ viewport: 'width=device-width,initial-scale=1',
40
+ });
41
+ export default function App() {
42
+ return (
43
+ <html lang=\\"en\\">
44
+ <head>
45
+ <Meta />
46
+ <Links />
47
+ </head>
48
+ <body>
49
+ <Outlet />
50
+ <ScrollRestoration />
51
+ <Scripts />
52
+ <LiveReload />
53
+ </body>
54
+ </html>
55
+ );
56
+ }
57
+ "
58
+ `;
59
+
60
+ exports[`setup-tailwind generator should add a js tailwind config to an application correctly 4`] = `
61
+ "/**
62
+ * @type {import('@remix-run/dev').AppConfig}
63
+ */
64
+ module.exports = {
65
+ tailwind: true,
66
+ ignoredRouteFiles: ['**/.*'],
67
+ // appDirectory: \\"app\\",
68
+ // assetsBuildDirectory: \\"public/build\\",
69
+ // serverBuildPath: \\"build/index.js\\",
70
+ // publicPath: \\"/build/\\",
71
+ watchPaths: () => require('@nx/remix').createWatchPaths(__dirname),
72
+ };
73
+ "
74
+ `;
75
+
76
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 1`] = `
77
+ "import type { Config } from \\"tailwindcss\\";
78
+ import { createGlobPatternsForDependencies } from '@nx/react/tailwind';
79
+
80
+ export default {
81
+ content: [
82
+ \\"./app/**/*.{js,jsx,ts,tsx}\\",
83
+ ...createGlobPatternsForDependencies(__dirname)
84
+ ],
85
+ theme: {
86
+ extend: {},
87
+ },
88
+ plugins: [],
89
+ } satisfies Config;
90
+ "
91
+ `;
92
+
93
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 2`] = `
94
+ "@tailwind base;
95
+ @tailwind components;
96
+ @tailwind utilities;
97
+ "
98
+ `;
99
+
100
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 3`] = `
101
+ "import type { LinksFunction, MetaFunction } from '@remix-run/node';
102
+ import {
103
+ Links,
104
+ LiveReload,
105
+ Meta,
106
+ Outlet,
107
+ Scripts,
108
+ ScrollRestoration,
109
+ } from '@remix-run/react';
110
+ import styles from './tailwind.css';
111
+ export const links: LinksFunction = () => [{ rel: 'stylesheet', href: styles }];
112
+
113
+ export const meta: MetaFunction = () => ({
114
+ charset: 'utf-8',
115
+ title: 'New Remix App',
116
+ viewport: 'width=device-width,initial-scale=1',
117
+ });
118
+
119
+ export default function App() {
120
+ return (
121
+ <html lang=\\"en\\">
122
+ <head>
123
+ <Meta />
124
+ <Links />
125
+ </head>
126
+ <body>
127
+ <Outlet />
128
+ <ScrollRestoration />
129
+ <Scripts />
130
+ <LiveReload />
131
+ </body>
132
+ </html>
133
+ );
134
+ }
135
+ "
136
+ `;
137
+
138
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 4`] = `
139
+ "/**
140
+ * @type {import('@remix-run/dev').AppConfig}
141
+ */
142
+ module.exports = {
143
+ tailwind: true,
144
+ ignoredRouteFiles: ['**/.*'],
145
+ // appDirectory: \\"app\\",
146
+ // assetsBuildDirectory: \\"public/build\\",
147
+ // serverBuildPath: \\"build/index.js\\",
148
+ // publicPath: \\"/build/\\",
149
+ watchPaths: () => require('@nx/remix').createWatchPaths(__dirname),
150
+ };
151
+ "
152
+ `;
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,13 @@
1
+ import type { Config } from "tailwindcss";
2
+ import { createGlobPatternsForDependencies } from '@nx/react/tailwind';
3
+
4
+ export default {
5
+ content: [
6
+ "./app/**/*.{js,jsx,ts,tsx}",
7
+ ...createGlobPatternsForDependencies(__dirname)
8
+ ],
9
+ theme: {
10
+ extend: {},
11
+ },
12
+ plugins: [],
13
+ } satisfies Config;
@@ -0,0 +1 @@
1
+ export * from './update-remix-config';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./update-remix-config"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/setup-tailwind/lib/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC"}
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function updateRemixConfig(tree: Tree, projectRoot: string): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateRemixConfig = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ function updateRemixConfig(tree, projectRoot) {
7
+ const pathToRemixConfig = (0, devkit_1.joinPathFragments)(projectRoot, 'remix.config.js');
8
+ if (!tree.exists(pathToRemixConfig)) {
9
+ throw new Error(`Could not find "${pathToRemixConfig}". Please ensure a "remix.config.js" exists at the root of your project.`);
10
+ }
11
+ const fileContents = tree.read(pathToRemixConfig, 'utf-8');
12
+ const REMIX_CONFIG_OBJECT_SELECTOR = 'PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports])~ObjectLiteralExpression';
13
+ const ast = tsquery_1.tsquery.ast(fileContents);
14
+ const nodes = (0, tsquery_1.tsquery)(ast, REMIX_CONFIG_OBJECT_SELECTOR, {
15
+ visitAllChildren: true,
16
+ });
17
+ if (nodes.length === 0) {
18
+ throw new Error(`Remix Config is not valid, unable to update the file.`);
19
+ }
20
+ const configObjectNode = nodes[0];
21
+ const propertyNodes = (0, tsquery_1.tsquery)(configObjectNode, 'PropertyAssignment', {
22
+ visitAllChildren: true,
23
+ });
24
+ for (const propertyNode of propertyNodes) {
25
+ const nodeText = propertyNode.getText();
26
+ if (nodeText.includes('tailwind') && nodeText.includes('true')) {
27
+ return;
28
+ }
29
+ else if (nodeText.includes('tailwind') && nodeText.includes('false')) {
30
+ const updatedFileContents = `${fileContents.slice(0, propertyNode.getStart())}tailwind: true${fileContents.slice(propertyNode.getEnd())}`;
31
+ tree.write(pathToRemixConfig, updatedFileContents);
32
+ return;
33
+ }
34
+ }
35
+ const updatedFileContents = `${fileContents.slice(0, configObjectNode.getStart() + 1)}\ntailwind: true,${fileContents.slice(configObjectNode.getStart() + 1)}`;
36
+ tree.write(pathToRemixConfig, updatedFileContents);
37
+ }
38
+ exports.updateRemixConfig = updateRemixConfig;
39
+ //# sourceMappingURL=update-remix-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-remix-config.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/setup-tailwind/lib/update-remix-config.ts"],"names":[],"mappings":";;;AAAA,uCAA0D;AAC1D,uDAAoD;AAEpD,SAAgB,iBAAiB,CAAC,IAAU,EAAE,WAAmB;IAC/D,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IAE5E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CACb,mBAAmB,iBAAiB,0EAA0E,CAC/G,CAAC;KACH;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAE3D,MAAM,4BAA4B,GAChC,yGAAyG,CAAC;IAC5G,MAAM,GAAG,GAAG,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEtC,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,4BAA4B,EAAE;QACvD,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KAC1E;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAElC,MAAM,aAAa,GAAG,IAAA,iBAAO,EAAC,gBAAgB,EAAE,oBAAoB,EAAE;QACpE,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IAEH,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;QACxC,IAAI,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC9D,OAAO;SACR;aAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACtE,MAAM,mBAAmB,GAAG,GAAG,YAAY,CAAC,KAAK,CAC/C,CAAC,EACD,YAAY,CAAC,QAAQ,EAAE,CACxB,iBAAiB,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;YACnD,OAAO;SACR;KACF;IAED,MAAM,mBAAmB,GAAG,GAAG,YAAY,CAAC,KAAK,CAC/C,CAAC,EACD,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAChC,oBAAoB,YAAY,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAE3E,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAhDD,8CAgDC"}
@@ -0,0 +1,5 @@
1
+ export interface SetupTailwindSchema {
2
+ project: string;
3
+ js?: boolean;
4
+ skipFormat?: boolean;
5
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixTailwind",
4
+ "title": "Add TailwindCSS to a Remix App",
5
+ "type": "object",
6
+ "examples": [
7
+ {
8
+ "command": "g setup-tailwind --project=myapp",
9
+ "description": "Generate a TailwindCSS config for your Remix app"
10
+ }
11
+ ],
12
+ "properties": {
13
+ "project": {
14
+ "type": "string",
15
+ "description": "The name of the project to add tailwind to",
16
+ "$default": {
17
+ "$source": "projectName"
18
+ },
19
+ "x-prompt": "What project would you like to add Tailwind to?",
20
+ "pattern": "^[a-zA-Z].*$"
21
+ },
22
+ "js": {
23
+ "type": "boolean",
24
+ "description": "Generate a JavaScript config file instead of a TypeScript config file",
25
+ "default": false
26
+ },
27
+ "skipFormat": {
28
+ "type": "boolean",
29
+ "description": "Skip formatting files after generator runs",
30
+ "default": false,
31
+ "x-priority": "internal"
32
+ }
33
+ },
34
+ "required": ["project"]
35
+ }
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { SetupTailwindSchema } from './schema';
3
+ export default function setupTailwind(tree: Tree, options: SetupTailwindSchema): Promise<() => void>;
@@ -0,0 +1,38 @@
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 upsert_links_function_1 = require("../../utils/upsert-links-function");
6
+ const versions_1 = require("../../utils/versions");
7
+ const lib_1 = require("./lib");
8
+ function setupTailwind(tree, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
11
+ if (project.projectType !== 'application') {
12
+ throw new Error(`Project "${options.project}" is not an application. Please ensure the project is an application.`);
13
+ }
14
+ (0, lib_1.updateRemixConfig)(tree, project.root);
15
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), project.root, {
16
+ tpl: '',
17
+ });
18
+ if (options.js) {
19
+ tree.rename((0, devkit_1.joinPathFragments)(project.root, 'app/root.js'), (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx'));
20
+ }
21
+ const pathToRoot = (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx');
22
+ (0, upsert_links_function_1.upsertLinksFunction)(tree, pathToRoot, 'styles', './tailwind.css', `{ rel: "stylesheet", href: styles }`);
23
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {
24
+ tailwindcss: versions_1.tailwindVersion,
25
+ }, {});
26
+ if (options.js) {
27
+ (0, devkit_1.toJS)(tree);
28
+ }
29
+ if (!options.skipFormat) {
30
+ yield (0, devkit_1.formatFiles)(tree);
31
+ }
32
+ return () => {
33
+ (0, devkit_1.installPackagesTask)(tree);
34
+ };
35
+ });
36
+ }
37
+ exports.default = setupTailwind;
38
+ //# sourceMappingURL=setup-tailwind.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-tailwind.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/setup-tailwind/setup-tailwind.impl.ts"],"names":[],"mappings":";;;AAAA,uCASoB;AAEpB,6EAAwE;AACxE,mDAAuD;AACvD,+BAA0C;AAG1C,SAA8B,aAAa,CACzC,IAAU,EACV,OAA4B;;QAE5B,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE;YACzC,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,CAAC,OAAO,uEAAuE,CACnG,CAAC;SACH;QAED,IAAA,uBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE;YACvE,GAAG,EAAE,EAAE;SACR,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,EAAE,EAAE;YACd,IAAI,CAAC,MAAM,CACT,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,EAC9C,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAChD,CAAC;SACH;QACD,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnE,IAAA,2CAAmB,EACjB,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,qCAAqC,CACtC,CAAC;QAEF,IAAA,qCAA4B,EAC1B,IAAI,EACJ;YACE,WAAW,EAAE,0BAAe;SAC7B,EACD,EAAE,CACH,CAAC;QAEF,IAAI,OAAO,CAAC,EAAE,EAAE;YACd,IAAA,aAAI,EAAC,IAAI,CAAC,CAAC;SACZ;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AAnDD,gCAmDC"}
@@ -0,0 +1,4 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function updateViteTestSetup(tree: Tree, pathToViteConfig: string, pathToTestSetup: string): void;
3
+ export declare function updateJestTestSetup(tree: Tree, pathToJestConfig: string, pathToTestSetup: string): void;
4
+ export declare function updateViteTestIncludes(tree: Tree, pathToViteConfig: string, includesString: string): void;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateViteTestIncludes = exports.updateJestTestSetup = exports.updateViteTestSetup = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ function updateViteTestSetup(tree, pathToViteConfig, pathToTestSetup) {
7
+ const fileContents = tree.read(pathToViteConfig, 'utf-8');
8
+ const ast = tsquery_1.tsquery.ast(fileContents);
9
+ const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=setupFiles])';
10
+ const nodes = (0, tsquery_1.tsquery)(ast, TEST_SETUPFILES_SELECTOR, {
11
+ visitAllChildren: true,
12
+ });
13
+ if (nodes.length === 0) {
14
+ const TEST_CONFIG_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) > ObjectLiteralExpression';
15
+ const testConfigNodes = (0, tsquery_1.tsquery)(ast, TEST_CONFIG_SELECTOR, {
16
+ visitAllChildren: true,
17
+ });
18
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, testConfigNodes[0].getStart() + 1)}setupFiles: ['${pathToTestSetup}'],${fileContents.slice(testConfigNodes[0].getStart() + 1)}`;
19
+ tree.write(pathToViteConfig, updatedFileContents);
20
+ }
21
+ else {
22
+ const arrayNodes = (0, tsquery_1.tsquery)(nodes[0], 'ArrayLiteralExpression', {
23
+ visitAllChildren: true,
24
+ });
25
+ if (arrayNodes.length !== 0) {
26
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
27
+ tree.write(pathToViteConfig, updatedFileContents);
28
+ }
29
+ }
30
+ }
31
+ exports.updateViteTestSetup = updateViteTestSetup;
32
+ function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
33
+ const fileContents = tree.read(pathToJestConfig, 'utf-8');
34
+ const ast = tsquery_1.tsquery.ast(fileContents);
35
+ const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=setupFilesAfterEnv])';
36
+ const nodes = (0, tsquery_1.tsquery)(ast, TEST_SETUPFILES_SELECTOR, {
37
+ visitAllChildren: true,
38
+ });
39
+ if (nodes.length === 0) {
40
+ const CONFIG_SELECTOR = 'ObjectLiteralExpression';
41
+ const nodes = (0, tsquery_1.tsquery)(ast, CONFIG_SELECTOR, { visitAllChildren: true });
42
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart() + 1)}setupFilesAfterEnv: ['${pathToTestSetup}'],${fileContents.slice(nodes[0].getStart() + 1)}`;
43
+ tree.write(pathToJestConfig, updatedFileContents);
44
+ }
45
+ else {
46
+ const arrayNodes = (0, tsquery_1.tsquery)(nodes[0], 'ArrayLiteralExpression', {
47
+ visitAllChildren: true,
48
+ });
49
+ if (arrayNodes.length !== 0) {
50
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
51
+ tree.write(pathToJestConfig, updatedFileContents);
52
+ }
53
+ }
54
+ }
55
+ exports.updateJestTestSetup = updateJestTestSetup;
56
+ function updateViteTestIncludes(tree, pathToViteConfig, includesString) {
57
+ const fileContents = tree.read(pathToViteConfig, 'utf-8');
58
+ const ast = tsquery_1.tsquery.ast(fileContents);
59
+ const TEST_INCLUDE_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=include])';
60
+ const nodes = (0, tsquery_1.tsquery)(ast, TEST_INCLUDE_SELECTOR, { visitAllChildren: true });
61
+ if (nodes.length !== 0) {
62
+ const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}include: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
63
+ tree.write(pathToViteConfig, updatedFileContents);
64
+ }
65
+ }
66
+ exports.updateViteTestIncludes = updateViteTestIncludes;
67
+ //# sourceMappingURL=testing-config-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing-config-utils.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/testing-config-utils.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare function upsertLinksFunction(tree: Tree, filePath: string, importName: string, importPath: string, linkObject: string): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upsertLinksFunction = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ const insert_import_1 = require("./insert-import");
7
+ const insert_statement_after_imports_1 = require("./insert-statement-after-imports");
8
+ function upsertLinksFunction(tree, filePath, importName, importPath, linkObject) {
9
+ (0, insert_import_1.insertImport)(tree, filePath, 'LinksFunction', '@remix-run/node', {
10
+ typeOnly: true,
11
+ });
12
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, filePath, (0, devkit_1.stripIndents) `import ${importName} from "${importPath}";`);
13
+ const fileContents = tree.read(filePath, 'utf-8');
14
+ const LINKS_FUNCTION_SELECTOR = 'VariableDeclaration:has(TypeReference > Identifier[name=LinksFunction])';
15
+ const ast = tsquery_1.tsquery.ast(fileContents);
16
+ const linksFunctionNodes = (0, tsquery_1.tsquery)(ast, LINKS_FUNCTION_SELECTOR, {
17
+ visitAllChildren: true,
18
+ });
19
+ if (linksFunctionNodes.length === 0) {
20
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, filePath, (0, devkit_1.stripIndents) `export const links: LinksFunction = () => [
21
+ ${linkObject},
22
+ ];`);
23
+ }
24
+ else {
25
+ const linksArrayNodes = (0, tsquery_1.tsquery)(linksFunctionNodes[0], 'ArrayLiteralExpression', { visitAllChildren: true });
26
+ const arrayNode = linksArrayNodes[0];
27
+ const updatedFileContents = `${fileContents.slice(0, arrayNode.getStart() + 1)}\n${linkObject},${fileContents.slice(arrayNode.getStart() + 1)}`;
28
+ tree.write(filePath, updatedFileContents);
29
+ }
30
+ }
31
+ exports.upsertLinksFunction = upsertLinksFunction;
32
+ //# sourceMappingURL=upsert-links-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsert-links-function.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/upsert-links-function.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,uDAAoD;AACpD,mDAA+C;AAC/C,qFAA+E;AAE/E,SAAgB,mBAAmB,CACjC,IAAU,EACV,QAAgB,EAChB,UAAkB,EAClB,UAAkB,EAClB,UAAkB;IAElB,IAAA,4BAAY,EAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE;QAC/D,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,IAAA,4DAA2B,EACzB,IAAI,EACJ,QAAQ,EACR,IAAA,qBAAY,EAAA,UAAU,UAAU,UAAU,UAAU,IAAI,CACzD,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,MAAM,uBAAuB,GAC3B,yEAAyE,CAAC;IAC5E,MAAM,GAAG,GAAG,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEtC,MAAM,kBAAkB,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,uBAAuB,EAAE;QAC/D,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,IAAA,4DAA2B,EACzB,IAAI,EACJ,QAAQ,EACR,IAAA,qBAAY,EAAA;IACd,UAAU;GACX,CACE,CAAC;KACH;SAAM;QACL,MAAM,eAAe,GAAG,IAAA,iBAAO,EAC7B,kBAAkB,CAAC,CAAC,CAAC,EACrB,wBAAwB,EACxB,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;QACF,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,mBAAmB,GAAG,GAAG,YAAY,CAAC,KAAK,CAC/C,CAAC,EACD,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CACzB,KAAK,UAAU,IAAI,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;KAC3C;AACH,CAAC;AA7CD,kDA6CC"}
@@ -1,11 +1,15 @@
1
1
  import { Tree } from '@nx/devkit';
2
- export declare const remixVersion = "^1.15.0";
3
- export declare const isbotVersion = "^3.6.5";
2
+ export declare const remixVersion = "^1.16.1";
3
+ export declare const isbotVersion = "^3.6.8";
4
4
  export declare const reactVersion = "^18.2.0";
5
5
  export declare const reactDomVersion = "^18.2.0";
6
6
  export declare const typesReactVersion = "^18.0.25";
7
7
  export declare const typesReactDomVersion = "^18.0.8";
8
8
  export declare const eslintVersion = "^8.27.0";
9
9
  export declare const typescriptVersion = "^4.8.4";
10
+ export declare const tailwindVersion = "^3.3.0";
11
+ export declare const testingLibraryReactVersion = "^14.0.0";
12
+ export declare const testingLibraryJestDomVersion = "^5.16.5";
13
+ export declare const testingLibraryUserEventsVersion = "^14.4.3";
10
14
  export declare function getRemixVersion(tree: Tree): string;
11
15
  export declare function getPackageVersion(tree: Tree, packageName: string): any;