Skip to content

Commit be40420

Browse files
committed
fix(remix): update setup-tailwind generator to correct import statements:
closes: #30343
1 parent 6e50a01 commit be40420

File tree

6 files changed

+8
-128
lines changed

6 files changed

+8
-128
lines changed

docs/generated/packages/remix/generators/setup-tailwind.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"type": "string",
1919
"description": "The name of the project to add tailwind to",
2020
"$default": { "$source": "projectName" },
21-
"x-prompt": "What project would you like to add Tailwind to?",
22-
"pattern": "^[a-zA-Z].*$"
21+
"x-prompt": "What project would you like to add Tailwind to?"
2322
},
2423
"skipFormat": {
2524
"type": "boolean",

packages/remix/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ exports[`setup-tailwind generator should add a tailwind config to an application
4343
ScrollRestoration,
4444
} from '@remix-run/react';
4545
import type { MetaFunction, LinksFunction } from '@remix-run/node';
46-
import twStyles from './tailwind.css';
46+
import from './tailwind.css';
4747
4848
export const meta: MetaFunction = () => [
4949
{
@@ -52,7 +52,6 @@ export const meta: MetaFunction = () => [
5252
];
5353
5454
export const links: LinksFunction = () => [
55-
{ rel: 'stylesheet', href: twStyles },
5655
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
5756
{
5857
rel: 'preconnect',

packages/remix/src/generators/setup-tailwind/schema.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"$default": {
1818
"$source": "projectName"
1919
},
20-
"x-prompt": "What project would you like to add Tailwind to?",
21-
"pattern": "^[a-zA-Z].*$"
20+
"x-prompt": "What project would you like to add Tailwind to?"
2221
},
2322
"skipFormat": {
2423
"type": "boolean",

packages/remix/src/generators/setup-tailwind/setup-tailwind.impl.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,34 @@ import {
55
installPackagesTask,
66
joinPathFragments,
77
readProjectConfiguration,
8+
stripIndents,
89
type Tree,
910
} from '@nx/devkit';
1011

11-
import { upsertLinksFunction } from '../../utils/upsert-links-function';
1212
import {
1313
autoprefixerVersion,
1414
postcssVersion,
1515
tailwindVersion,
1616
} from '../../utils/versions';
1717
import type { SetupTailwindSchema } from './schema';
18+
import { insertStatementAfterImports } from '../../utils/insert-statement-after-imports';
1819

1920
export default async function setupTailwind(
2021
tree: Tree,
2122
options: SetupTailwindSchema
2223
) {
2324
const project = readProjectConfiguration(tree, options.project);
24-
if (project.projectType !== 'application') {
25-
throw new Error(
26-
`Project "${options.project}" is not an application. Please ensure the project is an application.`
27-
);
28-
}
2925

3026
generateFiles(tree, joinPathFragments(__dirname, 'files'), project.root, {
3127
tpl: '',
3228
});
3329

3430
const pathToRoot = joinPathFragments(project.root, 'app/root.tsx');
35-
upsertLinksFunction(
31+
32+
insertStatementAfterImports(
3633
tree,
3734
pathToRoot,
38-
'twStyles',
39-
'./tailwind.css',
40-
`{ rel: "stylesheet", href: twStyles }`
35+
stripIndents`import from './tailwind.css';`
4136
);
4237

4338
addDependenciesToPackageJson(

packages/remix/src/utils/upsert-links-function.spec.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

packages/remix/src/utils/upsert-links-function.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)