Skip to content

Commit f1dfb97

Browse files
committed
chore(misc): migrate tailwind v3 to v4
graph apps and nx-dev pin tailwindcss 3.4.4 with JS configs and v3 directives. tailwindcss 4.1.11 via @tailwindcss/postcss. Configs converted to CSS via @import 'tailwindcss', @plugin, @source, @custom-variant. JS tailwind.config.js files removed. Drops @tailwindcss/aspect-ratio (built-in). NXC-4430
1 parent ba0c07d commit f1dfb97

50 files changed

Lines changed: 388 additions & 699 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

graph/client/postcss.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module.exports = {
2-
plugins: [
3-
require('tailwindcss')({ config: './tailwind.config.js' }),
4-
require('autoprefixer'),
5-
],
2+
plugins: [require('@tailwindcss/postcss'), require('autoprefixer')],
63
};

graph/client/src/styles.css

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,49 @@
22
@import './syntax-highlight.css';
33
/*! purgecss end ignore */
44

5-
@tailwind components;
6-
@tailwind base;
7-
@tailwind utilities;
5+
@import 'tailwindcss';
6+
7+
@plugin '@tailwindcss/typography';
8+
@plugin '@tailwindcss/forms' {
9+
strategy: class;
10+
}
11+
12+
@custom-variant dark (&:where(.dark, .dark *));
13+
14+
@source '../src';
15+
@source '../../ui-code-block/src';
16+
@source '../../ui-common/src';
17+
@source '../../ui-icons/src';
18+
@source '../../ui-project-details/src';
19+
@source '../../ui-render-config/src';
20+
@source '../../shared/src';
21+
@source '../../../node_modules/@nx/graph';
22+
23+
@source not '../../**/*.{spec,test,stories}.*';
24+
@source not '../../**/eslint.config.*';
25+
26+
/* v3 compat: default border color was gray-200, v4 is currentColor. */
27+
@layer base {
28+
*,
29+
::after,
30+
::before,
31+
::backdrop,
32+
::file-selector-button {
33+
border-color: var(--color-gray-200, currentColor);
34+
}
35+
}
36+
37+
/* Strip default quote characters around inline code and blockquote. */
38+
.prose :where(code):not(:where([class~='not-prose'] *))::before,
39+
.prose :where(code):not(:where([class~='not-prose'] *))::after,
40+
.prose
41+
:where(blockquote p:first-of-type):not(
42+
:where([class~='not-prose'] *)
43+
)::before,
44+
.prose
45+
:where(blockquote p:last-of-type):not(:where([class~='not-prose'] *))::after {
46+
content: '';
47+
}
848

