Skip to content

Commit aea7f2f

Browse files
GiniGini
authored andcommitted
fix: make generated Vite scaffold build-ready
1 parent ba797f9 commit aea7f2f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

server/mode-artifacts.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ describe('mode artifacts', () => {
4343
expect(await store.readWorkspaceFile(task.id, 'app/src/App.tsx')).toContain('useState')
4444
expect(await store.readWorkspaceFile(task.id, 'app/vite.config.ts')).toContain('defineConfig')
4545
expect((await store.listWorkspaceFiles(task.id)).map((file) => file.path)).toContain('app/.gitignore')
46+
expect(JSON.parse(await store.readWorkspaceFile(task.id, 'app/package.json'))).toMatchObject({
47+
scripts: { build: 'tsc -b && vite build', preview: 'vite preview' },
48+
devDependencies: { '@types/react': expect.any(String), '@types/react-dom': expect.any(String), '@vitejs/plugin-react': expect.any(String) },
49+
})
4650
})
4751

4852
it('writes an explicit static validation report without claiming runtime verification', async () => {

server/mode-artifacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const writeSlides = async (task: Task, store: TaskStore) => {
4747

4848
const writeScaffold = async (task: Task, store: TaskStore) => {
4949
const files: Record<string, string> = {
50-
'app/package.json': `${JSON.stringify({ private: true, scripts: { dev: 'vite', build: 'tsc -b && vite build' }, dependencies: { '@vitejs/plugin-react': 'latest', vite: 'latest', typescript: 'latest', react: 'latest', 'react-dom': 'latest' }, devDependencies: {} }, null, 2)}\n`,
50+
'app/package.json': `${JSON.stringify({ private: true, scripts: { dev: 'vite', build: 'tsc -b && vite build', preview: 'vite preview' }, dependencies: { react: '^19.2.7', 'react-dom': '^19.2.7' }, devDependencies: { '@types/react': '^19.2.17', '@types/react-dom': '^19.2.3', '@vitejs/plugin-react': '^6.0.3', typescript: '~6.0.2', vite: '^8.1.1' } }, null, 2)}\n`,
5151
'app/vite.config.ts': "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nexport default defineConfig({ plugins: [react()] })\n",
5252
'app/tsconfig.json': `${JSON.stringify({ compilerOptions: { target: 'ES2022', jsx: 'react-jsx', strict: true, module: 'ESNext', moduleResolution: 'Bundler' }, include: ['src'] }, null, 2)}\n`,
5353
'app/src/main.tsx': "import React from 'react'\nimport { createRoot } from 'react-dom/client'\nimport './styles.css'\nimport App from './App'\ncreateRoot(document.getElementById('root')!).render(<App />)\n",

0 commit comments

Comments
 (0)