@nx/remix 20.0.10 → 20.1.0-beta.1

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 (39) hide show
  1. package/migrations.json +29 -0
  2. package/package.json +7 -5
  3. package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +126 -343
  4. package/src/generators/application/application.impl.js +10 -48
  5. package/src/generators/application/files/common/app/entry.client.tsx__tmpl__ +18 -0
  6. package/src/generators/application/files/common/app/entry.server.tsx__tmpl__ +140 -0
  7. package/src/generators/application/files/common/app/root.tsx__tmpl__ +20 -5
  8. package/src/generators/application/files/common/tsconfig.app.json__tmpl__ +5 -2
  9. package/src/generators/application/files/common/tsconfig.json__tmpl__ +6 -3
  10. package/src/generators/application/files/common/vite.config.ts__tmpl__ +25 -0
  11. package/src/generators/application/files/integrated/package.json__tmpl__ +3 -4
  12. package/src/generators/application/lib/add-e2e.js +1 -1
  13. package/src/generators/application/lib/add-vite-temp-files-to-gitignore.d.ts +2 -0
  14. package/src/generators/application/lib/add-vite-temp-files-to-gitignore.js +18 -0
  15. package/src/generators/application/lib/index.d.ts +1 -0
  16. package/src/generators/application/lib/index.js +1 -0
  17. package/src/generators/application/schema.d.ts +0 -1
  18. package/src/generators/application/schema.json +0 -5
  19. package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -1
  20. package/src/generators/preset/lib/normalize-options.d.ts +0 -1
  21. package/src/generators/preset/preset.impl.js +0 -1
  22. package/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap +32 -112
  23. package/src/generators/setup-tailwind/files/postcss.config.js__tpl__ +6 -0
  24. package/src/generators/setup-tailwind/schema.d.ts +0 -1
  25. package/src/generators/setup-tailwind/schema.json +0 -5
  26. package/src/generators/setup-tailwind/setup-tailwind.impl.js +2 -8
  27. package/src/generators/utils/update-dependencies.js +2 -0
  28. package/src/plugins/plugin.js +5 -3
  29. package/src/utils/remix-config.d.ts +1 -0
  30. package/src/utils/remix-config.js +37 -6
  31. package/src/utils/remix-route-utils.js +4 -1
  32. package/src/utils/versions.d.ts +4 -1
  33. package/src/utils/versions.js +5 -2
  34. package/src/generators/application/files/common/remix.config.js__tmpl__ +0 -17
  35. package/src/generators/application/files/common/remix.env.d.ts__tmpl__ +0 -2
  36. package/src/generators/setup-tailwind/lib/index.d.ts +0 -1
  37. package/src/generators/setup-tailwind/lib/index.js +0 -4
  38. package/src/generators/setup-tailwind/lib/update-remix-config.d.ts +0 -2
  39. package/src/generators/setup-tailwind/lib/update-remix-config.js +0 -34
@@ -1,86 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
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 twStyles from './tailwind.css';
35
- export const links = () => [{ rel: 'stylesheet', href: twStyles }];
36
- export const meta = () => [
37
- {
38
- title: 'New Remix App',
39
- },
40
- ];
41
- export default function App() {
42
- return (
43
- <html lang="en">
44
- <head>
45
- <meta charSet="utf-8" />
46
- <meta name="viewport" content="width=device-width, initial-scale=1" />
47
- <Meta />
48
- <Links />
49
- </head>
50
- <body>
51
- <Outlet />
52
- <ScrollRestoration />
53
- <Scripts />
54
- <LiveReload />
55
- </body>
56
- </html>
57
- );
58
- }
59
- "
60
- `;
61
-
62
- exports[`setup-tailwind generator should add a js tailwind config to an application correctly 4`] = `
63
- "import { createWatchPaths } from '@nx/remix';
64
- import { dirname } from 'path';
65
- import { fileURLToPath } from 'url';
66
-
67
- const __dirname = dirname(fileURLToPath(import.meta.url));
68
-
69
- /**
70
- * @type {import('@remix-run/dev').AppConfig}
71
- */
72
- export default {
73
- tailwind: true,
74
- ignoredRouteFiles: ['**/.*'],
75
- // appDirectory: "app",
76
- // assetsBuildDirectory: "public/build",
77
- // serverBuildPath: "build/index.js",
78
- // publicPath: "/build/",
79
- watchPaths: () => createWatchPaths(__dirname),
80
- };
81
- "
82
- `;
83
-
84
3
  exports[`setup-tailwind generator should add a tailwind config to an application correctly 1`] = `
