从零系列--开发npm包(二)

一、利用shell简化组合命令
set -e

CVERSION=$(git tag | tail -1) 
echo "current version:$CVERSION"

echo "Enter release version: "
read VERSION

read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
echo    # (optional) move to a new line

if [[ $REPLY =~ ^[Yy]$ ]]
then
  echo "Releasing $VERSION ..."
  
  # commit
  git add -A
  git commit -m "[build] $VERSION"
  npm version $VERSION --message "[release] $VERSION"

  # publish
  git push -u origin master
  git push
  npm publish
fi

 

二、利用gitbook编写文档

1、安装gitbook

npm i -g gitbook-cli -d 

2、docs目录结构

.
├── book.json
├── README.md
├── SUMMARY.md
├── part1/
|   ├── README.md
|   └── something.md
└── part2/
    ├── README.md
    └── something.md

3、特殊文件描述

文件                描述
book.json          配置数据 (optional)
README.md          电子书的前言或简介 (required)
SUMMARY.md         电子书目录 (optional)
GLOSSARY.md        词汇/注释术语列表 (optional)

 

4、SUMMARY.md文件内容

# xx* [Introduction](README.md)
* [Part I](part1/README.md)
    * [Writing is nice](part1/writing.md)
    * [GitBook is nice](part1/gitbook.md)
* [Part II](part2/README.md)
    * [We love feedback](part2/feedback_please.md)
    * [Better tools for authors](part2/better_tools.md)

5、利用shell组合命令

cd docs
rm -rf _book
gitbook install
gitbook build

cd _book
git init
git add -A
git commit -m 'update book'
git push -f git@gitlab.com:xxx/xxxx.git master:gh-pages

 

转载于:https://www.cnblogs.com/sjptech/p/9581472.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值