Migrate to vp/vite-plus toolchain and update configs

Replace ESLint/Prettier/Husky workflow with vp (vite-plus) tooling: remove .eslintrc.cjs and prettier.config.js, drop husky pre-commit and add .vite-hooks/pre-commit (vp staged). Update package.json scripts to use vp commands, bump @halo-dev/theme-package-cli, replace vite with @voidzero-dev/vite-plus-core alias and add vite-plus, and add pnpm settings/overrides and packageManager update. Add VS Code recommendations and formatter settings, expose .vscode/settings.json in .gitignore, and adjust CI to use Node 24. Update README link and small formatting fixes. Regenerate pnpm lockfile to reflect dependency changes and other config updates; templates and vite config were also modified.
This commit is contained in:
Ryan Wang
2026-03-24 16:45:04 +08:00
parent c4885a24c9
commit eaaf71a8bf
16 changed files with 1263 additions and 2371 deletions
-14
View File
@@ -1,14 +0,0 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
env: {
node: true,
},
};
+1 -1
View File
@@ -18,4 +18,4 @@ jobs:
skip-appstore-release: true
app-id: app-foo
pnpm-version: 10
node-version: 20
node-version: 24
+1
View File
@@ -15,6 +15,7 @@ dist-ssr
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
-1
View File
@@ -1 +0,0 @@
npx lint-staged
+1
View File
@@ -0,0 +1 @@
vp staged
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["VoidZero.vite-plus-extension-pack"]
}
+9
View File
@@ -0,0 +1,9 @@
{
"editor.defaultFormatter": "oxc.oxc-vscode",
"oxc.fmt.configPath": "./vite.config.ts",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "explicit"
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
一个集成了 Vite 的主题快速开始模板。
主题开发文档可查阅:<https://docs.halo.run/2.0.0-SNAPSHOT/developer-guide/theme/prepare>
主题开发文档可查阅:<https://docs.halo.run/developer-guide/theme/prepare>
## 开发
+20 -23
View File
@@ -1,31 +1,28 @@
{
"license": "GPL-3.0",
"type": "module",
"scripts": {
"build": "tsc && vite build && theme-package",
"build-only": "tsc && vite build",
"dev": "vite build --watch",
"lint": "eslint ./src --ext .js,.cjs,.mjs,.ts,.cts,.mts --ignore-path .gitignore",
"prepare": "husky",
"prettier": "prettier --write './**/*.{ts,json,yaml,yml,html}'"
},
"lint-staged": {
"*.{ts,json,yaml,yml,html}": [
"prettier --write"
]
"build": "tsc && vp build && theme-package",
"build-only": "tsc && vp build",
"dev": "vp build --watch",
"lint": "vp lint",
"prepare": "vp config",
"fmt": "vp fmt"
},
"devDependencies": {
"@halo-dev/theme-package-cli": "^1.0.0",
"@halo-dev/theme-package-cli": "^1.0.1",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^9.1.7",
"lint-staged": "^15.5.0",
"prettier": "^2.8.8",
"typescript": "^4.9.5",
"vite": "^5.4.16"
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vite-plus": "latest"
},
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
"packageManager": "pnpm@10.32.1",
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
],
"overrides": {
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
}
}
}
+1196 -2315
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -1,6 +0,0 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
endOfLine: "lf",
};
+1 -1
View File
@@ -1 +1 @@
/// <reference types="vite/client" />
/// <reference types="vite-plus/client" />
+5 -2
View File
@@ -1,5 +1,8 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" th:replace="~{modules/layout :: html(content = ~{::content})}">
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(content = ~{::content})}"
>
<th:block th:fragment="content">
<ul>
<li th:each="post : ${posts.items}">
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" th:fragment="html (content)">
<head>
<meta charset="UTF-8" />
+5 -2
View File
@@ -1,5 +1,8 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" th:replace="~{modules/layout :: html(content = ~{::content})}">
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(content = ~{::content})}"
>
<th:block th:fragment="content">
<article th:utext="${post.content.content}"></article>
</th:block>
+18 -3
View File
@@ -1,16 +1,31 @@
import { defineConfig } from "vite";
import { fileURLToPath } from "url";
import path from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "vite-plus";
export default defineConfig({
build: {
outDir: fileURLToPath(new URL("./templates/assets/dist", import.meta.url)),
emptyOutDir: true,
lib: {
entry: path.resolve(__dirname, "src/main.ts"),
entry: path.resolve(process.cwd(), "src/main.ts"),
name: "main",
fileName: "main",
formats: ["iife"],
},
},
lint: { options: { typeAware: true, typeCheck: true } },
fmt: {
printWidth: 100,
tabWidth: 2,
useTabs: false,
endOfLine: "lf",
sortPackageJson: true,
insertFinalNewline: true,
sortImports: {},
ignorePatterns: [],
},
staged: {
"*": ["vp check"],
},
});