From dc75fa48909dbac412020003d05bdfdcf6dc8893 Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Tue, 18 Jun 2024 22:52:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .commitlint.config.cjs | 40 ++++++++++++++++++++++++++++ .gitignore | 5 +++- .husky/pre-commit | 1 + lib/common/common.ts | 3 +++ lib/config/config.ts | 3 +++ lib/plugins/handler.ts | 3 +++ lib/plugins/index.ts | 3 +++ lib/plugins/loader.ts | 3 +++ lib/plugins/plugin.ts | 3 +++ lib/plugins/runtime.js | 5 +++- lib/puppeteer/puppeteer.ts | 3 +++ lib/renderer/loader.ts | 3 +++ lib/renderer/renderer.ts | 3 +++ package.json | 3 +++ renderers/puppeteer/index.ts | 1 + renderers/puppeteer/lib/puppeteer.ts | 3 +++ 16 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .commitlint.config.cjs diff --git a/.commitlint.config.cjs b/.commitlint.config.cjs new file mode 100644 index 0000000..40dd1b4 --- /dev/null +++ b/.commitlint.config.cjs @@ -0,0 +1,40 @@ +/** + * feat:新增功能(feature)。表示添加了新的功能或功能的扩展。 + * fix:修复问题(bug fix)。表示修复了已存在的问题或错误。 + * docs:文档更新。表示更新了文档,如添加新的文档、改进现有文档等。 + * chore:杂项任务(chore)。表示对构建过程或辅助工具的修改,不涉及功能或代码的更改。 + * style:代码风格调整。表示对代码风格、格式的调整,如空格、缩进、命名等。 + * refactor:重构代码。表示对代码进行重构,旨在改进代码结构、性能或可读性,但不涉及功能更改。 + * test:测试相关。表示新增或修改了测试代码,如添加新的测试用例、修复现有测试等。 + * revert:撤销提交。表示撤销先前的提交,用于还原之前的更改。 + */ +// git commit -m "feat: Add new feature" +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + // 提交类型(type)必须使用小写字母 + 'type-case': [2, 'always', 'lower-case'], + // 提交类型(type)必须符合指定的正则表达式 + 'type-enum': [ + 2, + 'always', + ['feat', 'fix', 'docs', 'chore', 'style', 'refactor', 'test', 'revert'] + ], + // 提交范围(scope)必须使用小写字母 + 'scope-case': [2, 'always', 'lower-case'], + // 提交主题(subject)的长度限制为 50 个字符 + 'subject-max-length': [2, 'always', 50], + // 提交主题(subject)的首字母必须大写 + 'subject-case': [2, 'always', 'sentence-case'], + // 提交主题(subject)不允许以句号结尾 + 'subject-full-stop': [2, 'never', '.'] + // 提交主题(subject)必须使用具体、清晰的语句描述更改内容 + // 'subject-words': [ + // 2, + // 'always', + // { + // words: ['add', 'update', 'remove', 'refactor', 'fix', 'merge', 'docs'] + // } + // ] + } +} diff --git a/.gitignore b/.gitignore index d61042a..6c2a457 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,7 @@ docs/ public/ /html/ -/plugins/ \ No newline at end of file +/plugins/ + + +yarn.lock \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index b7807b0..b910a37 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ +npm run lint npm run format \ No newline at end of file diff --git a/lib/common/common.ts b/lib/common/common.ts index 64e52cd..df4987b 100644 --- a/lib/common/common.ts +++ b/lib/common/common.ts @@ -1,5 +1,8 @@ import * as core from 'yunzai/core' import * as utils from 'yunzai/utils' +/** + * @deprecated 已废弃 + */ export default { ...core, ...utils diff --git a/lib/config/config.ts b/lib/config/config.ts index 9a441d1..02d401d 100644 --- a/lib/config/config.ts +++ b/lib/config/config.ts @@ -1,2 +1,5 @@ import { ConfigController } from "yunzai/config"; +/** + * @deprecated 已废弃 + */ export default ConfigController \ No newline at end of file diff --git a/lib/plugins/handler.ts b/lib/plugins/handler.ts index 7399741..a8124ab 100644 --- a/lib/plugins/handler.ts +++ b/lib/plugins/handler.ts @@ -1,2 +1,5 @@ import handler from "../../src/core/plugins/handler.js"; +/** + * @deprecated 已废弃 + */ export default handler \ No newline at end of file diff --git a/lib/plugins/index.ts b/lib/plugins/index.ts index 14eb659..5f4e383 100644 --- a/lib/plugins/index.ts +++ b/lib/plugins/index.ts @@ -1,2 +1,5 @@ import { Messages, Events } from "yunzai/core" +/** + * @deprecated 已废弃 + */ export { Messages, Events } \ No newline at end of file diff --git a/lib/plugins/loader.ts b/lib/plugins/loader.ts index 0b335b4..879eb8f 100644 --- a/lib/plugins/loader.ts +++ b/lib/plugins/loader.ts @@ -1,2 +1,5 @@ import pluginsLoader from "../../src/core/plugins.loader"; +/** + * @deprecated 已废弃 + */ export default pluginsLoader \ No newline at end of file diff --git a/lib/plugins/plugin.ts b/lib/plugins/plugin.ts index 3a37441..5ceae1e 100644 --- a/lib/plugins/plugin.ts +++ b/lib/plugins/plugin.ts @@ -1,2 +1,5 @@ import { Plugin } from "yunzai/core" +/** + * @deprecated 已废弃 + */ export default Plugin \ No newline at end of file diff --git a/lib/plugins/runtime.js b/lib/plugins/runtime.js index f0867de..93751a1 100644 --- a/lib/plugins/runtime.js +++ b/lib/plugins/runtime.js @@ -1,2 +1,5 @@ import { Runtime } from 'yunzai/core' -export default Runtime \ No newline at end of file +/** + * @deprecated 已废弃 + */ +export default Runtime diff --git a/lib/puppeteer/puppeteer.ts b/lib/puppeteer/puppeteer.ts index 1a9539b..f51ecb3 100644 --- a/lib/puppeteer/puppeteer.ts +++ b/lib/puppeteer/puppeteer.ts @@ -1,2 +1,5 @@ import { puppeteer } from 'yunzai/utils' +/** + * @deprecated 已废弃 + */ export default puppeteer \ No newline at end of file diff --git a/lib/renderer/loader.ts b/lib/renderer/loader.ts index 8d6e2e1..93975f2 100644 --- a/lib/renderer/loader.ts +++ b/lib/renderer/loader.ts @@ -1,2 +1,5 @@ import { renderer } from 'yunzai/utils' +/** + * @deprecated 已废弃 + */ export default renderer \ No newline at end of file diff --git a/lib/renderer/renderer.ts b/lib/renderer/renderer.ts index 263f6d0..0b73421 100644 --- a/lib/renderer/renderer.ts +++ b/lib/renderer/renderer.ts @@ -1,2 +1,5 @@ import { Renderer } from 'yunzai/utils' +/** + * @deprecated 已废弃 + */ export default Renderer \ No newline at end of file diff --git a/package.json b/package.json index f9720ef..9ddecbc 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "pm2": "pm2", "image": "node image.js", "css": "tailwindcss -i ./src/input.css -o ./public/output.css", + "lint": "commitlint --config .commitlint.config.cjs -e -V", "format": "prettier --write .", "prepare": "husky" }, @@ -52,6 +53,8 @@ "yaml": "^2.4.1" }, "devDependencies": { + "@commitlint/cli": "^19.2.1", + "@commitlint/config-conventional": "^19.1.0", "@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-terser": "^0.4.4", diff --git a/renderers/puppeteer/index.ts b/renderers/puppeteer/index.ts index 6cb4f9f..062ab63 100644 --- a/renderers/puppeteer/index.ts +++ b/renderers/puppeteer/index.ts @@ -7,6 +7,7 @@ import Puppeteer from './lib/puppeteer.js' * @returns renderer.id 渲染器ID,对应renderer中选择的id * @returns renderer.type 渲染类型,保留字段,暂时支持image * @returns renderer.render 渲染入口 + * @deprecated 已废弃 */ export default function (config?: PuppeteerLaunchOptions & { chromiumPath?: string; diff --git a/renderers/puppeteer/lib/puppeteer.ts b/renderers/puppeteer/lib/puppeteer.ts index bf6366e..084cdcf 100644 --- a/renderers/puppeteer/lib/puppeteer.ts +++ b/renderers/puppeteer/lib/puppeteer.ts @@ -1,2 +1,5 @@ import { Renderers } from 'yunzai/utils' +/** + * @deprecated 已废弃 + */ export default Renderers \ No newline at end of file