chore: site build & preview scripts
This commit is contained in:
parent
d117fb2d21
commit
8824f9215b
5 changed files with 21 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
_site/
|
||||||
*.*~
|
*.*~
|
||||||
*.*swp
|
*.*swp
|
||||||
|
|
|
||||||
|
|
@ -49,5 +49,5 @@ export default defineConfig([
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
globalIgnores(['dist'])
|
globalIgnores(['dist', '_site'])
|
||||||
])
|
])
|
||||||
|
|
|
||||||
7
main.js
7
main.js
|
|
@ -1,4 +1,9 @@
|
||||||
import MineSweeper from './lib/mnswpr.js'
|
import MineSweeper from './lib/mnswpr.js'
|
||||||
|
import * as pkg from './package.json'
|
||||||
|
|
||||||
const mnswpr = new MineSweeper('app', 'pkg-dev')
|
const version = import.meta.env.MODE === 'development'
|
||||||
|
? 'dev'
|
||||||
|
: pkg.version
|
||||||
|
|
||||||
|
const mnswpr = new MineSweeper('app', version)
|
||||||
mnswpr.initialize()
|
mnswpr.initialize()
|
||||||
|
|
@ -14,6 +14,9 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build:site": "vite build --config vite-site.config.js",
|
||||||
|
"preview:site": "vite preview --config vite-site.config.js",
|
||||||
|
"build:preview": "npm run build:site && npm run preview:site",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
|
|
|
||||||
10
vite-site.config.js
Normal file
10
vite-site.config.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// @ts-check
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
|
||||||
|
export default defineConfig(() => {
|
||||||
|
return {
|
||||||
|
build: {
|
||||||
|
outDir: '_site'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Loading…
Reference in a new issue