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-crud

v2019.1.21

Published

this zero-dependency package will provide a simple cli-tool to PUT / GET / DELETE github files

Downloads

12

Readme

github-crud

this zero-dependency package will provide a simple cli-tool to PUT / GET / DELETE github files

live web demo

  • none

screenshot

travis-ci.org build-status coverage

NPM

build commit status

| git-branch : | master | beta | alpha| |--:|:--|:--|:--| | test-report : | test-report | test-report | test-report| | coverage : | coverage | coverage | coverage| | build-artifacts : | build-artifacts | build-artifacts | build-artifacts|

npmPackageListing

npmPackageDependencyTree

table of contents

  1. cdn download
  2. documentation
  3. quickstart shell example
  4. quickstart example.js
  5. extra screenshots
  6. package.json
  7. changelog of last 50 commits
  8. internal build script
  9. misc

cdn download

documentation

cli help

screenshot

api doc

apidoc

todo

  • add web-demo
  • none

changelog 2019.1.21

  • npm publish 2019.1.21
  • add functions githubRepoCreateList, githubRepoDeleteList
  • rename functions githubBranchCreate -> githubRepoCreate, githubBranchDelete -> githubRepoDelete
  • none

this package requires

  • darwin or linux os

quickstart shell example

to run this example, follow the instruction in the script below

# example.sh

# this shell script will auto-generate documentation for the mysql npm-package with zero-config

# 1. npm install github-crud
cd /tmp && npm install github-crud
# 2. init env vars
export BRANCH=gh-pages
export GITHUB_REPO=kaizhu256/node-github-crud
# get $GITHUB_TOKEN from https://github.com/settings/tokens
export GITHUB_TOKEN="${GITHUB_TOKEN:-xxxxxxxx}"

# 3. test github-crud put
shPrintAndEval () {
    printf "\n\n\n"
    printf "\$ $*\n\n"
    eval "$@"
    return 0
}
printf "hello world\\n" > /tmp/hello.txt
shPrintAndEval \
/tmp/node_modules/.bin/github-crud put "https://github.com/$GITHUB_REPO/blob/$BRANCH/foo/bar/hello.txt /tmp/hello.txt commit-message-1"

# 4. test github-crud get
shPrintAndEval \
/tmp/node_modules/.bin/github-crud get "https://github.com/$GITHUB_REPO/blob/$BRANCH/foo/bar/hello.txt"

# 5. test github-crud touch
shPrintAndEval \
/tmp/node_modules/.bin/github-crud touch "https://github.com/$GITHUB_REPO/blob/$BRANCH/foo/bar/hello.txt commit-message-2"

# 6. test github-crud delete
shPrintAndEval \
/tmp/node_modules/.bin/github-crud delete "https://github.com/$GITHUB_REPO/blob/$BRANCH/foo/bar/hello.txt commit-message-3"

output from shell

screenshot

quickstart example.js

to run this example, follow the instruction in the script below

/*
example.js

this script will run a web-demo of github-crud

instruction
    1. save this script as example.js
    2. edit env vars below
    3. run the shell command:
        $ npm install github-crud && node example.js
    4. edit this script to suit your needs
*/



