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

github-repo-backup

v1.0.0

Published

Backup all github repos, (This is a [zx](https://github.com/google/zx) based script)

Downloads

1

Readme

Github backup

Backup all github repos, (This is a zx based script)

Quick usage

npx zx https://cdn.jsdelivr.net/gh/tbxark/github-backup/backup.mjs
npx zx https://cdn.jsdelivr.net/gh/tbxark/github-backup/mirror.mjs

Install

npm i -g zx

wget https://cdn.jsdelivr.net/gh/tbxark/github-backup/backup.mjs
wget https://cdn.jsdelivr.net/gh/tbxark/github-backup/mirror.mjs

chmod +x backup.mjs mirror.mjs

./backup.mjs --config=$(PATH_TO_CONFIG) --target=$(PATH_TO_STORE_DIR) 
./mirror.mjs --config=$(PATH_TO_CONFIG) --target=$(PATH_TO_STORE_DIR) --token=${GITEE_TOKEN}

Option

  • target

    The target directory to store the backup. Default is ./.

  • config

    The config file, the default is ./github_backup_config.json, create a config file if not exists

  • clone

    Opitions: all, none, question Usage in backup.mjs only

    Whether to clone the repos, the default is all

  • untracked

    Opitions: question, delete, keep Usage in backup.mjs only

    Whether to delete untracked repos, the default is question

  • branch

    Opitions: all, current Usage in backup.mjs only

    When branch is all, clone all branches. When branch is current, clone only the current branch.

  • token:

    Usage in mirror.mjs only

    The token to access Gitee.

  • private:

    Opitions: always, auto Usage in mirror.mjs only

    create private repos or not, the default is auto

Configuration

Configuration file will auto generate if not exists. You can edit the config file to change value.

{
  "username": "tbxark",
  "token": "YOUR_TOKEN", // https://github.com/settings/tokens
  "repos": {
    "TKRubberIndicator": {
      "name": "TKRubberIndicator",
      "ignore": false, // If true, do not clone to the local
      "keep": true, // If true, keep a local backup when the remote repo is deleted
      "status": {
        "private": false,
        "fork": false,
        "archived": false
      },
      "date": {
        "created_at": "2015-10-28T02:14:22Z",
        "updated_at": "2022-02-07T08:09:48Z"
      },
      "ssh_url": "[email protected]:TBXark/TKRubberIndicator.git",
    }
   }
 }

中文

备份

使用备份脚本需要config配置文件路径,当配置文件不存在的时候会自动创建。target是存储repo的目录,clone可以选择:all下载所有repo,none忽略未下载的repo,或者其他值根据repo手动选择。 当github的token过期的时候可以手动修改配置文件中的token值。或者某个repo的配置有问题也可以手动的修改配置文件。

./backup.mjs --config=$(PATH_TO_CONFIG) --target=$(PATH_TO_STORE_DIR) --clone=${all|none|question}

镜像

暂时只写了一个将repos镜像到gitee的脚本, 这个得clone本仓库后使用,需要gitee的token,会自动创建不存在的repo。 可以根据原有github仓库类型创建私有还是公有仓库(公有仓库得手机号码认证),也可以全部设置为私有。

./mirror.mjs --config=$(PATH_TO_CONFIG) --target=$(PATH_TO_STORE_DIR) --token=${GITEE_TOKEN} --private=${always|auto}

碎碎念

最近看得到v2ex上有人github账户被封,俄罗斯也被米国盟友各种制裁。感觉把所有代码放在Github上不备份其实不太安全。 现有其他git平台不能实时同步github的仓库。得在每个github的repo添加action去同步,过于麻烦。 所以还是先备份到本地,然后再同步到另外的git平台。而且本地多一个备份也比较安全。