文档站(`docs/` 就是 docfx 项目,发布在 https://lovechengke.github.io/ClassHelper/): - 四章 + 常见问题 + 完整参考,共 44 页:快速上手(8 页)/ 应用帮助(10 页)/ 管理运维(6 页)/ 开发文档(11 页)。信息架构照 ClassIsland 文档站来: 顶栏分章、左侧章节导航、右侧本页目录、上一页 / 下一页、站内搜索、深色主题跟随系统; - 自定义模板覆盖(`templates/classhelper/`):把 docfx modern 模板那套英文 UI 文案 (In this article / Improve this doc / Next…)换成中文,补 GitHub 入口与版本徽标, 并加一层只调排版与配色的 `public/main.css`(不动 DOM 结构); - 站点顶栏的版本徽标取自根 `package.json`(`docs/build.mjs` 用 `--metadata` 注入), 不在文档里写第二份 —— 否则一定漂; - 404 页单独生成:GitHub Pages 的项目页挂在 `/<仓库名>/` 子路径下,而浏览器是按**被请求的路径** 解析页面里的相对链接的,所以 `<base>` 必须钉到站点根,由 `build.mjs`(本地 `./`)与 workflow(CI 传 `/<仓库名>/`)分别注入; - 构建前清空 `_site`:docfx 只覆盖不清理,删掉或改名的页面会以旧文件留在目录里, 而 Pages 上传的是整个目录。 版本迭代(**每一次 releases,不是每一次提交**): - 新增 `scripts/version.mjs`。这个仓库里同一个版本号散在 **10 个文件**里(5 份 `package.json`、 `deploy/package.runtime.json`、两个 compose 的镜像 tag、插件 `manifest.yml`、以及插件 C# 里的 `PluginVersion` 常量),手工改必然漏一处,而漏掉的那处**不会报错**,只在某个不常走的分支上 表现为"版本号对不上"。现在收口成两条命令:`pnpm version:check`(逐处比对,不一致 exit 1) 与 `pnpm version:bump patch|minor|major`(一次改写全部 10 处,任何一处匹配不到或匹配到多处 就直接失败退出,不做尽力而为的部分改写); - `AGENTS.md` 新增 §4.4「版本迭代(每一次 releases,不是每一次提交)」:写清版本号落在哪 10 处、 完整发布命令序列(体检 → 验收 → `dist:all` → 哈希清单 → 推 master → `gh release create` → Linux 包由 CI 合并哈希行),以及"已发布的版本号不要复用"的理由。 其它: - `.github/workflows/docs.yml`:推 master(`docs/**` / `package.json` / workflow 自身有变)即构建并 部署到 Pages;构建带 `--check`,把 docfx 的警告当错误 —— 最常见的警告是"某个 `.md` 没被任何 `toc.yml` 引用",那种页面有内容但没有侧边栏,属于必须修掉的疏漏; - docs 目录重组后的引用同步:`production` / `mysql` / `linux-deploy` / `winisland-design-tokens` 移到新位置后,AGENTS.md、`deploy/`、`scripts/`、客户端源码注释里的路径引用一并更新; - 文档站只发布 `docs/` 这一棵树,页面里指向树外的相对链接(`../AGENTS.md` 等)改成 GitHub 绝对 URL, 否则上线全是 404; - 图标派生清单补上文档站模板里的 `logo.png` 与 `favicon.png`(`pnpm icons` 一并生成, 仍然只有一个图形源 `build/classhelper.{png,ico}`); - `docs/_site` 进 `.gitignore` / `.prettierignore` 与 ESLint ignores; - 根脚本补 `version:check` / `version:bump` / `docs:build` / `docs:serve` / `docs:check`。
97 lines
2.8 KiB
JavaScript
97 lines
2.8 KiB
JavaScript
import tseslint from 'typescript-eslint';
|
||
import pluginVue from 'eslint-plugin-vue';
|
||
import vueParser from 'vue-eslint-parser';
|
||
|
||
const sharedGlobals = {
|
||
console: 'readonly',
|
||
process: 'readonly',
|
||
Buffer: 'readonly',
|
||
__dirname: 'readonly',
|
||
__filename: 'readonly',
|
||
setTimeout: 'readonly',
|
||
clearTimeout: 'readonly',
|
||
setInterval: 'readonly',
|
||
clearInterval: 'readonly',
|
||
URL: 'readonly',
|
||
URLSearchParams: 'readonly',
|
||
fetch: 'readonly',
|
||
global: 'readonly',
|
||
};
|
||
|
||
export default tseslint.config(
|
||
{
|
||
ignores: [
|
||
'**/node_modules/**',
|
||
'**/dist/**',
|
||
'**/dist-electron/**',
|
||
'**/release/**',
|
||
'**/release-server/**',
|
||
// 交付产物归集目录(pnpm dist:* 的输出,见 AGENTS.md §4):里面是构建后的压缩 JS,不该进 lint
|
||
'**/releases/**',
|
||
'**/build/**',
|
||
'**/coverage/**',
|
||
'**/src/generated/**',
|
||
'**/.cache/**',
|
||
'**/.pnpm-store/**',
|
||
'**/.probe/**',
|
||
// 文档站(docfx)的构建产物:里面是 docfx 模板自带的压缩 JS 与生成的 HTML
|
||
'**/docs/_site/**',
|
||
'**/*.d.ts',
|
||
],
|
||
},
|
||
...tseslint.configs.recommended,
|
||
...pluginVue.configs['flat/recommended'],
|
||
{
|
||
// Electron 主进程脚本(图标渲染、UI 冒烟)必须是 CommonJS,允许 require
|
||
files: ['**/*.cjs'],
|
||
languageOptions: {
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'commonjs',
|
||
globals: sharedGlobals,
|
||
},
|
||
rules: {
|
||
'@typescript-eslint/no-require-imports': 'off',
|
||
'@typescript-eslint/no-var-requires': 'off',
|
||
},
|
||
},
|
||
{
|
||
files: ['**/*.vue'],
|
||
languageOptions: {
|
||
parser: vueParser,
|
||
parserOptions: {
|
||
parser: tseslint.parser,
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
extraFileExtensions: ['.vue'],
|
||
},
|
||
globals: sharedGlobals,
|
||
},
|
||
},
|
||
{
|
||
files: ['**/*.{ts,mts,cts,js,mjs,cjs,vue}'],
|
||
languageOptions: {
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
globals: sharedGlobals,
|
||
},
|
||
rules: {
|
||
'no-console': 'off',
|
||
'@typescript-eslint/no-explicit-any': 'warn',
|
||
'@typescript-eslint/no-unused-vars': [
|
||
'warn',
|
||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||
],
|
||
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }],
|
||
// Vue 组件名使用多单词(Element Plus 视图文件均为 XxxView.vue)
|
||
'vue/multi-word-component-names': 'off',
|
||
'vue/max-attributes-per-line': 'off',
|
||
'vue/singleline-html-element-content-newline': 'off',
|
||
'vue/html-self-closing': 'off',
|
||
'vue/attributes-order': 'off',
|
||
'vue/html-indent': 'off',
|
||
'vue/html-closing-bracket-newline': 'off',
|
||
'vue/first-attribute-linebreak': 'off',
|
||
},
|
||
},
|
||
);
|