# vanilla-ts

[![TypeScript](https://img.shields.io/badge/lang-typescript-informational?style=flat-square)](https://www.typescriptlang.org)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![版权](https://img.shields.io/badge/copyright-联众智慧科技股份有限公司-informational.svg?style=flat-square")](#版权)

> 注意: 当前工程基于 npm@6.x 来配置，注意 NPM 的版本变化

使用 `rollup.js` 构建一个可以在 nodejs 和浏览器中运行，可复用的 NPM 模块.

## 目录结构

```text
Project/
├── .vscode/
├── src/
├── .editorconfig
├── .eslintrc.js
├── .prettierrc
├── package.json
└── tsconfig.json
```

## 快速开始

你需要安装 `nodejs>=12`，克隆此仓库后运行:

```bash
# 安装依赖
$ yarn install

# 本地开发推荐
# 运行单元测试并监听变化
$ yarn test --watchAll

# 生成 ts 文档
$ yarn doc
```

可以写测试用例来开发功能，保证代码和实际输出一致

## 代码检查

```bash
# 代码格式化
$ yarn format

# 语法检查
$ yarn lint
```

## 单元测试

```bash
# 单元测试
$ yarn test

# 生成测试覆盖率
$ yarn run cov
```

## 版本发布

```bash
# 修改版本
# 文档说明 https://docs.npmjs.com/cli/v6/commands/npm-version
$ npm version <newversion|major|minor|patch>

# 发布到 npm 仓库
# 文档说明 https://docs.npmjs.com/cli/v6/commands/npm-publish
$ npm publish
```

**必知必会**

- [语义化版本](https://semver.org/lang/zh-CN/)
- [npm-dist-tag](https://docs.npmjs.com/cli/v6/commands/npm-dist-tag)

## 版权

(c) 2021 @联众智慧科技股份有限公司

[nodejs]: https://nodejs.org
