Socket
Book a DemoInstallSign in
Socket

git-as-npm

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-as-npm

git-as-npm ===

0.0.3
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

git-as-npm

A quick and dirty (for now) script that gets git to behave a little more like NPM at times when we'd like it to. publish is the only command that currently works. Like so:

git-as-npm publish

Why?

NPM is great for managing JS modules. However, private modules aren't free, and maintaining your own registry isn't, either. Thankfully, you can install NPM dependencies directly from Git, like so:

"blah-lib": "git+ssh://git@github.com/blah/blah-lib.git"

You can also install specific tags or commits, by appending # on the end, like so:

git+ssh://git@github.com/blah/blah-lib.git#0.0.3

But the process by which you tag these releases is entirely manual.

Making it not manual

So what does this script do?

  • Checks out a branch called release (or creates it if it doesn't exist).
  • Merges your current branch into release.
  • Pulls down a remote copy of the release branch, to sync up which version numbers have already been released.
  • Runs npm prepublish, if that script exists.
  • Creates a tag with your current package.json version number, throwing an error if that release already exists.
  • Adds a new remote, as specified in the repository field of package.json
  • Pushes this up to git
  • Tidies up after itself, deleting the remote and returning you to your original branch.

Ta-da

It doesn't handle everything - you still need to specify the version when doing an npm install and so on, but hopefully it makes things a little easier.

FAQs

Package last updated on 22 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.