/* istanbul instrument in package github_crud */
/* jslint utility2:true */
(function () {
"use strict";



/*
 * edit begin
 * edit env vars below
 */
process.env.BRANCH = "gh-pages";
process.env.GITHUB_REPO = "kaizhu256/node-github-crud";
// get $GITHUB_TOKEN from https://github.com/settings/tokens
process.env.GITHUB_TOKEN = process.env.GITHUB_TOKEN || "xxxxxxxx";
/*
 * edit end
 */



var local;
var modeNext;
var onNext;
modeNext = 0;
/* istanbul ignore next */
onNext = function (error, data) {
    if (error) {
        console.error(error);
    }
    modeNext += 1;
    switch (modeNext) {
    // init
    case 1:
        if (
            typeof window === "object"
            || global.utility2_rollup // jslint ignore:line
        ) {
            return;
        }
        local = require("github-crud");
        module.exports = local;
        if (
            process.env.npm_config_mode_auto_restart
            || process.env.npm_config_mode_test
        ) {
            return;
        }
        onNext();
        break;
    // test github-crud put
    case 2:
        console.error("\n\n\ngithub-crud put /foo/bar/hello.txt\n");
        local.githubCrudContentPut({
            content: "hello world\n",
            message: "commit message 1",
            url: "https://github.com/" + process.env.GITHUB_REPO + "/blob/"
            + process.env.BRANCH + "/foo/bar/hello.txt"
        }, onNext);
        break;
    // test github-crud get
    case 3:
        console.error("\n\n\ngithub-crud get /foo/bar/hello.txt\n");
        local.githubCrudContentGet({
            url: "https://github.com/" + process.env.GITHUB_REPO + "/blob/"
            + process.env.BRANCH + "/foo/bar/hello.txt"
        }, onNext);
        break;
    // test github-crud touch
    case 4:
        console.error(String(data));
        console.error("\n\n\ngithub-crud touch /foo/bar/hello.txt\n");
        local.githubCrudContentTouch({
            message: "commit message 2",
            url: "https://github.com/" + process.env.GITHUB_REPO + "/blob/"
            + process.env.BRANCH + "/foo/bar/hello.txt"
        }, onNext);
        break;
    // test github-crud delete
    case 5:
        console.error("\n\n\ngithub-crud delete /foo/bar/hello.txt\n");
        local.githubCrudContentDelete({
            message: "commit message 3",
            url: "https://github.com/" + process.env.GITHUB_REPO + "/blob/"
            + process.env.BRANCH + "/foo/bar/hello.txt"
        }, onNext);
        break;
    }
};
onNext();
}());

output from shell

screenshot

extra screenshots

  1. https://kaizhu256.github.io/node-github-crud/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fapidoc.html.png screenshot

  2. https://kaizhu256.github.io/node-github-crud/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Fcoverage.lib.html.png screenshot

  3. https://kaizhu256.github.io/node-github-crud/build/screenshot.buildCi.browser.%252Ftmp%252Fbuild%252Ftest-report.html.png screenshot

package.json

{
    "author": "kai zhu <[email protected]>",
    "bin": {
        "github-crud": "lib.github_crud.js"
    },
    "description": "this zero-dependency package will provide a simple cli-tool to PUT / GET / DELETE github files",
    "devDependencies": {
        "electron-lite": "kaizhu256/node-electron-lite#alpha",
        "utility2": "kaizhu256/node-utility2#alpha"
    },
    "engines": {
        "node": ">=10.0"
    },
    "homepage": "https://github.com/kaizhu256/node-github-crud",
    "keywords": [
        "github-crud"
    ],
    "license": "MIT",
    "main": "lib.github_crud.js",
    "name": "github-crud",
    "nameAliasPublish": "github-content-api github-content-lite",
    "nameLib": "github_crud",
    "nameOriginal": "github-crud",
    "os": [
        "darwin",
        "linux"
    ],
    "repository": {
        "type": "git",
        "url": "https://github.com/kaizhu256/node-github-crud.git"
    },
    "scripts": {
        "build-ci": "./npm_scripts.sh",
        "env": "env",
        "eval": "./npm_scripts.sh",
        "heroku-postbuild": "./npm_scripts.sh",
        "postinstall": "./npm_scripts.sh",
        "start": "./npm_scripts.sh",
        "test": "./npm_scripts.sh",
        "utility2": "./npm_scripts.sh"
    },
    "version": "2019.1.21"
}

changelog of last 50 commits

screenshot

internal build script

  • build_ci.sh
# build_ci.sh

# this shell script will run the build for this package

shBuildCiAfter () {(set -e
    shDeployCustom
    # shDeployGithub
    # shDeployHeroku
    shReadmeTest example.sh
    rm -fr /tmp/node_modules
)}

shBuildCiBefore () {(set -e
    shNpmTestPublished
    shReadmeTest example.js
)}

# run shBuildCi
eval "$(utility2 source)"
shBuildCi

misc