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

pushcode

v1.0.1

Published

自动化推动代码到远程仓库

Downloads

6

Readme

业务应用场景:

你的项目在A仓库,需要上线测试环境,线上环境等。但是测试环境使用的仓库是B仓库,正式环境使用的仓库是C仓库,那怎么办?(本地代码复制3份,然后写完一个功能复制,粘贴到另外两个仓库?,不妥);那你可以试试这个脚本。

观看视频介绍

安装

yarn add pushcode
// or
npm install pushcode

功能

查看帮助

yarn run deploy --help
// or
yarn run deploy reset --help
  • 1、程序化推送代码到任意远程仓库

  • 2、程序化回滚远程仓库代码

    • 回滚到上一次提交记录

    • 回滚到任意的提交记录

    • 根据tag回滚代码

  • 3、自动保存用户名密码,支持重置用户名密码

配置

添加脚本命令 (必选)

package.json中新增命令

"scripts": {
  "deploy": "pushcode"
}

添加项目仓库配置文件 (可选)

在项目根目录新增.git_pushcode_config.js文件,内容格式如下:

//  测试环境仓库地址
const dev_url = ''
// 预上线环境仓库地址
const preonline_url = ''
// 线上环境仓库地址
const online_url = ''
// 脚本根据本地分支自动推送到不同的远程仓库,测试环境对应本地dev分支同理类推
const dev_branch = 'dev'
const preonline_branch = 'release'
const online_branch = 'master'
module.exports = {
  dev_url,
  preonline_url,
  online_url,
  dev_branch,
  preonline_branch,
  online_branch
}

运行

推送代码

yarn run deploy 
// or
yarn run deploy push
// or 
yarn run deploy P

回滚代码

注意:回滚代码需要强制提交的权限。需要在 Settings > Repository > Protected Branches 设置。

yarn run deploy reset
// or
yarn run deploy R

重置git远程仓库的用户名和密码

第一次执行pushcode脚本后,程序会记录用户名密码,下次就不用再次输入了

yarn run deploy delete
// or 
yarn run deploy D

请注意

仓库地址是以下两种方式:

  • http开头:需要用户输入用户名密码。

  • ssh开头,必须确保你本地的公钥已经上传到了远程仓库