Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including git-modules with all npm packages installed. Try it out:

var gitModules = require("git-modules")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

git-modules v0.1.20

git-modules is a multi scoped npm-repository based on a single git repository.

#git-modules git-modules is a multi scoped npm-repository based on a single git repository.


  • create a workspace (any directory will work)
  • create an empty "git-modules.json" inside your workspace (empty means "{}")
  • "git init" your workspace
  • create a package directory within workspace
  • create a scope inside the package directory (a directory starting with an "@" char)
  • create a node package inside a scope

If you did everything correctly, you should have a directory structure like this:

  • workspace/packages/@scope/mypackage/package.json
  • workspace/git-modules.json

HINT: You can change "@scope" to "@whateveryouwant"


Install git-modules

    npm install git-modules

Start repository server (cwd: workspace/node_modules/git-modules)

    node index.js

This will start a local bound npm server on port 9292 You can change the port by setting "port" in the "git-modles.json"


Publish your package (cwd: workspace/packages/@scope/mypackage)

   npm publish

Install the latest package

$ npm install @scope/mypackage

Install a specific version (use --save as usual if you want)

$ npm install @scope/mypackage@0.0.1

Using npm to create a patch version (cwd: workspace/packages/@scope/mypackage)

   npm version patch

Republish your patched package (cwd: workspace/packages/@scope/mypackage)

   npm publish

Use your package

var mypackage = require('@scope/mypackage');

How it works

We create a http server to simulate a npm repository. Under the hood we start some shell git commands on every http request. "git archive" is used to create the tar package we send to the npm client. The publishing is based on git tags.

Problems ? Questions ? Answers ? Happy to hear.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free