949
/** Scrollbars **/
1050
.dark {

graph/client/tailwind.config.js

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

graph/migrate/.storybook/tailwind.css

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1-
@tailwind components;
2-
@tailwind base;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
3+
@source '../src';
4+
@source '../../ui-code-block/src';
5+
@source '../../ui-common/src';
6+
@source '../../ui-icons/src';
7+
@source '../../ui-project-details/src';
8+
@source '../../ui-render-config/src';
9+
@source '../../shared/src';
10+
11+
@source not '../../**/*.spec.*';
12+
@source not '../../**/eslint.config.*';
13+
14+
/* v3 compat: default border color was gray-200, v4 is currentColor. */
15+
@layer base {
16+
*,
17+
::after,
18+
::before,
19+
::backdrop,
20+
::file-selector-button {
21+
border-color: var(--color-gray-200, currentColor);
22+
}
23+
}
424

525
@keyframes fadeIn {
626
from {

graph/migrate/postcss.config.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
const { join } = require('path');
2-
3-
// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
4-
// option from your application's configuration (i.e. project.json).
5-
//
6-
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries
7-
81
module.exports = {
92
plugins: {
10-
tailwindcss: {
11-
config: join(__dirname, 'tailwind.config.js'),
12-
},
3+
'@tailwindcss/postcss': {},
134
autoprefixer: {},
145
},
156
};

graph/migrate/src/lib/components/migration-card.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export const MigrationCard = forwardRef<
245245
)}
246246
{onRunMigration && !isStopped && (
247247
<span
248-
className={`rounded-md p-1 text-sm ring-1 ring-inset transition-colors ${
248+
className={`rounded-md p-1 text-sm ring-1 transition-colors ring-inset ${
249249
isSucceeded
250250
? 'bg-green-50 text-green-700 ring-green-200 hover:bg-green-100 dark:bg-green-900/20 dark:text-green-500 dark:ring-green-900/30 dark:hover:bg-green-900/30'
251251
: isFailed
@@ -295,14 +295,14 @@ export const MigrationCard = forwardRef<
295295
<div className="mt-4 flex justify-end gap-2">
296296
<button
297297
onClick={() => onViewImplementation()}
298-
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
298+
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-xs transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
299299
>
300300
<CodeBracketIcon className="h-4 w-4" />
301301
View Source
302302
</button>
303303
{isFailed && (
304304
<button
305-
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
305+
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-xs transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
306306
onClick={() => {
307307
setIsExpanded(!isExpanded);
308308
}}
@@ -313,7 +313,7 @@ export const MigrationCard = forwardRef<
313313
)}
314314
{isSucceeded && hasChanges && (
315315
<button
316-
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
316+
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-xs transition-colors hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
317317
onClick={() => {
318318
setIsExpanded(!isExpanded);
319319
}}

graph/migrate/src/lib/components/migration-done.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function MigrationDone({
6262
animate={{ opacity: 1 }}
6363
transition={{ delay: 0.8 }}
6464
onClick={onCancel}
65-
className="flex w-full items-center rounded-md border border-slate-300 bg-white px-6 py-3 text-sm font-medium text-slate-700 shadow-sm transition-colors hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
65+
className="flex w-full items-center rounded-md border border-slate-300 bg-white px-6 py-3 text-sm font-medium text-slate-700 shadow-xs transition-colors hover:bg-slate-50 focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 focus:outline-none dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
6666
>
6767
Cancel
6868
</motion.button>
@@ -79,7 +79,7 @@ export function MigrationDone({
7979
? PrimaryAction.FinishSquashingCommits
8080
: PrimaryAction.FinishWithoutSquashingCommits
8181
}
82-
className="whitespace-nowrap rounded-l-md border border-blue-700 bg-blue-500 px-6 py-3 text-sm font-medium text-white shadow-sm hover:bg-blue-600 dark:border-blue-700 dark:bg-blue-600 dark:text-white hover:dark:bg-blue-700"
82+
className="rounded-l-md border border-blue-700 bg-blue-500 px-6 py-3 text-sm font-medium whitespace-nowrap text-white shadow-xs hover:bg-blue-600 dark:border-blue-700 dark:bg-blue-600 dark:text-white hover:dark:bg-blue-700"
8383
>
8484
{squashCommits
8585
? PrimaryAction.FinishSquashingCommits
@@ -93,7 +93,7 @@ export function MigrationDone({
9393
transition={{ delay: 0.8 }}
9494
type="button"
9595
onClick={() => setIsOpen((prev) => !prev)}
96-
className="border-l-1 flex items-center rounded-r-md border border-blue-700 bg-blue-500 px-2 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 dark:border-blue-700 dark:bg-blue-700 dark:text-white hover:dark:bg-blue-800"
96+
className="flex items-center rounded-r-md border border-l-1 border-blue-700 bg-blue-500 px-2 py-2 text-sm font-medium text-white shadow-xs hover:bg-blue-700 dark:border-blue-700 dark:bg-blue-700 dark:text-white hover:dark:bg-blue-800"
9797
>
9898
<ChevronDownIcon className="h-4 w-4" />
9999
</motion.button>

graph/migrate/src/lib/components/migration-list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function MigrationList(props: {
131131
</label>
132132
{anySelected && (
133133
<button
134-
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-2 py-0.5 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
134+
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-2 py-0.5 text-sm font-medium text-slate-700 shadow-xs hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
135135
onClick={handleRunMany}
136136
>
137137
<PlayIcon className="h-5 w-5"></PlayIcon>
@@ -140,7 +140,7 @@ export function MigrationList(props: {
140140
)}
141141
{numberFailed > 0 && (
142142
<button
143-
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-2 py-0.5 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
143+
className="flex items-center gap-2 rounded-md border border-slate-300 bg-white px-2 py-0.5 text-sm font-medium text-slate-700 shadow-xs hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
144144
onClick={handleRerunFailed}
145145
>
146146
<PlayIcon className="h-5 w-5"></PlayIcon>

graph/migrate/src/lib/components/migration-settings-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function MigrationSettingsPanel({
2121
<button
2222
type="button"
2323
onClick={() => setIsOpen((prev) => !prev)}
24-
className="flex w-full items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
24+
className="flex w-full items-center rounded-md border border-slate-300 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-xs hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-300 hover:dark:bg-slate-700"
2525
>
2626
Settings
2727
</button>

0 commit comments

Comments
 (0)