85
4
  "import type { Config } from 'tailwindcss';
86
5
  import { createGlobPatternsForDependencies } from '@nx/react/tailwind';
@@ -99,26 +18,32 @@ export default {
99
18
  `;
100
19
 
101
20
  exports[`setup-tailwind generator should add a tailwind config to an application correctly 2`] = `
21
+ "export default {
22
+ plugins: {
23
+ tailwindcss: {},
24
+ autoprefixer: {},
25
+ },
26
+ };
27
+ "
28
+ `;
29
+
30
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 3`] = `
102
31
  "@tailwind base;
103
32
  @tailwind components;
104
33
  @tailwind utilities;
105
34
  "
106
35
  `;
107
36
 
108
- exports[`setup-tailwind generator should add a tailwind config to an application correctly 3`] = `
109
- "import type { MetaFunction, LinksFunction } from '@remix-run/node';
110
- import {
37
+ exports[`setup-tailwind generator should add a tailwind config to an application correctly 4`] = `
38
+ "import {
111
39
  Links,
112
- LiveReload,
113
40
  Meta,
114
41
  Outlet,
115
42
  Scripts,
116
43
  ScrollRestoration,
117
44
  } from '@remix-run/react';
45
+ import type { MetaFunction, LinksFunction } from '@remix-run/node';
118
46
  import twStyles from './tailwind.css';
119
- export const links: LinksFunction = () => [
120
- { rel: 'stylesheet', href: twStyles },
121
- ];
122
47
 
