diff --git a/README.md b/README.md index b70ffda0..af937ff8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -registry-mirror -=============== +npm on IPFS +=========== + +> previously known as `registry-mirror` ![](/img/ip-npm-small.png) @@ -10,7 +12,7 @@ registry-mirror ![](https://img.shields.io/badge/coverage-76%25-yellow.svg?style=flat-square) -> registry-mirror sets a mirror the the whole NPM registry, using IPFS for the discovery and transport of modules. +> **Install your modules through IPFS!!** This CLI utility enables you to clone the npm registry into IPFS and/or mirror the registry from IPFS. # Resources @@ -18,114 +20,41 @@ registry-mirror - [Lengthy introduction in a blog post](http://blog.daviddias.me/2015/12/08/stellar-module-management) - [Node.js Interactive Talk - Stellar Module Management](https://www.youtube.com/watch?v=-S-Tc7Gl8FM) -# Quick setup (probably all that you need) - -## Install IPFS dev0.4.0 - -To install IPFS dev0.4.0, you will need go installed, to install go in your machine, go to https://golang.org/dl and then run: - -```bash -$ go get -u github.com/ipfs/go-ipfs -$ ipfs version -ipfs version 0.4.0-dev -``` - -## Run IPFS daemon - -```bash -$ ipfs daemon -Initializing daemon... -Swarm listening on /ip4/127.0.0.1/tcp/4001 -Swarm listening on /ip4/192.168.1.64/tcp/4001 -Swarm listening on /ip4/192.168.10.172/tcp/4001 -Swarm listening on /ip6/2001:8a0:7ac5:4201:4816:fd56:bea7:eaf3/tcp/4001 -Swarm listening on /ip6/2001:8a0:7ac5:4201:ae87:a3ff:fe19:def1/tcp/4001 -Swarm listening on /ip6/::1/tcp/4001 -API server listening on /ip4/127.0.0.1/tcp/5001 -Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080 -Daemon is ready -``` - -## Install registry-mirror - -```bash -$ npm i registry-mirror -g -``` - -# Usage - -Wait for the `Updated directory listing` log. - -```bash -$ registry-mirror daemon -registry-mirror [info] using output directory /npm-registry/ -registry-mirror [info] listening on 127.0.0.1:50321 -registry-mirror [info] Cloning NPM OFF -registry-mirror [info] Updated directory listing, good to go :) -``` - -Port `50321` is default and can be set with `--port`. - -## Configure npm - -Set up your npm to use `registry-mirror` with the default port through: +# Installation ```bash -$ npm config set registry http://localhost:50321 +> npm install ipfs-npm --global ``` -If you picked another `--port` you need to adjust accordingly. - -Good to npm install away! :) +This will make the `ipfs-npm` CLI tool available globally and an alias, `ipnpm`. We will use the alias for examples and API documentation, as it is shorter. # Usage -## CLI - -```bash -$ registry-mirror -Usage: registry-mirror COMMAND [OPTIONS] - -Available commands: - -daemon Mirror npm registry -ls Check modules available in the mirror -npm publish Publish an IPNS record with your current npm list -npm update Update your npm list of modules from IPNS -``` - -## Commands - -### daemon - -> starts the registry-mirror daemon +> **WIP** -`$ registry-mirror daemon` +### Examples -Options: -- `--clone` - Download the entire npm (Otherwise it just tries to read) -- `--port=` Listen on the specified port -- `--host=` Listen on the specified port +### API -### ls +#### `ipnpm registry` commands -> lists all the modules available on the IPFS accessible registry and their respective hashes +##### `ipnpm registry clone` - Download and store the entire npm repository into IPFS -`$ registry-mirror ls` +options + seq number + ipfs= -### npm update +##### `ipnpm registry index publish` - Publishes the current index we know as an IPNS name -> update your local registry cache +##### `ipnpm registry index fetch` - Fetches the latest known index from the IPFS network -`$ registry npm update` +#### `ipnpm daemon` - Starts an ipfs-npm daemon, so that we can point our npm cli to it -### npm publish +#### `ipnpm install ` - Similar to `npm install`, however it tries first to download the module from npm and then falls back into the regular registry -> publish the version of the cache you have from npm -`$ registry npm publish` -## Important +## Important: Getting 502 errors? If you are on Mac OS X, make sure to increase the limit of files open (with `ulimit -Sn 4096`), otherwise the ipfs daemon will be sad and throw 502 replies. diff --git a/package.json b/package.json index e9173401..1df37de2 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { - "name": "registry-mirror", + "name": "ipfs-npm", "version": "0.6.3", "description": "Set up a NPM registry mirror, using your favourite storage, IPFS! :D", "main": "src/index.js", "bin": { - "registry-mirror": "src/cli/bin.js" + "ipfs-npm": "src/cli/bin.js", + "ipnpm": "src/cli/bin.js" }, "scripts": { "test": "mocha tests/test-*/index.js", @@ -17,7 +18,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/diasdavid/registry-mirror.git" + "url": "git+https://github.com/diasdavid/ipfs-npm.git" }, "keywords": [ "IPFS" @@ -25,9 +26,9 @@ "author": "David Dias ", "license": "MIT", "bugs": { - "url": "https://github.com/diasdavid/registry-mirror/issues" + "url": "https://github.com/diasdavid/ipfs-npm/issues" }, - "homepage": "https://github.com/diasdavid/registry-mirror#readme", + "homepage": "https://github.com/diasdavid/ipfs-npm#readme", "dependencies": { "async": "^1.5.2", "debug": "^2.2.0",