@kunlunjs/fabric
Project basic configurations include ESLint, Prettier, StyleLint, Husky, lint-staged, and Git Commit message Verify.
Installation
pnpm i @kunlunjs/fabric -D
# Where "@types/eslint" "stylelint" is optional
pnpm i prettier @types/eslint eslint stylelint devmoji husky lint-staged @types/node typescript -D
Usage
In the project root directory will be automatically generate the following documents, including ESLint/Prettier/StyleLint judgment is whether to include these files, Since Husky's initialization depends on Git, it determines whether.git exists. If it doesn't, it initialses the git environment with 'git init' and then adds' prepare 'to package.json scripts: "husky install"`.
- .husky/commit-msg Trigger git "commit-msg" hook.
- .husky/pre-commit Trigger git "pre-commit" hook.
- .husky/prepare-commit-msg Trigger git "prepare-commit-msg" hook.
- .vscode/extensions.json Recommended VSCode extensions.
- .vscode/settings.json Recommended VSCode configuration.
- lint-staged.config.js lint-staged configuration file - Run linters on git staged files.
- .eslintrc.js ESLint configuration file - Find and fix problems in your JavaScript code.
- .eslintignore ESLint ignore files configuration.
- prettier.config.js Prettier configuration file - An opinionated code formatter.
- .prettierignore Prettier ignore files configuration.
- stylelint.config.js StyleLint configuration file - A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
- .stylelintignore StyleLint ignore files configuration.
- verify-commit-msg.js Check whether the Git Commit Message format meets requirements.
Attention
ESLint and Prettier may not check files that start with. eslintrc.js or ".prettier.js" by default. You need to run the ".eslintignore" and ".prettierignore "for mandatory checking.
!.eslintrc.js
!.prettierrc.js
!.stylelintrc.js
Development
Create a new project and go to the root directory
-
mkdir <dirname> && cd <dirname>
Inside the project root directory -
npm init -y
Run the command to check whether the following configuration file is generated ts-node <path>/kunlun-fabric/src/generator.ts
The default configuration rules are as follows
- .husky/commit-msg
- .husky/pre-commit
- .husky/prepare-commit-msg
- .vscode/extensions.json
- .vscode/settings.json
- .eslintrc.js
- .editorconfig
- .eslintignore
- .prettierignore
- .stylelintignore
- lint-staged.config.js
- prettier.config.js
- stylelint.config.js
- verify-commit-msg.js
Build
pnpm build