Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Latest commit

 

History

History
59 lines (47 loc) · 1.19 KB

README.md

File metadata and controls

59 lines (47 loc) · 1.19 KB

npm-use-latest

How it works

  1. Searches your package.json for github dependencies, indicated by the github: prefix
  2. Fetches their latest commit ID using git ls-remote
  3. Appends the new commit ID to the dependency, forcing npm to install the latest version
Before
{
  ...
  "dependencies": {
  	"react": "github:facebook/react",
  	"lodash": "github:lodash/lodash"
  }
}
During
$ npm-use-latest
Fetching latest commit ID for react
Fetching latest commit ID for lodash
Successfully updated package.json
After
{
  ...
  "dependencies": {
    "react": "github:facebook/react#4045747af6bb83a73ef6057abd07017ee056a5f7",
    "lodash": "github:lodash/lodash#2c5f026d3c59a38c429246513437681569b523b8"
  }
}

Install

npm i -g cmmartin/npm-use-latest

I'll publish this to npm eventually and save you those extra 9 characters

Usage

Navigate to your project root and run it!

cd path/to/my/project/root
npm-use-latest

Requirements

  • A recent enough version of npm that supports github dependencies
  • A recent enough version of node.js that supports ecma 6 syntax (const, arrow functions, etc)
  • git