0.0.9 • Published 3 years ago
berry-test-npm v0.0.9
使用
在main.js中
import * as szzjUtils from 'berry-test-npm'
Vue.prototype.szzjUtils = szzjUtils
在*.vue中
this.szzjUtils.addOne(21)
打包发布
// 检查仓库是否被设成了淘宝镜像库(https://registry.npm.taobao.org/)
npm config get registry
// 如果设置了淘宝镜像,执行以下命令
npm config set registry=http://registry.npmjs.org
// 先打包后发布
npm run build
// 解决问题后重新发布
npm publish
// 发布成功以后,在设会淘宝镜像
npm config set registry=https://registry.npm.taobao.org/
目录说明
|-- project
|-- .DS_Store
|-- .gitignore
|-- README.md
|-- package.json
|-- test // 自动化测试
|-- tsconfig.json
|-- default_theme // docs的自定义样式模板
|-- dist // tsc 打包后的 js 文件 和 index.d.ts
|-- docs // documentation 输出的说明文档
|-- src // 函数库文件夹
|-- .DS_Store
|-- _README.ts // 公共函数库总体说明文档
|-- base.ts // 公共函数库单个功能文件
|-- index.ts // 公共函数库统一暴露文件
说明
why documentation ?
1.gayhub 5000+ star 470 fork 最新提交 一个月前
2.ui好看
3.命令行一键打包生成 只要写注释,无需其他
4.支持生产md html
5.support ts 但是不支持ts js混用
一次只能生成一个版本的文档,不能多个版本切换
首页说明:_README.js 目前模板没有首页说明,为了以后方便修改首页说明,选择加前缀的方式_
生成html: documentation build src/** -f html -o docs
自定义主题: documentation build src/** -f html -o docs --theme default_theme
生成md: documentation build src/** -f md -o docs.md
为ts生成文档: documentation build src/**.ts --parse-extension ts -f html -o docs
demo
/**
* @description 方法描述
* @param {number} num 输入一数字
* @returns {number} 输出该数字加一
* @example
* addOne(1) // 2
*/
function addOne(num:number) {
return num + 1
}
export default addOne