加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 23:20:53 所属栏目:安全 来源:网络整理
导读:一、利用shell简化组合命令 set - eCVERSION =$(git tag | tail - 1 ) echo " current version:$CVERSION " echo " Enter release version: " read VERSIONread -p " Releasing $VERSION - are you sure? (y/n) " -n 1 - r echo # (optional) move to a new

一、利用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 [email?protected]:xxx/xxxx.git master:gh-pages

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读