chore: Bump vite and vitest (#34664)

* Set overrides for vite/esbuild packages, they're not used in production, low risk of something breaking.

* Bump vitest.

* Remove lodash.template from design-system.

* Forgot to run pnpm.
This commit is contained in:
Ivan Vasilov authored and GitHub committed 2025-04-03 12:43:28 +02:00
1 parent 0f0b02e0d9
commit 6d077a3e28
10 files changed
+72 -1015

No files matched your search

-1
View File
@@ -21,7 +21,6 @@
"eslint-config-supabase": "workspace:*",
"icons": "workspace:*",
"jotai": "^2.8.0",
"lodash.template": "4.5.0",
"lucide-react": "*",
"markdown-wasm": "^1.2.0",
"next": "catalog:",
+3 -302
View File
@@ -1,17 +1,14 @@
// @sts-nocheck
import { existsSync, promises as fs, readFileSync } from 'fs'
import { existsSync, promises as fs } from 'fs'
import { tmpdir } from 'os'
import path, { basename } from 'path'
import path from 'path'
import { cwd } from 'process'
import template from 'lodash.template'
import { rimraf } from 'rimraf'
import { Project, ScriptKind, SourceFile, SyntaxKind } from 'ts-morph'
import { Project, ScriptKind, SyntaxKind } from 'ts-morph'
import { colorMapping, colors } from '../registry/colors'
import { registry } from '../registry/registry'
import { Registry, registrySchema } from '../registry/schema'
import { styles } from '../registry/styles'
import { themes } from '../registry/themes'
const REGISTRY_PATH = path.join(process.cwd(), 'public/registry')
@@ -311,302 +308,6 @@ export const Index: Record<string, any> = {
// }
// }
// ----------------------------------------------------------------------------
// Build registry/styles/index.json.
// ----------------------------------------------------------------------------
// const stylesJson = JSON.stringify(styles, null, 2)
// await fs.writeFile(path.join(REGISTRY_PATH, 'styles/index.json'), stylesJson, 'utf8')
// }
// ----------------------------------------------------------------------------
// Build registry/colors/index.json.
// ----------------------------------------------------------------------------
async function buildThemes() {
const colorsTargetPath = path.join(REGISTRY_PATH, 'colors')
rimraf.sync(colorsTargetPath)
if (!existsSync(colorsTargetPath)) {
await fs.mkdir(colorsTargetPath, { recursive: true })
}
const colorsData: Record<string, any> = {}
for (const [color, value] of Object.entries(colors)) {
if (typeof value === 'string') {
colorsData[color] = value
continue
}
if (Array.isArray(value)) {
colorsData[color] = value.map((item) => ({
...item,
rgbChannel: item.rgb.replace(/^rgb\((\d+),(\d+),(\d+)\)$/, '$1 $2 $3'),
hslChannel: item.hsl.replace(/^hsl\(([\d.]+),([\d.]+%),([\d.]+%)\)$/, '$1 $2 $3'),
}))
continue
}
if (typeof value === 'object') {
colorsData[color] = {
...value,
rgbChannel: value.rgb.replace(/^rgb\((\d+),(\d+),(\d+)\)$/, '$1 $2 $3'),
hslChannel: value.hsl.replace(/^hsl\(([\d.]+),([\d.]+%),([\d.]+%)\)$/, '$1 $2 $3'),
}
continue
}
}
await fs.writeFile(
path.join(colorsTargetPath, 'index.json'),
JSON.stringify(colorsData, null, 2),
'utf8'
)
// ----------------------------------------------------------------------------
// Build registry/colors/[base].json.
// ----------------------------------------------------------------------------
const BASE_STYLES = `@tailwind base;
@tailwind components;
@tailwind utilities;
`
const BASE_STYLES_WITH_VARIABLES = `@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--background: <%- colors.light["background"] %>;
--foreground: <%- colors.light["foreground"] %>;
--card: <%- colors.light["card"] %>;
--card-foreground: <%- colors.light["card-foreground"] %>;
--popover: <%- colors.light["popover"] %>;
--popover-foreground: <%- colors.light["popover-foreground"] %>;
--primary: <%- colors.light["primary"] %>;
--primary-foreground: <%- colors.light["primary-foreground"] %>;
--secondary: <%- colors.light["secondary"] %>;
--secondary-foreground: <%- colors.light["secondary-foreground"] %>;
--muted: <%- colors.light["muted"] %>;
--muted-foreground: <%- colors.light["muted-foreground"] %>;
--accent: <%- colors.light["accent"] %>;
--accent-foreground: <%- colors.light["accent-foreground"] %>;
--destructive: <%- colors.light["destructive"] %>;
--destructive-foreground: <%- colors.light["destructive-foreground"] %>;
--border: <%- colors.light["border"] %>;
--input: <%- colors.light["input"] %>;
--ring: <%- colors.light["ring"] %>;
--radius: 0.5rem;
}
.dark {
--background: <%- colors.dark["background"] %>;
--foreground: <%- colors.dark["foreground"] %>;
--card: <%- colors.dark["card"] %>;
--card-foreground: <%- colors.dark["card-foreground"] %>;
--popover: <%- colors.dark["popover"] %>;
--popover-foreground: <%- colors.dark["popover-foreground"] %>;
--primary: <%- colors.dark["primary"] %>;
--primary-foreground: <%- colors.dark["primary-foreground"] %>;
--secondary: <%- colors.dark["secondary"] %>;
--secondary-foreground: <%- colors.dark["secondary-foreground"] %>;
--muted: <%- colors.dark["muted"] %>;
--muted-foreground: <%- colors.dark["muted-foreground"] %>;
--accent: <%- colors.dark["accent"] %>;
--accent-foreground: <%- colors.dark["accent-foreground"] %>;
--destructive: <%- colors.dark["destructive"] %>;
--destructive-foreground: <%- colors.dark["destructive-foreground"] %>;
--border: <%- colors.dark["border"] %>;
--input: <%- colors.dark["input"] %>;
--ring: <%- colors.dark["ring"] %>;
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}`
for (const baseColor of ['slate', 'gray', 'zinc', 'neutral', 'stone']) {
const base: Record<string, any> = {
inlineColors: {},
cssVars: {},
}
for (const [mode, values] of Object.entries(colorMapping)) {
base['inlineColors'][mode] = {}
base['cssVars'][mode] = {}
for (const [key, value] of Object.entries(values)) {
if (typeof value === 'string') {
const resolvedColor = value.replace(/{{base}}-/g, `${baseColor}-`)
base['inlineColors'][mode][key] = resolvedColor
const [resolvedBase, scale] = resolvedColor.split('-')
const color = scale
? colorsData[resolvedBase].find((item) => item.scale === parseInt(scale))
: colorsData[resolvedBase]
if (color) {
base['cssVars'][mode][key] = color.hslChannel
}
}
}
}
// Build css vars.
base['inlineColorsTemplate'] = template(BASE_STYLES)({})
base['cssVarsTemplate'] = template(BASE_STYLES_WITH_VARIABLES)({
colors: base['cssVars'],
})
await fs.writeFile(
path.join(REGISTRY_PATH, `colors/${baseColor}.json`),
JSON.stringify(base, null, 2),
'utf8'
)
// ----------------------------------------------------------------------------
// Build registry/themes.css
// ----------------------------------------------------------------------------
const THEME_STYLES_WITH_VARIABLES = `
.theme-<%- theme %> {
--background: <%- colors.light["background"] %>;
--foreground: <%- colors.light["foreground"] %>;
--muted: <%- colors.light["muted"] %>;
--muted-foreground: <%- colors.light["muted-foreground"] %>;
--popover: <%- colors.light["popover"] %>;
--popover-foreground: <%- colors.light["popover-foreground"] %>;
--card: <%- colors.light["card"] %>;
--card-foreground: <%- colors.light["card-foreground"] %>;
--border: <%- colors.light["border"] %>;
--input: <%- colors.light["input"] %>;
--primary: <%- colors.light["primary"] %>;
--primary-foreground: <%- colors.light["primary-foreground"] %>;
--secondary: <%- colors.light["secondary"] %>;
--secondary-foreground: <%- colors.light["secondary-foreground"] %>;
--accent: <%- colors.light["accent"] %>;
--accent-foreground: <%- colors.light["accent-foreground"] %>;
--destructive: <%- colors.light["destructive"] %>;
--destructive-foreground: <%- colors.light["destructive-foreground"] %>;
--ring: <%- colors.light["ring"] %>;
--radius: <%- colors.light["radius"] %>;
}
.dark .theme-<%- theme %> {
--background: <%- colors.dark["background"] %>;
--foreground: <%- colors.dark["foreground"] %>;
--muted: <%- colors.dark["muted"] %>;
--muted-foreground: <%- colors.dark["muted-foreground"] %>;
--popover: <%- colors.dark["popover"] %>;
--popover-foreground: <%- colors.dark["popover-foreground"] %>;
--card: <%- colors.dark["card"] %>;
--card-foreground: <%- colors.dark["card-foreground"] %>;
--border: <%- colors.dark["border"] %>;
--input: <%- colors.dark["input"] %>;
--primary: <%- colors.dark["primary"] %>;
--primary-foreground: <%- colors.dark["primary-foreground"] %>;
--secondary: <%- colors.dark["secondary"] %>;
--secondary-foreground: <%- colors.dark["secondary-foreground"] %>;
--accent: <%- colors.dark["accent"] %>;
--accent-foreground: <%- colors.dark["accent-foreground"] %>;
--destructive: <%- colors.dark["destructive"] %>;
--destructive-foreground: <%- colors.dark["destructive-foreground"] %>;
--ring: <%- colors.dark["ring"] %>;
}`
const themeCSS = []
for (const theme of themes) {
themeCSS.push(
// @ts-ignore
template(THEME_STYLES_WITH_VARIABLES)({
colors: theme.cssVars,
theme: theme.name,
})
)
}
await fs.writeFile(path.join(REGISTRY_PATH, `themes.css`), themeCSS.join('\n'), 'utf8')
// ----------------------------------------------------------------------------
// Build registry/themes/[theme].json
// ----------------------------------------------------------------------------
rimraf.sync(path.join(REGISTRY_PATH, 'themes'))
for (const baseColor of ['slate', 'gray', 'zinc', 'neutral', 'stone']) {
const payload = {
name: baseColor,
label: baseColor.charAt(0).toUpperCase() + baseColor.slice(1),
cssVars: {},
}
for (const [mode, values] of Object.entries(colorMapping)) {
payload['cssVars'][mode] = {}
for (const [key, value] of Object.entries(values)) {
if (typeof value === 'string') {
const resolvedColor = value.replace(/{{base}}-/g, `${baseColor}-`)
payload['cssVars'][mode][key] = resolvedColor
const [resolvedBase, scale] = resolvedColor.split('-')
const color = scale
? colorsData[resolvedBase].find((item) => item.scale === parseInt(scale))
: colorsData[resolvedBase]
if (color) {
payload['cssVars'][mode][key] = color.hslChannel
}
}
}
}
const targetPath = path.join(REGISTRY_PATH, 'themes')
// Create directory if it doesn't exist.
if (!existsSync(targetPath)) {
await fs.mkdir(targetPath, { recursive: true })
}
await fs.writeFile(
path.join(targetPath, `${payload.name}.json`),
JSON.stringify(payload, null, 2),
'utf8'
)
}
}
}
try {
console.log('🚀 Building registry...')
+1 -1
View File
@@ -141,6 +141,6 @@
"unist-util-visit-parents": "5.1.3",
"vite": "^6.2.4",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.0.0"
"vitest": "^3.0.5"
}
}
+1 -1
View File
@@ -180,6 +180,6 @@
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.0.0"
"vitest": "^3.0.5"
}
}
+4 -1
View File
@@ -53,7 +53,10 @@
},
"pnpm": {
"overrides": {
"@supabase/supabase-js>@supabase/auth-js": "2.69.0-rc.3"
"@supabase/supabase-js>@supabase/auth-js": "2.69.0-rc.3",
"vinxi>esbuild": "0.25.2",
"@tanstack/directive-functions-plugin>vite": "6.2.4",
"@tanstack/react-start-plugin>vite": "6.2.4"
}
},
"engines": {
+1 -1
View File
@@ -35,6 +35,6 @@
"tsconfig": "workspace:*",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vitest": "^3.0.0"
"vitest": "^3.0.5"
}
}
+1 -1
View File
@@ -26,6 +26,6 @@
"postgres-array": "^3.0.2",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vitest": "^3.0.9"
"vitest": "^3.0.5"
}
}
+1 -1
View File
@@ -66,7 +66,7 @@
"unified": "^11.0.5",
"vfile": "^6.0.3",
"vite": "^6.2.4",
"vitest": "^3.0.0"
"vitest": "^3.0.5"
},
"peerDependencies": {
"next": "catalog:",
+1 -1
View File
@@ -89,7 +89,7 @@
"tsconfig": "workspace:*",
"typescript": "~5.5.0",
"vite": "^6.2.4",
"vitest": "^3.0.0"
"vitest": "^3.0.5"
},
"peerDependencies": {
"next": "catalog:",
+59 -705
View File
File diff suppressed because it is too large. Load diff