Skip to content

Commit

Permalink
feat: 🚀 新增husky插件,支持husky、commitlint、lint-staged功能(#215) (#222)
Browse files Browse the repository at this point in the history
* feat: 🚀 新增husky插件,支持husky、commitlint、lint-staged功能(#215)

* fix: 🧩 删除自定义脚本

* fix: 🧩 删除多余配置

* fix: 🧩 删除多余配置

---------

Co-authored-by: wuguohao <[email protected]>
(cherry picked from commit b272a18)
  • Loading branch information
nanyishixiong authored and uaenaTzx committed Jul 9, 2024
1 parent f812628 commit f4112f5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/@plugin/plugin-husky/generator/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = (generatorAPI) => {
generatorAPI.extendPackage({
scripts: {
postinstall: "husky install",
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": ["pnpm format:ci", "pnpm lint:ci"],
},
devDependencies: {
husky: "^9.0.11",
"lint-staged": "^15.2.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
},
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo 'running commit-msg checks ...'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo 'running pre-commit checks ...'
9 changes: 9 additions & 0 deletions packages/@plugin/plugin-husky/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const PluginConfig = require("./generator/index.cjs");

const pluginHusky = (buildTool) => {
return PluginConfig[buildTool] ?? console.warn(`Unsupported build tool: ${buildTool}`);
};

module.exports = {
pluginHusky,
};
6 changes: 6 additions & 0 deletions packages/@plugin/plugin-husky/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@laconic/plugin-husky",
"version": "1.0.0",
"description": "husky plugin for create-neat",
"main": "index.cjs"
}
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4112f5

Please sign in to comment.