Skip to content

Commit 36b9e9f

Browse files
authored
fix: npm build script and tsconfig.json (#56)
1 parent 61888a2 commit 36b9e9f

File tree

8 files changed

+25
-10
lines changed

8 files changed

+25
-10
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

examples/multiple-pages-with-store/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"types": [
5+
"vite/client",
56
"vite-plugin-pages/client"
67
]
78
}

examples/multiple-pages/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"types": [
5+
"vite/client",
56
"vite-plugin-pages/client"
67
]
78
}

examples/single-page/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"types": [
5+
"vite/client"
6+
]
7+
}
8+
}

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@
4444
],
4545
"scripts": {
4646
"dev": "npm run build -- --watch",
47-
"copy-files": "esno scripts/copy-files.ts",
48-
"example:dev": "npm run copy-files && npm -C examples/multiple-pages run dev",
49-
"example:build": "npm run copy-files && npm -C examples/multiple-pages run build",
50-
"example:serve": "npm run copy-files && npm -C examples/multiple-pages run serve",
51-
"example:store:dev": "npm run copy-files && npm -C examples/multiple-pages-with-store run dev",
52-
"example:store:build": "npm run copy-files && npm -C examples/multiple-pages-with-store run build",
53-
"example:store:serve": "npm run copy-files && npm -C examples/multiple-pages-with-store run serve",
47+
"copy-readme-files": "esno scripts/copy-readme-files.ts",
48+
"copy-single-page-dts": "esno scripts/copy-single-page-dts.ts",
49+
"example:dev": "npm run copy-readme-files && npm -C examples/multiple-pages run dev",
50+
"example:build": "npm run copy-readme-files && npm -C examples/multiple-pages run build",
51+
"example:serve": "npm run copy-readme-files && npm -C examples/multiple-pages run serve",
52+
"example:store:dev": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run dev",
53+
"example:store:build": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run build",
54+
"example:store:serve": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run serve",
5455
"example:single:dev": "npm -C examples/single-page run dev",
5556
"example:single:build": "npm -C examples/single-page run build",
5657
"example:single:serve": "npm -C examples/single-page run serve",
57-
"build": "rimraf dist && tsup src/index.ts src/client/single-page.ts src/node/cli.ts --dts --format cjs,esm && cp dist/single-page.d.ts .",
58+
"build": "rimraf dist && tsup src/index.ts src/client/single-page.ts src/node/cli.ts --dts --format cjs,esm && npm run copy-single-page-dts",
5859
"prepublishOnly": "npm run build",
5960
"release": "npx git-ensure -a && npx bumpp --push --tag --commit"
6061
},
File renamed without changes.

scripts/copy-single-page-dts.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { copyFileSync } from 'fs'
2+
3+
copyFileSync('dist/single-page.d.ts', 'single-page.d.ts')

src/node/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import chalk from 'chalk'
44
import fs from 'fs-extra'
55
import { build as viteBuild, resolveConfig, UserConfig } from 'vite'
66
import { renderToString, SSRContext } from '@vue/server-renderer'
7-
import { JSDOM } from 'jsdom'
7+
import { JSDOM, VirtualConsole } from 'jsdom'
88
import { RollupOutput } from 'rollup'
99
import { ViteSSGContext, ViteSSGOptions } from '../client'
1010
import { renderPreloadLinks } from './preload-links'
@@ -88,7 +88,7 @@ export async function build(cliOptions: Partial<ViteSSGOptions> = {}) {
8888
buildLog('Rendering Pages...', routesPaths.length)
8989

9090
if (mock) {
91-
const virtualConsole = new JSDOM.VirtualConsole();
91+
const virtualConsole = new VirtualConsole()
9292
const jsdom = new JSDOM('', { url: 'http://localhost', virtualConsole })
9393
// @ts-ignore
9494
global.window = jsdom.window

0 commit comments

Comments
 (0)