Skip to content

Commit 82640a4

Browse files
committed
define the CLI API
1 parent b065329 commit 82640a4

File tree

2 files changed

+27
-97
lines changed

2 files changed

+27
-97
lines changed

README.md

+21-92
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
registry-mirror
2-
===============
1+
npm on IPFS
2+
===========
3+
4+
> previously known as `registry-mirror`
35
46
![](/img/ip-npm-small.png)
57

@@ -10,122 +12,49 @@ registry-mirror
1012
![](https://img.shields.io/badge/coverage-76%25-yellow.svg?style=flat-square)
1113
<!-- While 0.4.0 doesn't get released [![Build Status](https://img.shields.io/travis/diasdavid/registry-mirror/master.svg?style=flat-square)](https://travis-ci.org/diasdavid/registry-mirror) -->
1214

13-
> registry-mirror sets a mirror the the whole NPM registry, using IPFS for the discovery and transport of modules.
15+
> **Install your modules through IPFS!!** This CLI utility enables you to clone the npm registry into IPFS and/or mirror the registry from IPFS.
1416
1517
# Resources
1618

1719
- [Demo video](https://vimeo.com/147968322)
1820
- [Lengthy introduction in a blog post](http://blog.daviddias.me/2015/12/08/stellar-module-management)
1921
- [Node.js Interactive Talk - Stellar Module Management](https://www.youtube.com/watch?v=-S-Tc7Gl8FM)
2022

21-
# Quick setup (probably all that you need)
22-
23-
## Install IPFS dev0.4.0
24-
25-
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:
26-
27-
```bash
28-
$ go get -u github.com/ipfs/go-ipfs
29-
$ ipfs version
30-
ipfs version 0.4.0-dev
31-
```
32-
33-
## Run IPFS daemon
34-
35-
```bash
36-
$ ipfs daemon
37-
Initializing daemon...
38-
Swarm listening on /ip4/127.0.0.1/tcp/4001
39-
Swarm listening on /ip4/192.168.1.64/tcp/4001
40-
Swarm listening on /ip4/192.168.10.172/tcp/4001
41-
Swarm listening on /ip6/2001:8a0:7ac5:4201:4816:fd56:bea7:eaf3/tcp/4001
42-
Swarm listening on /ip6/2001:8a0:7ac5:4201:ae87:a3ff:fe19:def1/tcp/4001
43-
Swarm listening on /ip6/::1/tcp/4001
44-
API server listening on /ip4/127.0.0.1/tcp/5001
45-
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
46-
Daemon is ready
47-
```
48-
49-
## Install registry-mirror
50-
51-
```bash
52-
$ npm i registry-mirror -g
53-
```
54-
55-
# Usage
56-
57-
Wait for the `Updated directory listing` log.
58-
59-
```bash
60-
$ registry-mirror daemon
61-
registry-mirror [info] using output directory /npm-registry/
62-
registry-mirror [info] listening on 127.0.0.1:50321
63-
registry-mirror [info] Cloning NPM OFF
64-
registry-mirror [info] Updated directory listing, good to go :)
65-
```
66-
67-
Port `50321` is default and can be set with `--port`.
68-
69-
## Configure npm
70-
71-
Set up your npm to use `registry-mirror` with the default port through:
23+
# Installation
7224

7325
```bash
74-
$ npm config set registry http://localhost:50321
26+
> npm install ipfs-npm --global
7527
```
7628

77-
If you picked another `--port` you need to adjust accordingly.
78-
79-
Good to npm install away! :)
29+
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.
8030

8131
# Usage
8232

83-
## CLI
84-
85-
```bash
86-
$ registry-mirror
87-
Usage: registry-mirror COMMAND [OPTIONS]
88-
89-
Available commands:
90-
91-
daemon Mirror npm registry
92-
ls Check modules available in the mirror
93-
npm publish Publish an IPNS record with your current npm list
94-
npm update Update your npm list of modules from IPNS
95-
```
96-
97-
## Commands
98-
99-
### daemon
100-
101-
> starts the registry-mirror daemon
33+
> **WIP**
10234
103-
`$ registry-mirror daemon`
35+
### Examples
10436

105-
Options:
106-
- `--clone` - Download the entire npm (Otherwise it just tries to read)
107-
- `--port=<port>` Listen on the specified port
108-
- `--host=<host>` Listen on the specified port
37+
### API
10938

110-
### ls
39+
#### `ipnpm registry` commands
11140

112-
> lists all the modules available on the IPFS accessible registry and their respective hashes
41+
##### `ipnpm registry clone` - Download and store the entire npm repository into IPFS
11342

114-
`$ registry-mirror ls`
43+
options
44+
seq number
45+
ipfs=
11546

116-
### npm update
47+
##### `ipnpm registry index publish` - Publishes the current index we know as an IPNS name
11748

118-
> update your local registry cache
49+
##### `ipnpm registry index fetch` - Fetches the latest known index from the IPFS network
11950

120-
`$ registry npm update`
51+
#### `ipnpm daemon` - Starts an ipfs-npm daemon, so that we can point our npm cli to it
12152

122-
### npm publish
53+
#### `ipnpm install <module>` - Similar to `npm install`, however it tries first to download the module from npm and then falls back into the regular registry
12354

124-
> publish the version of the cache you have from npm
12555

126-
`$ registry npm publish`
12756

128-
## Important
57+
## Important: Getting 502 errors?
12958

13059
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.
13160

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2-
"name": "registry-mirror",
2+
"name": "ipfs-npm",
33
"version": "0.6.3",
44
"description": "Set up a NPM registry mirror, using your favourite storage, IPFS! :D",
55
"main": "src/index.js",
66
"bin": {
7-
"registry-mirror": "src/cli/bin.js"
7+
"ipfs-npm": "src/cli/bin.js",
8+
"ipnpm": "src/cli/bin.js"
89
},
910
"scripts": {
1011
"test": "mocha tests/test-*/index.js",
@@ -17,17 +18,17 @@
1718
],
1819
"repository": {
1920
"type": "git",
20-
"url": "git+https://github.com/diasdavid/registry-mirror.git"
21+
"url": "git+https://github.com/diasdavid/ipfs-npm.git"
2122
},
2223
"keywords": [
2324
"IPFS"
2425
],
2526
"author": "David Dias <[email protected]>",
2627
"license": "MIT",
2728
"bugs": {
28-
"url": "https://github.com/diasdavid/registry-mirror/issues"
29+
"url": "https://github.com/diasdavid/ipfs-npm/issues"
2930
},
30-
"homepage": "https://github.com/diasdavid/registry-mirror#readme",
31+
"homepage": "https://github.com/diasdavid/ipfs-npm#readme",
3132
"dependencies": {
3233
"async": "^1.5.2",
3334
"debug": "^2.2.0",

0 commit comments

Comments
 (0)