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

micro-github-latest

v1.3.0

Published

Microservice for downloading the latest asset of GitHub release.

Downloads

18

Readme

Micro-github-latest

Microservice for downloading the latest asset of GitHub release.

Further reading: [中文] Microservice 產品交付 - Dockerize 與 Zeit JavaScript 跨平台解決方案

Travis Codecov Status Github Tag node

Dependency Status devDependency Status peerDependency Status Greenkeeper badge prettier license

Feature

  • [x] Internal 304 cache handler for GitHub Api. PR#5
  • [x] Handle error 403, fallback to githut releases/latest page when rate limit exceeded. PR#19

How To Use

a. Deploy to Now.sh

One click deploys to △ now

Deploy to now

b. Binary executable

Download from GitHub latest release.

$ ORIGIN=$YOUR_DOMAIN \
  ACCESS_TOKEN=$GITHUB_ACCESS_TOKEN \
  ./micro-github-latest-macos --port $PORT

Note: You can run it without Node.js installed.

c. Docker image

Pull from dockerhub.

Docker Automated build Docker Pulls Docker Size

$ docker pull evenchange4/micro-github-latest:latest
$ docker run --rm -it \
  -p $PORT:3000 \
  -e "ORIGIN=YOUR_DOMAIN" \
  -e "ACCESS_TOKEN=GITHUB_ACCESS_TOKEN" \
  evenchange4/micro-github-latest:latest

d. NPM CLI

Install from npm.

npm downloads npm

$ npm i micro-github-latest -g

$ ORIGIN=$YOUR_DOMAIN \
  ACCESS_TOKEN=$GITHUB_ACCESS_TOKEN \
  micro-github-latest --port $PORT

Note: You should use Node.js >= 8 .

API

Environment variables

| ENV | Required | Default | Description | | --------- | --------- | --------- | --------- | | ORIGIN | | * | Setup access-control-allow-origin for CORS. | | ACCESS_TOKEN | | | Setup GitHub access token with the repo scope. |

Note: You should use ACCESS_TOKEN to increase the rate limit.

CLI arguments

$ micro-github-latest --help
Usage: micro-github-latest <command> [options]

Options:
  -p, --port     HTTP server PORT                                [default: 3000]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

URL pathname

| Method | Pathname | Description | | --------- | --------- | --------- | | GET | /:owner/:repo/latest | 302 redirect to the first asset of latest release. | | GET | /:owner/:repo/:name/latest | 302 redirect to the first matched one by asset name of latest release. | | GET | /rate_limit | Get your current rate limit status. |

Demo

  • https://micro-github-latest.now.sh/evenchange4/micro-medium-api/macos/latest
  • https://micro-github-latest.now.sh/mcs-lite/mcs-lite-app/win64/latest
  • https://micro-github-latest.now.sh/atom/atom/latest
  • https://micro-github-latest.now.sh/rate_limit
  • Real-World case: mcslite.netlify.com [source code]

Note: You should deploy your own service for production usage.

Technology Stacks

  • Micro: Asynchronous HTTP microservices.
  • Micro-router: A tiny and functional router for Zeit's Micro.
  • Dockerhub: Automatically deploy docker image.
  • Now.sh: Realtime global deployments
  • Pkg: Package your Node.js project into an executable
  • Travis: CI

Developer Guide

Requirements

  • node >= 8.5.0
  • npm >= 5.3.0
  • yarn >= 1.0.2
$ git clone https://github.com/evenchange4/micro-github-latest.git
$ yarn install --pure-lockfile

$ yarn run dev # dev server
$ yarn start   # prod server
$ yarn run pkg # output binary files

Test

$ yarn run format
$ yarn run eslint
$ yarn run test:watch

Docker

$ docker build -t micro-github-latest .

# Push to dockerhub
$ git push

Note: Multi-stage builds are a new feature in Docker 17.05.

Github release / NPM release

$ npm version patch
$ git push

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ yarn run test).

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org