Skip to content

Commit

Permalink
fix: npm build script and tsconfig.json (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Jun 17, 2021
1 parent 61888a2 commit 36b9e9f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
1 change: 1 addition & 0 deletions examples/multiple-pages-with-store/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": [
"vite/client",
"vite-plugin-pages/client"
]
}
Expand Down
1 change: 1 addition & 0 deletions examples/multiple-pages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": [
"vite/client",
"vite-plugin-pages/client"
]
}
Expand Down
8 changes: 8 additions & 0 deletions examples/single-page/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": [
"vite/client"
]
}
}
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@
],
"scripts": {
"dev": "npm run build -- --watch",
"copy-files": "esno scripts/copy-files.ts",
"example:dev": "npm run copy-files && npm -C examples/multiple-pages run dev",
"example:build": "npm run copy-files && npm -C examples/multiple-pages run build",
"example:serve": "npm run copy-files && npm -C examples/multiple-pages run serve",
"example:store:dev": "npm run copy-files && npm -C examples/multiple-pages-with-store run dev",
"example:store:build": "npm run copy-files && npm -C examples/multiple-pages-with-store run build",
"example:store:serve": "npm run copy-files && npm -C examples/multiple-pages-with-store run serve",
"copy-readme-files": "esno scripts/copy-readme-files.ts",
"copy-single-page-dts": "esno scripts/copy-single-page-dts.ts",
"example:dev": "npm run copy-readme-files && npm -C examples/multiple-pages run dev",
"example:build": "npm run copy-readme-files && npm -C examples/multiple-pages run build",
"example:serve": "npm run copy-readme-files && npm -C examples/multiple-pages run serve",
"example:store:dev": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run dev",
"example:store:build": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run build",
"example:store:serve": "npm run copy-readme-files && npm -C examples/multiple-pages-with-store run serve",
"example:single:dev": "npm -C examples/single-page run dev",
"example:single:build": "npm -C examples/single-page run build",
"example:single:serve": "npm -C examples/single-page run serve",
"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 .",
"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",
"prepublishOnly": "npm run build",
"release": "npx git-ensure -a && npx bumpp --push --tag --commit"
},
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions scripts/copy-single-page-dts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { copyFileSync } from 'fs'

copyFileSync('dist/single-page.d.ts', 'single-page.d.ts')
4 changes: 2 additions & 2 deletions src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import chalk from 'chalk'
import fs from 'fs-extra'
import { build as viteBuild, resolveConfig, UserConfig } from 'vite'
import { renderToString, SSRContext } from '@vue/server-renderer'
import { JSDOM } from 'jsdom'
import { JSDOM, VirtualConsole } from 'jsdom'
import { RollupOutput } from 'rollup'
import { ViteSSGContext, ViteSSGOptions } from '../client'
import { renderPreloadLinks } from './preload-links'
Expand Down Expand Up @@ -88,7 +88,7 @@ export async function build(cliOptions: Partial<ViteSSGOptions> = {}) {
buildLog('Rendering Pages...', routesPaths.length)

if (mock) {
const virtualConsole = new JSDOM.VirtualConsole();
const virtualConsole = new VirtualConsole()
const jsdom = new JSDOM('', { url: 'http://localhost', virtualConsole })
// @ts-ignore
global.window = jsdom.window
Expand Down

0 comments on commit 36b9e9f

Please sign in to comment.