You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- While 0.4.0 doesn't get released [](https://travis-ci.org/diasdavid/registry-mirror) -->
12
14
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.
14
16
15
17
# Resources
16
18
17
19
-[Demo video](https://vimeo.com/147968322)
18
20
-[Lengthy introduction in a blog post](http://blog.daviddias.me/2015/12/08/stellar-module-management)
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
23
+
# Installation
34
24
35
25
```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
26
+
> npm install ipfs-npm --global
47
27
```
48
28
49
-
## Install registry-mirror
50
-
51
-
```bash
52
-
$ npm i registry-mirror -g
53
-
```
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.
54
30
55
31
# Usage
56
32
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:
72
-
73
-
```bash
74
-
$ npm config set registry http://localhost:50321
75
-
```
76
-
77
-
If you picked another `--port` you need to adjust accordingly.
78
-
79
-
Good to npm install away! :)
33
+
> **WIP**
80
34
81
-
#Usage
35
+
### Examples
82
36
83
-
##CLI
37
+
### API
84
38
85
-
```bash
86
-
$ registry-mirror
87
-
Usage: registry-mirror COMMAND [OPTIONS]
39
+
#### `ipnpm registry` commands
88
40
89
-
Available commands:
41
+
##### `ipnpm registry clone` - Download and store the entire npm repository into IPFS
90
42
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
-
```
43
+
Downloads the entire npm registry from registry.npmjs.org and stores it on the IPFS node.
96
44
97
-
## Commands
45
+
This command will try to find an IPFS node on the default (`IPFS_PATH`), if none is found, it will start one.
98
46
99
-
### daemon
47
+
**options:**
48
+
-`seq-number` - Select the mirror sequence number to start from. Defaults to last, if none, 0.
49
+
-`ipfs` - Select an IPFS daemon by passing its API URL. e.g `ipnpm registry clone --ipfs=/ip4/127.0.0.1/tcp/5001`.
50
+
-`log` - Sets the log level, default is `module`. Other options are: `[all, module]`. e.g `ipnpm registry clone --log=all`.
100
51
101
-
> starts the registry-mirror daemon
52
+
##### `ipnpm registry index publish` - Publishes the current index we know as an IPNS name
102
53
103
-
`$ registry-mirror daemon`
54
+
This command will try to find an IPFS node on the default (`IPFS_PATH`), if none is found, it will start one.
104
55
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
56
+
**options:**
57
+
-`ipfs` - Select an IPFS daemon by passing its API URL. e.g `ipnpm registry clone --ipfs=/ip4/127.0.0.1/tcp/5001`.
109
58
110
-
###ls
59
+
##### `ipnpm registry index fetch` - Fetches the latest known index from the IPFS network
111
60
112
-
> lists all the modules available on the IPFS accessible registry and their respective hashes
61
+
This command will try to find an IPFS node on the default (`IPFS_PATH`), if none is found, it will start one.
113
62
114
-
`$ registry-mirror ls`
63
+
**options:**
64
+
-`ipfs` - Select an IPFS daemon by passing its API URL. e.g `ipnpm registry clone --ipfs=/ip4/127.0.0.1/tcp/5001`.
115
65
116
-
###npm update
66
+
#### `ipnpm daemon` - Starts an ipfs-npm daemon, so that we can point our npm cli to it
117
67
118
-
> update your local registry cache
68
+
This command will try to find an IPFS node on the default (`IPFS_PATH`), if none is found, it will start one.
119
69
120
-
`$ registry npm update`
70
+
**options:**
71
+
-`ipfs` - Select an IPFS daemon by passing its API URL. e.g `ipnpm registry clone --ipfs=/ip4/127.0.0.1/tcp/5001`.
121
72
122
-
###npm publish
73
+
#### `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
123
74
124
-
> publish the version of the cache you have from npm
75
+
This command will try to find an IPFS node on the default (`IPFS_PATH`), if none is found, it will start one.
125
76
126
-
`$ registry npm publish`
77
+
**options:**
78
+
-`ipfs` - Select an IPFS daemon by passing its API URL. e.g `ipnpm registry clone --ipfs=/ip4/127.0.0.1/tcp/5001`.
127
79
128
-
## Important
80
+
## Important: Getting 502 errors?
129
81
130
82
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.
0 commit comments