A repo to provide a template about TypeScript lint & format.
A repo to provide a template about TypeScript lint & format.
npm i
If you just clone this repo, note that it is important to prepare husky
npm run prepare
Make sure the file commit-msg and pre-commit are executable. if Not, then run the following commands.
chmod a+x .husky/commit-msg
chmod a+x .husky/pre-commit
Name | Desc | Config | Ignore Config |
---|---|---|---|
npm run prepare | prepare husky | - | - |
npm run lint | code lint | .eslintrc.json | .eslintignore |
npm run lint:fix | code lint fix | - | - |
npm run prettier | check files whether have code style issues | .prettierc.json | .prettierignore |
npm run prettier:fix | re-write the code using prettier format config | - | - |
npm run pretty | format the staged files | - | - |
npm run release | release new version |
Note: more
commmand: npm run release will update version in package.json/package-lock.json
and will commit it to git. such as 37364c
Commit message should follow the pattern like this
type(scope?): subject
#scope is optional; multiple scopes are supported (current delimiter options: "/", "\" and ",")
Type Enum
Type | Desc |
---|---|
build | changes to the build process or related tools |
chore | other modify |
ci | git CI/CD files modified |
docs | documentation, like docs,README.md,CHANGELOG.md |
feat | new feature |
fix | bug fix |
perf | code performance |
refactor | code refactor |
revert | git revert |
style | code lint or format |
test | new test |
How It Works
Follow the Conventional Commits Specification in your repository.
When you're ready to release, run standard-version.
standard-version will then do the following:
Note
fix: which represents bug fixes, and correlates to patch version.
feat: which represents a new feature, and correlates to a minor version.
feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a major version.
There will be different configurations according to different projects.
After initializing the project, please select the configuration you need according to the project.
Now, in the examples directory, there are the following configurations for reference.
You can directly copy the configuration in the example to the project.