File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,19 @@ export async function setupInlineFixture(options: {
214214 // write additional files
215215 if ( options . files ) {
216216 for ( let [ filename , contents ] of Object . entries ( options . files ) ) {
217+ // custom fs command
218+ if ( contents . startsWith ( 'fs:cp:' ) ) {
219+ const src = contents . slice ( 'fs:cp:' . length )
220+ const srcPath = path . resolve ( options . src , src )
221+ if ( ! fs . existsSync ( srcPath ) ) {
222+ throw new Error ( `Source file does not exist: ${ srcPath } ` )
223+ }
224+ fs . cpSync ( srcPath , path . join ( options . dest , filename ) , {
225+ recursive : true ,
226+ } )
227+ continue
228+ }
229+ // write new file
217230 let filepath = path . join ( options . dest , filename )
218231 fs . mkdirSync ( path . dirname ( filepath ) , { recursive : true } )
219232 // strip indent
Original file line number Diff line number Diff line change @@ -145,24 +145,16 @@ test.describe(() => {
145145 src : 'examples/starter' ,
146146 dest : root ,
147147 files : {
148+ 'vite.config.base.ts' : 'fs:cp:vite.config.ts' ,
148149 'vite.config.ts' : /* js */ `
149- import rsc from '@vitejs/plugin-rsc'
150- import react from '@vitejs/plugin-react'
151- import { defineConfig } from 'vite'
150+ import { defineConfig, mergeConfig } from 'vite'
151+ import baseConfig from './vite.config.base.ts'
152152
153- export default defineConfig({
153+ const overrideConfig = defineConfig({
154154 base: '/custom-base/',
155- plugins: [
156- react(),
157- rsc({
158- entries: {
159- client: './src/framework/entry.browser.tsx',
160- ssr: './src/framework/entry.ssr.tsx',
161- rsc: './src/framework/entry.rsc.tsx',
162- }
163- }),
164- ],
165155 })
156+
157+ export default mergeConfig(baseConfig, overrideConfig)
166158 ` ,
167159 } ,
168160 } )
You can’t perform that action at this time.
0 commit comments