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

@lzwme/git-helper

v1.7.1

Published

一个简单的 git 提交等操作的辅助小工具

Downloads

14

Readme

@lzwme/git-helper

@lzwme/git-helper

NPM version node version license

build status npm download GitHub issues GitHub forks GitHub stars

一个基于 Node.js 的简单的 git commit 等操作的辅助性工具。

在中大型前端项目的开发中,为了编码规范与质量保障,基本都会配置 husky、lint-staged 等 githooks 工具来约束 git 提交的规范性检测,如 commitlint、ESLint、StyleLint、prettier、单元测试等等。

这些约束在保障开发提交规范性的同时,也大大的增加了 git commit 的执行时间,随着项目开发周期的增长和复杂度的提升,带来的开发体验也会越来越糟糕。

最常见的 git commit 动作一般主要为:

git add *
git commit -m "feat: test"
git pull --rebase
git push

那么不如将这个动作写为一个脚本,让它自己飞一会儿。本项目主要就是实现为一个包含这样的功能的小工具。

你也可以结合一些 git 客户端提供的工作流功能一起辅助性配置该流程。

INSTALL

npm global install:

npm i -g @lzwme/git-helper
gh --help

or use npx:

npx @lzwme/git-helper -h

Useage

githelper --help
gh commit --help
gh run --help

提示:

githelper 有一个短的别名 gh,类似的:

  • githelper commit 命令有短别名 gh cmgh c
  • gh run 命令有短别名: gh r

gh commit 示例:

# git add & git commit & git pull --rebase
gh c -m "chore: update deps"

# git add & git commit --amend
gh c -m "chore: update deps" --amend

# git add & git commit & git pull --rebase & git push
gh c -m "chore: update deps" -p

# git add & git commit --no-veify & git pull --rebase & git push
gh c -m "chore: update deps" -p -n

# git add & # git commit --no-veify & git push
gh c -m "chore: update deps" -p -n -N

gh run 示例:

# help
gh r -h

# git update
gh r -u

# run custom conmand group of abc
gh r -c abc

配置文件

配置文件名称为 git-helper.config.js, 默认在当前项目执行目录下,也可以通过命令行参数 -c 指定。示例:

// git-helper.config.js

/**
 * @type {import('@lzwme/git-helper').IConfig}
 */
 export default {
  debug: false,
  baseDir: process.cwd(),
  commit: {
    messageReg: /^(fix|feat|pref|test|doc):.+/,
    push: true,
    noVerify: false,
  },
  run: {
    cmds: {
      test: {
        desc: 'test',
        list: ['npm run lint', 'npm run test']
      },
    },
  },
};

配置文件是可以缺省的,命令行参数的优先级比它更高。

常见使用方式示例

  • githelper commit 命令常用方式示例:
# 执行 git commit,包括 add、commit、rebase
gh c -m "feat: test for lzwme"

# 执行 git commit,包括 add、commit、rebase、push
gh c -m "feat: test for lzwme" --push

# 执行 git commit,覆盖上一次的提交(若最近一次提交已推送至远端则失败)
gh c -m "feat: test for lzwme" --amend

# 执行 git commit,覆盖上一次的提交,且不修改注释
gh c --amend

# 执行 git commit,不执行 pull、push
gh c -m "feat: test for lzwme" --no-push --no-pull

开发

本地二次开发:

git clone https://github.com/lzwme/git-helper
yarn install
npm link
yarn dev

或者 fork 本项目进行代码贡献。

欢迎贡献想法与代码。

License

@lzwme/git-helper is released under the MIT license.

该插件由志文工作室开发和维护。