npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@belloai/bello-version

v1.0.17

Published

因为Github Actions 线上版本构建部署是通过Tag来触发的,并且Tag要按照一定的规则来,以完成线上版本的控制。为了减少人工打Tag带来的失误,因此开发一个CLI命令行工具辅助上线前的打Tag工作。

Downloads

3

Readme

bello 自动打tag工具

因为Github Actions 线上版本构建部署是通过Tag来触发的,并且Tag要按照一定的规则来,以完成线上版本的控制。为了减少人工打Tag带来的失误,因此开发一个CLI命令行工具辅助上线前的打Tag工作。

打tag规则:[分支名]-[版本号]-[日期]

前端私有化项目打tag的同时会自动生成一份Dockerfile文件,以适配腾讯云容器构建。

bello-version

使用

// 全局安装
npm install -g @belloai/bello-version

// 使用命令 查看帮助
belloVersion
// 打tag
belloVersion tag

image.png image.png

Tag标签

为什么打Tag

我们可以创建一个tag来指向软件开发中的一个关键时期,比如版本号更新的时候可以建一个“v2.0”、“v3.1”之类的标签,这样在以后回顾的时候会比较方便。 tag的使用很简单,主要操作有:查看tag、创建tag、验证tag以及共享tag。

同时为了触发腾讯云容器服务的docker构建,以便docker从COS对象存储中拉取前端源码,加快部署时间。因此Tag的命名规则为:release/sass-v1.4.2-2021-11-16

  • release:为前缀,意为发布版本。
  • sass: 为分支名,意为需要把代码更新到sass分支,并触发腾讯云容器服务构建。
  • v1.4.2:为版本,意为当前项目的版本号,会根据功能自增minor,patch版本。
  • 最后的后缀很明显了,就是当前打Tag的日期。

Tag基本操作

创建

git tag v1.4.2:创建tag git tag -a v1.4.2 -m 'first version':带信息的tag:-m后面带的就是注释信息,这样在日后查看的时候会很有用

查看

git tag: 查看tag,列出所有tag,列出的tag是按字母排序的,和创建时间没关系 git show v1.4.2: 显示指定tag的信息

push推送

git push origin v1.4.2:推送tag到gitHub仓库 git push origin --tags:将所有tag 一次全部push到github上

删除

git tag -d v1.4.2: 删除本地tag git push origin :refs/tags/v1.4.2: 删除github远端的指定tag

基于tag创建分支

git checkout -b new-branch v1.4.2:创建一个基于指定tag的分支

使用到的npm包

cac chalk inquirer semver simple-git,简单介绍下

[cac](https://www.npmjs.com/package/cac)

专门用于构建CLI应用程序的JavaScript库,对用户的输入进行提示,纠正以及解析,比如 version --help 就会显示CLI可用的命令行参数都有些啥。 image.png 用法十分简单:

// 当用户只输入version时,显示其他command的友好提示
cli.command("").action(() => {
  cli.outputHelp();
});
// version tag时执行,支持传入option参数,来控制流程
cli
  .command("tag", "Generate Tag for Current Version")
  .allowUnknownOptions()
  .action(() => {
    handleVersionTag();
  });

[chalk](https://www.npmjs.com/package/chalk)

用于美化Terminal中的字符,可以显得花里胡哨点。

[inquirer](https://www.npmjs.com/package/inquirer)

基本是CLI工具与用户进行交互必用的包了,可以收集用户输入,进行交互以执行不同的操作。

[semver](https://www.npmjs.com/package/semver)

易用,更语义化的版本管理库,semver会按[semantic versioner](https://semver.org/)规则去做版本管理。

[simple-git](https://www.npmjs.com/package/simple-git)

吹爆的git操作库,在node中可以自在的使用git操作,包括add,commit,push,pull,fetch等等,如获取本地分支:git.branchLocal(),打tag:git.addTag('tag'),基本git能做的都能在node中调用来实现。