4 |
5 | # npm-on-IPFS
6 |
7 | [](https://protocol.ai)
8 | [](http://ipfs.io/)
9 | [](http://webchat.freenode.net/?channels=%23ipfs)
10 | [](https://travis-ci.com/ipfs-shipyard/npm-on-ipfs)
11 | [](https://codecov.io/gh/ipfs-shipyard/npm-on-ipfs)
12 | [](https://david-dm.org/ipfs-shipyard/npm-on-ipfs)
13 |
14 | **TLDR: npm-on-ipfs enables you to install your favourite modules from the distributed web using IPFS, as well as to have a cache always ready and shared on your local network — great for enterprise and community coding settings, or even just enabling more speedy work when you and your friends are working at a low-bandwidth coffee shop.**
15 |
16 | ## Quick background
17 |
18 | As the largest software registry in the world, [npm](https://www.npmjs.com) is also the de facto package manager for the JavaScript ecosystem, with more than [900k](https://replicate.npmjs.com/_all_docs) packages and more than 7 billion downloads a week. It's incredibly fast and reliable — however, we couldn't stop ourselves from wondering what would happen if we put the world's largest registry on the distributed web.
19 |
20 | The result is npm-on-ipfs: a module that wraps your package manager of choice (npm or yarn) in configuration to use [IPFS](https://ipfs.io/), not HTTP, to retrieve your dependencies from the central npm registry. It's still a work in progress, but we think you'll find it useful and awesome for the following reasons:
21 |
22 | - Having dependencies on the distributed web makes development **more available** because multiple nodes supplying tarballs means no panic if a single source goes dark
23 | - It can also be **faster and cheaper** — if dependencies are already being hosted on your local network, this means lower bandwidth cost and higher speed
24 | - If enough dependencies are hosted on your local network (think enterprise or community development settings), that network can operate **offline-first**: Take your team on a remote mountain retreat and hack away!
25 |
26 | ## Install & use
27 |
28 | ```console
29 | $ npm i ipfs-npm -g
30 | ```
31 |
32 | ### Get started!
33 |
34 | `ipfs-npm` wraps your favorite package manager (npm or yarn) with configuration that uses IPFS, rather than HTTP, to retrieve your dependencies from the central npm registry. Since it's intended to replace npm/yarn, all the commands you're used to will work in the same way.
35 |
36 | For example: In the directory with your `package.json` file, run ...
37 |
38 | ```console
39 | $ ipfs-npm install
40 | 👿 Spawning an in-process IPFS node
41 | Swarm listening on /ip4/127.0.0.1/tcp/57029/ipfs/QmVDtTRCoYyYu5JFdtrtBMS4ekPn8f9NndymoHdWuuJ7N2
42 | 🗂️ Loading registry index from https://registry.js.ipfs.io
43 | ☎️ Dialling registry mirror /ip4/35.178.192.119/tcp/10015/ipfs/QmWBaYSnmgZi6F6D69JuZGhyL8rm6pt8GX5r7Atc6Gd7vR,/dns4/registry.js.ipfs.io/tcp/10015/ipfs/QmWBaYSnmgZi6F6D69JuZGhyL8rm6pt8GX5r7Atc6Gd7vR
44 | 🗑️ Replacing old registry index if it exists
45 | 📠 Copying registry index /ipfs/QmQmVsNFw3stJky7agrETeB9kZqkcvLSLRnFFMrhiR8zG1 to /npm-registry
46 | 👩🚀 Starting local proxy
47 | 🚀 Server running on port 57314
48 | 🎁 Installing dependencies with /Users/alex/.nvm/versions/node/v10.8.0/bin/npm
49 | ...
50 | ```
51 |
52 | You can use any command you'd use with npm/yarn with ipfs-npm in exactly the same way:
53 |
54 | ```console
55 | $ ipfs-npm install
56 | $ ipfs-npm version minor
57 | $ ipfs-npm publish
58 | $ ipfs-npm --package-manager=yarn
59 | // etc
60 | ```
61 |
62 | ## CLI guide
63 |
64 | ```console
65 | $ ipfs-npm --help
66 | ipfs-npm
67 |
68 | Installs your js dependencies using IPFS
69 |
70 | Options:
71 | --help Show help [boolean]
72 | --version Show version number [boolean]
73 | --package-manager Which package manager to use - eg. npm or yarn
74 | [default: "npm"]
75 | --ipfs-registry Where to download any packages that haven't made
76 | it into the registry index yet from
77 | [default: "https://registry.js.ipfs.io"]
78 | --registry-upload-size-limit How large a file upload to allow when proxying
79 | for the registry [default: "1024MB"]
80 | --registry-update-interval Only request the manifest for a given module
81 | every so many ms [default: 60000]
82 | --registry-connect-timeout How long to wait while dialling the mirror
83 | before timing out [default: 5000]
84 | --registry-read-timeout How long to wait for individual packages before
85 | timing out [default: 5000]
86 | --ipfs-mfs-prefix Which mfs prefix to use
87 | [default: "/npm-registry"]
88 | --ipfs-node "proc" to start an in-process IPFS node,
89 | "disposable" to start an in-process disposable
90 | node, "go" or "js" to spawn an IPFS node as a
91 | separate process or a multiaddr that resolves to
92 | a running node [default: "proc"]
93 | --ipfs-repo If --ipfs-node is set to "proc", this is the
94 | path that contains the IPFS repo to use
95 | [default: "/Users/alex/.jsipfs"]
96 | --ipfs-flush Whether to flush the MFS cache [default: true]
97 | --clone-pin Whether to pin cloned modules [default: false]
98 | --request-max-sockets How many concurrent http requests to make while
99 | cloning the repo [default: 10]
100 | --request-retries How many times to retry when downloading
101 | manifests and tarballs from the registry
102 | [default: 5]
103 | --request-retry-delay How long in ms to wait between retries
104 | [default: 1000]
105 | --request-timeout How long in ms we should wait when requesting
106 | files [default: 30000]
107 | --npm-registry A fallback to use if the IPFS npm registry is
108 | unavailable
109 | [default: "https://registry.npmjs.com"]
110 | ```
111 |
112 | ## Configuration files
113 |
114 | ipfs-npm uses [`rc`](https://github.com/dominictarr/rc) to parse configuration files. Please see the [`rc` repository](https://github.com/dominictarr/rc#standards) for the order of precedence used when searching for configuration files. The app is `ipfs-npm`.
115 |
116 | For instance, if you want to always use a remote daemon, you could create a `~/.ipfs-npmrc` file like this:
117 |
118 | ```json
119 | {
120 | "ipfsNode": "/ip4/127.0.0.1/tcp/5001"
121 | }
122 | ```
123 |
124 | ## To learn more
125 |
126 | [Protocol Labs](https://protocol.ai), the organization behind IPFS, is actively working on improving the landscape for package managers and the distributed web in 2019 and beyond. To that end, we've created an [IPFS Package Managers Special Interest Group](https://github.com/ipfs/package-managers), and your feedback and contributions are very welcome!
127 |
128 | If you're actively (or just casually) using npm-on-ipfs and have feedback about your user experience, we'd love to hear from you, too. Please open an issue in the [Special Interest Group](https://github.com/ipfs/package-managers) and we'll get right back to you.
129 |
130 | More resources you may find useful:
131 | - [The original npm-on-ipfs demo video](https://vimeo.com/147968322)
132 | - [A more detailed introduction to npm-on-ipfs from David Dias' blog](http://daviddias.me/blog/stellar-module-management/)
133 | - [Node.js Interactive talk on Stellar Module Management, aka npm-on-ipfs](https://www.youtube.com/watch?v=-S-Tc7Gl8FM)
134 |
135 | ## Lead maintainer
136 |
137 | [Alex Potsides](https://github.com/achingbrain)
138 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ## [0.16.3](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.16.2...v0.16.3) (2019-06-06)
3 |
4 |
5 | ### Bug Fixes
6 |
7 | * do not stop external IPFS node ([#99](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/99)) ([40c12a6](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/40c12a6))
8 | * dont spawn node for local ops ([#110](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/110)) ([36f4e8f](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/36f4e8f))
9 | * only spawn node once ([#111](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/111)) ([8741a66](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/8741a66))
10 | * remove redundant ipfs configing code ([55978ab](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/55978ab))
11 | * tests by adding go-ipfs to PATH ([#100](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/100)) ([7489c94](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/7489c94))
12 |
13 |
14 | ### Features
15 |
16 | * support config files ([#102](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/102)) ([877840b](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/877840b))
17 |
18 |
19 |
20 |
21 | ## [0.16.2](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.16.1...v0.16.2) (2019-01-18)
22 |
23 |
24 |
25 |
26 | ## [0.16.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.16.0...v0.16.1) (2018-12-10)
27 |
28 |
29 | ### Bug Fixes
30 |
31 | * catch errors when connecting to the registry ([a412f98](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/a412f98))
32 |
33 |
34 |
35 |
36 | # [0.16.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.15.0...v0.16.0) (2018-12-07)
37 |
38 |
39 | ### Features
40 |
41 | * inherit stdin so we can interact with package manager ([267b73d](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/267b73d))
42 |
43 |
44 |
45 |
46 | # [0.15.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.14.0...v0.15.0) (2018-12-07)
47 |
48 |
49 |
50 |
51 | # [0.14.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.13.0...v0.14.0) (2018-12-07)
52 |
53 |
54 |
55 |
56 | # [0.13.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.12.0...v0.13.0) (2018-12-07)
57 |
58 |
59 | ### Features
60 |
61 | * default to yarn for yarn and npm for npm ([011baad](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/011baad))
62 |
63 |
64 |
65 |
66 | # [0.12.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.11.0...v0.12.0) (2018-12-06)
67 |
68 |
69 | ### Features
70 |
71 | * do not delete old registry index for speed ([96ff811](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/96ff811))
72 |
73 |
74 |
75 |
76 | # [0.11.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.10.0...v0.11.0) (2018-10-26)
77 |
78 |
79 | ### Features
80 |
81 | * add logo ([1cf85b9](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/1cf85b9))
82 | * allow using non-disposable ipfs nodes ([101e630](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/101e630))
83 |
84 |
85 | ### Performance Improvements
86 |
87 | * fall back to npm if ipfs is too slow ([f96a751](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/f96a751))
88 |
89 |
90 |
91 |
92 | # [0.10.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.9.0...v0.10.0) (2018-10-04)
93 |
94 |
95 | ### Features
96 |
97 | * add s3 storage option ([6a522c8](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/6a522c8))
98 |
99 |
100 |
101 |
102 | # [0.9.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.8.0...v0.9.0) (2018-10-04)
103 |
104 |
105 | ### Bug Fixes
106 |
107 | * friendlier error pages ([747320d](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/747320d))
108 |
109 |
110 | ### Features
111 |
112 | * use ipfs to fetch files if available ([5e135fe](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/5e135fe))
113 |
114 |
115 |
116 |
117 | # [0.8.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.7.4...v0.8.0) (2018-09-21)
118 |
119 |
120 | ### Features
121 |
122 | * adds retry when npm 404s, fixes [#61](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/61) ([d884991](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/d884991))
123 |
124 |
125 |
126 |
127 | ## [0.7.4](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.7.3...v0.7.4) (2018-09-20)
128 |
129 |
130 |
131 |
132 | ## [0.7.3](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.7.2...v0.7.3) (2018-09-20)
133 |
134 |
135 | ### Bug Fixes
136 |
137 | * increase max body size ([d478378](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/d478378))
138 |
139 |
140 |
141 |
142 | ## [0.7.2](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.7.1...v0.7.2) (2018-09-20)
143 |
144 |
145 | ### Bug Fixes
146 |
147 | * fixes [#59](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/59) and [#60](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/60) with better error detection and messages ([93ad289](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/93ad289))
148 |
149 |
150 |
151 |
152 | ## [0.7.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.7.0...v0.7.1) (2018-09-20)
153 |
154 |
155 |
156 |
157 | # [0.7.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.6.4...v0.7.0) (2018-09-20)
158 |
159 |
160 | ### Features
161 |
162 | * forward non-get requests to the registry, fixes [#58](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/58) ([b493e4c](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/b493e4c))
163 |
164 |
165 |
166 |
167 | ## [0.6.4](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.5.1...v0.6.4) (2018-09-20)
168 |
169 |
170 | ### Bug Fixes
171 |
172 | * do not use path.join because windows ([8b51156](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/8b51156))
173 | * handle scoped modules, fixes [#57](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/57) ([bd08ddd](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/bd08ddd))
174 | * linting errors ([ca7fd83](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/ca7fd83))
175 | * update arg name ([b707cc0](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/b707cc0))
176 | * use same blobstore instance as it will create an ipfs node ([afe5c58](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/afe5c58))
177 |
178 |
179 | ### Features
180 |
181 | * allow configuring external host address separately from internal ([3405f0a](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/3405f0a))
182 | * mirror npm instead of pulling/publishing registry tree ([c734d44](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/c734d44))
183 |
184 |
185 | ### Performance Improvements
186 |
187 | * increase concurrency when running local IPFS node ([126747b](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/126747b))
188 | * throttle requests to daemon and use build in ipfs node ([4118ed5](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/4118ed5))
189 |
190 |
191 |
192 |
193 | ## [0.5.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.5.0...v0.5.1) (2016-03-23)
194 |
195 |
196 |
197 |
198 | # [0.5.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.4.0...v0.5.0) (2016-02-01)
199 |
200 |
201 |
202 |
203 | # [0.4.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.3.3...v0.4.0) (2016-02-01)
204 |
205 |
206 |
207 |
208 | ## [0.3.3](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.3.1...v0.3.3) (2016-01-02)
209 |
210 |
211 |
212 |
213 | ## [0.3.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.3.0...v0.3.1) (2015-12-18)
214 |
215 |
216 |
217 |
218 | # [0.3.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.12...v0.3.0) (2015-12-18)
219 |
220 |
221 |
222 |
223 | ## [0.2.12](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.11...v0.2.12) (2015-12-17)
224 |
225 |
226 |
227 |
228 | ## [0.2.11](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.10...v0.2.11) (2015-12-17)
229 |
230 |
231 |
232 |
233 | ## [0.2.10](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.9...v0.2.10) (2015-11-30)
234 |
235 |
236 |
237 |
238 | ## [0.2.9](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.8...v0.2.9) (2015-11-26)
239 |
240 |
241 |
242 |
243 | ## [0.2.8](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.7...v0.2.8) (2015-11-25)
244 |
245 |
246 |
247 |
248 | ## [0.2.7](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.6...v0.2.7) (2015-11-25)
249 |
250 |
251 |
252 |
253 | ## [0.2.6](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.5...v0.2.6) (2015-11-25)
254 |
255 |
256 |
257 |
258 | ## [0.2.5](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.4...v0.2.5) (2015-11-24)
259 |
260 |
261 |
262 |
263 | ## [0.2.4](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.3...v0.2.4) (2015-11-24)
264 |
265 |
266 |
267 |
268 | ## [0.2.3](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.2...v0.2.3) (2015-11-23)
269 |
270 |
271 |
272 |
273 | ## [0.2.2](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.1...v0.2.2) (2015-11-23)
274 |
275 |
276 |
277 |
278 | ## [0.2.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.2.0...v0.2.1) (2015-11-23)
279 |
280 |
281 |
282 |
283 | # [0.2.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.6...v0.2.0) (2015-11-23)
284 |
285 |
286 |
287 |
288 | ## [0.1.6](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.5...v0.1.6) (2015-11-23)
289 |
290 |
291 | ### Features
292 |
293 | * Add host and port options. ([5c3eeea](https://github.com/ipfs-shipyard/npm-on-ipfs/commit/5c3eeea)), closes [#3](https://github.com/ipfs-shipyard/npm-on-ipfs/issues/3)
294 |
295 |
296 |
297 |
298 | ## [0.1.5](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.4...v0.1.5) (2015-11-18)
299 |
300 |
301 |
302 |
303 | ## [0.1.4](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.3...v0.1.4) (2015-11-16)
304 |
305 |
306 |
307 |
308 | ## [0.1.3](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.2...v0.1.3) (2015-11-16)
309 |
310 |
311 |
312 |
313 | ## [0.1.2](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.1...v0.1.2) (2015-11-16)
314 |
315 |
316 |
317 |
318 | ## [0.1.1](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.1.0...v0.1.1) (2015-11-16)
319 |
320 |
321 |
322 |
323 | # [0.1.0](https://github.com/ipfs-shipyard/npm-on-ipfs/compare/v0.0.1...v0.1.0) (2015-11-15)
324 |
325 |
326 |
327 |
328 | ## 0.0.1 (2015-11-14)
329 |
330 |
331 |
332 |
--------------------------------------------------------------------------------