123
48
  export const meta: MetaFunction = () => [
124
49
  {
@@ -126,7 +51,21 @@ export const meta: MetaFunction = () => [
126
51
  },
127
52
  ];
128
53
 
129
- export default function App() {
54
+ export const links: LinksFunction = () => [
55
+ { rel: 'stylesheet', href: twStyles },
56
+ { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
57
+ {
58
+ rel: 'preconnect',
59
+ href: 'https://fonts.gstatic.com',
60
+ crossOrigin: 'anonymous',
61
+ },
62
+ {
63
+ rel: 'stylesheet',
64
+ href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
65
+ },
66
+ ];
67
+
68
+ export function Layout({ children }: { children: React.ReactNode }) {
130
69
  return (
131
70
  <html lang="en">
132
71
  <head>
@@ -136,35 +75,16 @@ export default function App() {
136
75
  <Links />
137
76
  </head>
138
77
  <body>
139
- <Outlet />
78
+ {children}
140
79
  <ScrollRestoration />
141
80
  <Scripts />
142
- <LiveReload />
143
81
  </body>
144
82
  </html>
145
83
  );
146
84
  }
147
- "
148
- `;
149
-
150
- exports[`setup-tailwind generator should add a tailwind config to an application correctly 4`] = `
151
- "import { createWatchPaths } from '@nx/remix';
152
- import { dirname } from 'path';
153
- import { fileURLToPath } from 'url';
154
85
 
155
- const __dirname = dirname(fileURLToPath(import.meta.url));
156
-
157
- /**
158
- * @type {import('@remix-run/dev').AppConfig}
159
- */
160
- export default {
161
- tailwind: true,
162
- ignoredRouteFiles: ['**/.*'],
163
- // appDirectory: "app",
164
- // assetsBuildDirectory: "public/build",
165
- // serverBuildPath: "build/index.js",
166
- // publicPath: "/build/",
167
- watchPaths: () => createWatchPaths(__dirname),
168
- };
86
+ export default function App() {
87
+ return <Outlet />;
88
+ }
169
89
  "
170
90
  `;
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -1,5 +1,4 @@
1
1
  export interface SetupTailwindSchema {
2
2
  project: string;
3
- js?: boolean;
4
3
  skipFormat?: boolean;
5
4
  }
@@ -20,11 +20,6 @@
20
20
  "x-prompt": "What project would you like to add Tailwind to?",
21
21
  "pattern": "^[a-zA-Z].*$"
22
22
  },
23
- "js": {
24
- "type": "boolean",
25
- "description": "Generate a JavaScript config file instead of a TypeScript config file",
26
- "default": false
27
- },
28
23
  "skipFormat": {
29
24
  "type": "boolean",
30
25
  "description": "Skip formatting files after generator runs",
@@ -4,27 +4,21 @@ exports.default = setupTailwind;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const upsert_links_function_1 = require("../../utils/upsert-links-function");
6
6
  const versions_1 = require("../../utils/versions");
7
- const lib_1 = require("./lib");
8
7
  async function setupTailwind(tree, options) {
9
8
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
10
9
  if (project.projectType !== 'application') {
11
10
  throw new Error(`Project "${options.project}" is not an application. Please ensure the project is an application.`);
12
11
  }
13
- (0, lib_1.updateRemixConfig)(tree, project.root);
14
12
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), project.root, {
15
13
  tpl: '',
16
14
  });
17
- if (options.js) {
18
- tree.rename((0, devkit_1.joinPathFragments)(project.root, 'app/root.js'), (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx'));
19
- }
20
15
  const pathToRoot = (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx');
21
16
  (0, upsert_links_function_1.upsertLinksFunction)(tree, pathToRoot, 'twStyles', './tailwind.css', `{ rel: "stylesheet", href: twStyles }`);
22
17
  (0, devkit_1.addDependenciesToPackageJson)(tree, {
23
18
  tailwindcss: versions_1.tailwindVersion,
19
+ postcss: versions_1.postcssVersion,
20
+ autoprefixer: versions_1.autoprefixerVersion,
24
21
  }, {});
25
- if (options.js) {
26
- (0, devkit_1.toJS)(tree);
27
- }
28
22
  if (!options.skipFormat) {
29
23
  await (0, devkit_1.formatFiles)(tree);
30
24
  }
@@ -15,5 +15,7 @@ function updateDependencies(tree) {
15
15
  '@types/react-dom': versions_1.typesReactDomVersion,
16
16
  eslint: versions_1.eslintVersion,
17
17
  typescript: versions_1.typescriptVersion,
18
+ vite: versions_1.viteVersion,
19
+ '@nx/vite': versions_1.nxVersion,
18
20
  });
19
21
  }
@@ -180,13 +180,15 @@ async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCo
180
180
  // do nothing
181
181
  }
182
182
  const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
183
- const viteBuildConfig = await resolveConfig({
183
+ const viteBuildConfig = (await resolveConfig({
184
184
  configFile: configPath,
185
185
  mode: 'development',
186
- }, 'build');
186
+ }, 'build'));
187
187
  return {
188
188
  buildDirectory: viteBuildConfig.build?.outDir ?? 'build',
189
- serverBuildPath: viteBuildConfig.build?.outDir ?? 'build',
189
+ serverBuildPath: viteBuildConfig.build?.outDir
190
+ ? (0, path_1.join)((0, path_1.dirname)(viteBuildConfig.build?.outDir), `server/${viteBuildConfig.__remixPluginContext?.remixConfig.serverBuildFile}`)
191
+ : 'build',
190
192
  assetsBuildDirectory: 'build/client',
191
193
  };
192
194
  }
@@ -1,5 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import type { AppConfig } from '@remix-run/dev';
3
+ export declare function getRemixConfigPathDetails(tree: Tree, projectName: string): string[];
3
4
  export declare function getRemixConfigPath(tree: Tree, projectName: string): string;
4
5
  export declare function getRemixConfigPathFromProjectRoot(tree: Tree, projectRoot: string): string;
5
6
  export declare function getRemixConfigValues(tree: Tree, projectName: string): Promise<AppConfig>;
@@ -1,9 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemixConfigPathDetails = getRemixConfigPathDetails;
3
4
  exports.getRemixConfigPath = getRemixConfigPath;
4
5
  exports.getRemixConfigPathFromProjectRoot = getRemixConfigPathFromProjectRoot;
5
6
  exports.getRemixConfigValues = getRemixConfigValues;
6
7
  const devkit_1 = require("@nx/devkit");
8
+ const executor_utils_1 = require("./executor-utils");
9
+ function getRemixConfigPathDetails(tree, projectName) {
10
+ const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
11
+ if (!project)
12
+ throw new Error(`Project does not exist: ${projectName}`);
13
+ for (const ext of ['.mjs', '.cjs', '.js', '.mts', '.cts', '.ts']) {
14
+ const configPath = (0, devkit_1.joinPathFragments)(project.root, `vite.config${ext}`);
15
+ if (tree.exists(configPath)) {
16
+ return [configPath, 'vite'];
17
+ }
18
+ }
19
+ for (const ext of ['.mjs', '.cjs', '.js']) {
20
+ const configPath = (0, devkit_1.joinPathFragments)(project.root, `remix.config${ext}`);
21
+ if (tree.exists(configPath)) {
22
+ return [configPath, 'classic'];
23
+ }
24
+ }
25
+ }
7
26
  function getRemixConfigPath(tree, projectName) {
8
27
  const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
9
28
  if (!project)
@@ -27,16 +46,28 @@ function getRemixConfigPathFromProjectRoot(tree, projectRoot) {
27
46
  }
28
47
  const _remixConfigCache = {};
29
48
  async function getRemixConfigValues(tree, projectName) {
30
- const remixConfigPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, getRemixConfigPath(tree, projectName));
49
+ const [configPath, configType] = getRemixConfigPathDetails(tree, projectName);
50
+ const remixConfigPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, configPath);
31
51
  const cacheKey = `${projectName}/${remixConfigPath}`;
32
52
  let appConfig = _remixConfigCache[cacheKey];
53
+ let resolvedConfig;
33
54
  if (!appConfig) {
34
- try {
35
- const importedConfig = await Function(`return import("${remixConfigPath}?t=${Date.now()}")`)();
36
- appConfig = (importedConfig?.default || importedConfig);
55
+ if (configType === 'vite') {
56
+ const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
57
+ const viteBuildConfig = (await resolveConfig({
58
+ configFile: configPath,
59
+ mode: 'development',
60
+ }, 'build'));
61
+ appConfig = viteBuildConfig.__remixPluginContext?.remixConfig;
37
62
  }
38
- catch {
39
- appConfig = require(remixConfigPath);
63
+ else {
64
+ try {
65
+ const importedConfig = await Function(`return import("${remixConfigPath}?t=${Date.now()}")`)();
66
+ appConfig = (importedConfig?.default || importedConfig);
67
+ }
68
+ catch {
69
+ appConfig = require(remixConfigPath);
70
+ }
40
71
  }
41
72
  _remixConfigCache[cacheKey] = appConfig;
42
73
  }
@@ -6,6 +6,7 @@ exports.checkRoutePathForErrors = checkRoutePathForErrors;
6
6
  exports.resolveRemixAppDirectory = resolveRemixAppDirectory;
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const remix_config_1 = require("./remix-config");
9
+ const path_1 = require("path");
9
10
  /**
10
11
  *
11
12
  * @param tree
@@ -65,5 +66,7 @@ function checkRoutePathForErrors(path) {
65
66
  async function resolveRemixAppDirectory(tree, projectName) {
66
67
  const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
67
68
  const remixConfig = await (0, remix_config_1.getRemixConfigValues)(tree, projectName);
68
- return (0, devkit_1.joinPathFragments)(project.root, remixConfig.appDirectory ?? 'app');
69
+ return (0, devkit_1.joinPathFragments)(project.root, remixConfig.appDirectory
70
+ ? (0, path_1.relative)(project.root, remixConfig.appDirectory)
71
+ : 'app');
69
72
  }
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export declare const nxVersion: any;
3
- export declare const remixVersion = "^2.8.1";
3
+ export declare const remixVersion = "^2.13.1";
4
4
  export declare const isbotVersion = "^4.4.0";
5
5
  export declare const reactVersion = "^18.2.0";
6
6
  export declare const reactDomVersion = "^18.2.0";
@@ -9,8 +9,11 @@ export declare const typesReactDomVersion = "^18.2.0";
9
9
  export declare const eslintVersion = "^8.56.0";
10
10
  export declare const typescriptVersion = "~5.5.2";
11
11
  export declare const tailwindVersion = "^3.3.0";
12
+ export declare const postcssVersion = "^8.4.38";
13
+ export declare const autoprefixerVersion = "^10.4.19";
12
14
  export declare const testingLibraryReactVersion = "^14.1.2";
13
15
  export declare const testingLibraryJestDomVersion = "6.4.2";
14
16
  export declare const testingLibraryUserEventsVersion = "^14.5.2";
17
+ export declare const viteVersion = "^5.0.0";
15
18
  export declare function getRemixVersion(tree: Tree): string;
16
19
  export declare function getPackageVersion(tree: Tree, packageName: string): any;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.testingLibraryUserEventsVersion = exports.testingLibraryJestDomVersion = exports.testingLibraryReactVersion = exports.tailwindVersion = exports.typescriptVersion = exports.eslintVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactDomVersion = exports.reactVersion = exports.isbotVersion = exports.remixVersion = exports.nxVersion = void 0;
3
+ exports.viteVersion = exports.testingLibraryUserEventsVersion = exports.testingLibraryJestDomVersion = exports.testingLibraryReactVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptVersion = exports.eslintVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactDomVersion = exports.reactVersion = exports.isbotVersion = exports.remixVersion = exports.nxVersion = void 0;
4
4
  exports.getRemixVersion = getRemixVersion;
5
5
  exports.getPackageVersion = getPackageVersion;
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  exports.nxVersion = require('../../package.json').version;
8
- exports.remixVersion = '^2.8.1';
8
+ exports.remixVersion = '^2.13.1';
9
9
  exports.isbotVersion = '^4.4.0';
10
10
  exports.reactVersion = '^18.2.0';
11
11
  exports.reactDomVersion = '^18.2.0';
@@ -14,10 +14,13 @@ exports.typesReactDomVersion = '^18.2.0';
14
14
  exports.eslintVersion = '^8.56.0';
15
15
  exports.typescriptVersion = '~5.5.2';
16
16
  exports.tailwindVersion = '^3.3.0';
17
+ exports.postcssVersion = '^8.4.38';
18
+ exports.autoprefixerVersion = '^10.4.19';
17
19
  exports.testingLibraryReactVersion = '^14.1.2';
18
20
  // TODO(colum): Unpin this when @testing-library/jest-dom pushes a fix
19
21
  exports.testingLibraryJestDomVersion = '6.4.2';
20
22
  exports.testingLibraryUserEventsVersion = '^14.5.2';
23
+ exports.viteVersion = '^5.0.0';
21
24
  function getRemixVersion(tree) {
22
25
  return getPackageVersion(tree, '@remix-run/dev') ?? exports.remixVersion;
23
26
  }
@@ -1,17 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- /// <reference types="@remix-run/dev" />
2
- /// <reference types="@remix-run/node" />
@@ -1 +0,0 @@
1
- export * from './update-remix-config';
@@ -1,4 +0,0 @@
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);
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function updateRemixConfig(tree: Tree, projectRoot: string): void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateRemixConfig = updateRemixConfig;
4
- const tsquery_1 = require("@phenomnomnominal/tsquery");
5
- const remix_config_1 = require("../../../utils/remix-config");
6
- function updateRemixConfig(tree, projectRoot) {
7
- const pathToRemixConfig = (0, remix_config_1.getRemixConfigPathFromProjectRoot)(tree, projectRoot);
8
- const fileContents = tree.read(pathToRemixConfig, 'utf-8');
9
- const REMIX_CONFIG_OBJECT_SELECTOR = 'ObjectLiteralExpression';
10
- const ast = tsquery_1.tsquery.ast(fileContents);
11
- const nodes = (0, tsquery_1.tsquery)(ast, REMIX_CONFIG_OBJECT_SELECTOR, {
12
- visitAllChildren: true,
13
- });
14
- if (nodes.length === 0) {
15
- throw new Error(`Remix Config is not valid, unable to update the file.`);
16
- }
17
- const configObjectNode = nodes[0];
18
- const propertyNodes = (0, tsquery_1.tsquery)(configObjectNode, 'PropertyAssignment', {
19
- visitAllChildren: true,
20
- });
21
- for (const propertyNode of propertyNodes) {
22
- const nodeText = propertyNode.getText();
23
- if (nodeText.includes('tailwind') && nodeText.includes('true')) {
24
- return;
25
- }
26
- else if (nodeText.includes('tailwind') && nodeText.includes('false')) {
27
- const updatedFileContents = `${fileContents.slice(0, propertyNode.getStart())}tailwind: true${fileContents.slice(propertyNode.getEnd())}`;
28
- tree.write(pathToRemixConfig, updatedFileContents);
29
- return;
30
- }
31
- }
32
- const updatedFileContents = `${fileContents.slice(0, configObjectNode.getStart() + 1)}\ntailwind: true,${fileContents.slice(configObjectNode.getStart() + 1)}`;
33
- tree.write(pathToRemixConfig, updatedFileContents);
34
- }