项目搭建
使用 TypeScript library starter 创建的项目集成了很多优秀的开源工具:
- Zero-setup. After running npm install things will setup for you 😉
- RollupJS for multiple optimized bundles following the standard convention and Tree-shaking
- Tests, coverage and interactive watch mode using Jest
- Prettier and TSLint for code formatting and consistency
- Docs automatic generation and deployment to gh-pages, using TypeDoc
- Automatic types (*.d.ts) file generation
- Travis integration and Coveralls report
- (Optional) Automatic releases and changelog, using Semantic release, Commitizen, Conventional changelog and Husky (for the git hooks)
初始化
```bash git clone https://github.com/alexjoverm/typescript-library-starter.git YOURFOLDERNAME cd YOURFOLDERNAME
Run npm install and write your library name when asked. That’s all!
npm install
执行install之后,会提示是否以`YOURFOLDRNAME`(例如:ts-axios)为lib名称,选择yes之后,会自动替换项目中`--libraryname--`占位符,包括package.json文件中信息。<a name="NZLPR"></a>### 提交代码```bashnpm run commit
项目配置了[cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog),规范提交信息。它是通过 commitlint 配置的规则。
"config": {"commitizen": {"path": "node_modules/cz-conventional-changelog"}}
