@@ -29,11 +29,68 @@ async function patchVibeDashboard() {
2929 . replace (
3030 '"vitest": "npm:@voidzero-dev/vite-plus-test"' ,
3131 `"vitest": "file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz"
32+ "@vitest/browser": "file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz"
33+ "@vitest/browser-playwright": "file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz"
3234 "@voidzero-dev/vite-plus": "file:${ tgzPath } /voidzero-dev-vite-plus-0.0.0.tgz"
3335 "@voidzero-dev/vite-plus-core": "file:${ tgzPath } /voidzero-dev-vite-plus-core-0.0.0.tgz"
3436 "@voidzero-dev/vite-plus-test": "file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz"` ,
3537 ) ;
3638 fs . writeFileSync ( pnpmWorkspacePath , pnpmWorkspaceFile ) ;
39+
40+ // Remove @vitest /* packages from apps/dashboard/package.json
41+ // These are bundled into our vitest package and shouldn't be installed separately
42+ const dashboardPackageJsonPath = join (
43+ projectDir ,
44+ 'vibe-dashboard' ,
45+ 'apps' ,
46+ 'dashboard' ,
47+ 'package.json' ,
48+ ) ;
49+ const dashboardPackageJson = JSON . parse ( fs . readFileSync ( dashboardPackageJsonPath , 'utf8' ) ) ;
50+ if ( dashboardPackageJson . devDependencies ) {
51+ // Remove @vitest /browser, @vitest/ui, and @vitest/browser-playwright
52+ // They're all bundled in our vitest package now
53+ const vitestPackagesToRemove = [ '@vitest/browser' , '@vitest/ui' , '@vitest/browser-playwright' ] ;
54+ for ( const pkg of vitestPackagesToRemove ) {
55+ delete dashboardPackageJson . devDependencies [ pkg ] ;
56+ }
57+ }
58+
59+ // Note: @vitest /* packages are now bundled into our vitest package, so we don't need
60+ // to add them as separate devDependencies anymore.
61+
62+ // Write the updated package.json
63+ fs . writeFileSync ( dashboardPackageJsonPath , JSON . stringify ( dashboardPackageJson , null , 2 ) + '\n' ) ;
64+
65+ // Update vite.config.ts to import from vitest/browser-playwright instead of @vitest/browser-playwright
66+ // This is needed because pnpm overrides don't affect Node.js module resolution at config load time
67+ const viteConfigPath = join ( projectDir , 'vibe-dashboard' , 'apps' , 'dashboard' , 'vite.config.ts' ) ;
68+ const viteConfigContent = fs
69+ . readFileSync ( viteConfigPath , 'utf8' )
70+ . replace ( 'from "@vitest/browser-playwright"' , 'from "vitest/browser-playwright"' ) ;
71+ fs . writeFileSync ( viteConfigPath , viteConfigContent ) ;
72+
73+ // Add pnpm overrides to ensure @vitest /* packages are installed at matching versions
74+ const vitestVersion = vitestPackageJson . devDependencies [ '@vitest/runner' ] ;
75+ const vitestOverrides = [
76+ '@vitest/runner' ,
77+ '@vitest/utils' ,
78+ '@vitest/spy' ,
79+ '@vitest/expect' ,
80+ '@vitest/snapshot' ,
81+ '@vitest/mocker' ,
82+ '@vitest/pretty-format' ,
83+ ] ;
84+
85+ const pnpmWorkspaceContent = fs . readFileSync ( pnpmWorkspacePath , 'utf8' ) ;
86+ if ( ! pnpmWorkspaceContent . includes ( '"@vitest/runner":' ) ) {
87+ const overridesStr = vitestOverrides . map ( ( pkg ) => ` "${ pkg } ": "${ vitestVersion } "` ) . join ( '\n' ) ;
88+ const updatedContent = pnpmWorkspaceContent . replace (
89+ / ^ o v e r r i d e s : \n / m,
90+ `overrides:\n${ overridesStr } \n` ,
91+ ) ;
92+ fs . writeFileSync ( pnpmWorkspacePath , updatedContent ) ;
93+ }
3794}
3895
3996async function patchSkeleton ( ) {
@@ -44,12 +101,15 @@ async function patchSkeleton() {
44101 packageJson . scripts . test = 'vite test' ;
45102
46103 // Add pnpm overrides with tgz files
104+ // Include @vitest /browser and @vitest /browser-playwright to use bundled versions
47105 packageJson . pnpm = packageJson . pnpm || { } ;
48106 packageJson . pnpm . overrides = {
49107 ...packageJson . pnpm . overrides ,
50108 vite : `file:${ tgzPath } /voidzero-dev-vite-plus-core-0.0.0.tgz` ,
51109 'rolldown-vite' : `file:${ tgzPath } /voidzero-dev-vite-plus-core-0.0.0.tgz` ,
52110 vitest : `file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz` ,
111+ '@vitest/browser' : `file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz` ,
112+ '@vitest/browser-playwright' : `file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz` ,
53113 '@voidzero-dev/vite-plus' : `file:${ tgzPath } /voidzero-dev-vite-plus-0.0.0.tgz` ,
54114 '@voidzero-dev/vite-plus-core' : `file:${ tgzPath } /voidzero-dev-vite-plus-core-0.0.0.tgz` ,
55115 '@voidzero-dev/vite-plus-test' : `file:${ tgzPath } /voidzero-dev-vite-plus-test-0.0.0.tgz` ,
@@ -61,9 +121,14 @@ async function patchSkeleton() {
61121 playwright : `catalog:` ,
62122 } ;
63123
124+ // Relax engine constraints to support broader node versions
125+ if ( packageJson . engines ?. node ) {
126+ packageJson . engines . node = '>=22.0.0' ;
127+ }
128+
64129 fs . writeFileSync ( packageJsonPath , JSON . stringify ( packageJson , null , 2 ) + '\n' ) ;
65130
66- const vitestVersion = vitestPackageJson . dependencies [ '@vitest/expect' ] ;
131+ const vitestVersion = vitestPackageJson . devDependencies [ '@vitest/expect' ] ;
67132
68133 // Patch pnpm-workspace.yaml
69134 const pnpmWorkspacePath = join ( projectDir , 'skeleton' , 'pnpm-workspace.yaml' ) ;
@@ -88,6 +153,46 @@ peerDependencyRules:
88153 - vitest
89154` ;
90155 fs . writeFileSync ( pnpmWorkspacePath , pnpmWorkspaceContent + appendContent ) ;
156+
157+ // Update vite.config.ts files to import from vitest/browser-playwright instead of @vitest/browser-playwright
158+ // This is needed because pnpm overrides don't affect Node.js module resolution at config load time
159+ const skeletonReactConfigPath = join (
160+ projectDir ,
161+ 'skeleton' ,
162+ 'packages' ,
163+ 'skeleton-react' ,
164+ 'vite.config.ts' ,
165+ ) ;
166+ const skeletonSvelteConfigPath = join (
167+ projectDir ,
168+ 'skeleton' ,
169+ 'packages' ,
170+ 'skeleton-svelte' ,
171+ 'vite.config.ts' ,
172+ ) ;
173+
174+ for ( const configPath of [ skeletonReactConfigPath , skeletonSvelteConfigPath ] ) {
175+ const content = fs
176+ . readFileSync ( configPath , 'utf8' )
177+ // Handle both single and double quotes
178+ . replace ( / f r o m [ ' " ] @ v i t e s t \/ b r o w s e r - p l a y w r i g h t [ ' " ] / , 'from "vitest/browser-playwright"' ) ;
179+ fs . writeFileSync ( configPath , content ) ;
180+ }
181+
182+ // Remove @vitest /browser-playwright from package devDependencies
183+ // These are bundled in our vitest package now
184+ const packagesToUpdate = [
185+ join ( projectDir , 'skeleton' , 'packages' , 'skeleton-react' , 'package.json' ) ,
186+ join ( projectDir , 'skeleton' , 'packages' , 'skeleton-svelte' , 'package.json' ) ,
187+ ] ;
188+
189+ for ( const pkgPath of packagesToUpdate ) {
190+ const pkg = JSON . parse ( fs . readFileSync ( pkgPath , 'utf8' ) ) ;
191+ if ( pkg . devDependencies ?. [ '@vitest/browser-playwright' ] ) {
192+ delete pkg . devDependencies [ '@vitest/browser-playwright' ] ;
193+ }
194+ fs . writeFileSync ( pkgPath , JSON . stringify ( pkg , null , '\t' ) + '\n' ) ;
195+ }
91196}
92197
93198switch ( project ) {
0 commit comments