From 8824f9215b550c0c7aa0774f34ec7bf7ee3cd727 Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 3 Apr 2026 10:54:19 +0200 Subject: [PATCH] chore: site build & preview scripts --- .gitignore | 1 + eslint.config.js | 2 +- main.js | 7 ++++++- package.json | 3 +++ vite-site.config.js | 10 ++++++++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 vite-site.config.js diff --git a/.gitignore b/.gitignore index 9558c63..848ad36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ dist/ +_site/ *.*~ *.*swp diff --git a/eslint.config.js b/eslint.config.js index 66f0cff..f8fae9d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -49,5 +49,5 @@ export default defineConfig([ }] } }, - globalIgnores(['dist']) + globalIgnores(['dist', '_site']) ]) diff --git a/main.js b/main.js index 984ed7c..acbd979 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,9 @@ 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() \ No newline at end of file diff --git a/package.json b/package.json index 7d317f7..886f2f0 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "dev": "vite", "start": "vite", "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", "lint": "eslint .", "lint:fix": "eslint . --fix", diff --git a/vite-site.config.js b/vite-site.config.js new file mode 100644 index 0000000..5741619 --- /dev/null +++ b/vite-site.config.js @@ -0,0 +1,10 @@ +// @ts-check +import { defineConfig } from 'vite' + +export default defineConfig(() => { + return { + build: { + outDir: '_site' + } + } +}) \ No newline at end of file