README.mdView |
---|
1 | 1 … | # ssb-npm-registry |
2 | 2 … | |
3 | | -Serve an npm registry server backed by SSB. |
| 3 … | +npm registry server on [Secure Scuttlebutt (SSB)][Scuttlebutt]. |
4 | 4 … | |
5 | 5 … | ## Install |
6 | 6 … | |
7 | | -Requirement: ssb-server running from the command line (`sbot server` / `ssb-server start`). |
| 7 … | +Requirements: |
| 8 … | +- `ssb-server` that allows installing plugins. e.g. `ssb-server` running from |
| 9 … | + the command-line (`sbot server` / `ssb-server start`), or [Scuttle Shell][] |
| 10 … | +- Connection to the [SSB][Scuttlebutt] network |
8 | 11 … | |
| 12 … | +Instructions for installing `ssb-npm-registry` as a `ssb-server` plugin follow. |
| 13 … | +You can also run `ssb-npm-registry` standalone (i.e. as a `ssb-client` |
| 14 … | +application rather than `ssb-server` plugin), via the [ssb-npm][] package. |
| 15 … | + |
| 16 … | +### Install via `sbot` and `npm` |
| 17 … | + |
| 18 … | +Requires: |
| 19 … | +- `sbot` command (from `ssb-server` package) |
| 20 … | +- `npm` command (for `ssb-server` to use in the `plugins.install` command) |
| 21 … | + |
| 22 … | +Install: |
| 23 … | +```sh |
| 24 … | +sbot plugins.install npm-registry --from 'http://localhost:8989/blobs/get/&8MUxejqCm+jgh09RC9kUmmyMTX+57PFCx+fxNiZfJaE=.sha256' |
9 | 25 … | ``` |
10 | | -BLOB_ID="$(sbot links2.read --query '[{"$filter":{"rel":["mentions",{"$prefix":"npm:ssb-npm-registry:"}]}}]'|grep -o '&.*sha256'|tail -n 1)" |
11 | | -cd ~/.ssb && mkdir -p node_modules && cd node_modules |
12 | | -[ "$(sbot blobs.size "$BLOB_ID")" = null ] && sbot blobs.want "$BLOB_ID" |
13 | | -sbot blobs.get "$BLOB_ID" | tar xvz && mv package ssb-npm-registry |
14 | | -ENABLE_BLOB_ID='&9C/OST7udTFq6skK4Ix1G8zOeFaVXjpbdet1gadBnik=.sha256' |
15 | | -[ "$(sbot blobs.size "$ENABLE_BLOB_ID")" = null ] && sbot blobs.want "$ENABLE_BLOB_ID" |
16 | | -sbot blobs.get "$ENABLE_BLOB_ID" | node |
17 | | -# restart sbot |
| 26 … | +Then restart `ssb-server`. |
| 27 … | + |
| 28 … | +### Manual installation |
| 29 … | + |
| 30 … | +```sh |
| 31 … | +mkdir ~/.ssb/node_modules |
| 32 … | +cd ~/.ssb/node_modules |
| 33 … | +id="&8MUxejqCm+jgh09RC9kUmmyMTX+57PFCx+fxNiZfJaE=.sha256" |
| 34 … | +url="http://localhost:8989/blobs/get/$id" |
| 35 … | +while ! curl "$url" | tar xvz; do sleep 2; done |
| 36 … | +mv package ssb-npm-registry |
|
| 37 … | +node ./ssb-npm-registry/enable.js |
| 38 … | +# restart ssb-server |
18 | 39 … | ``` |
19 | 40 … | |
20 | | -## Develop |
| 41 … | +### Install with [git-ssb][] |
21 | 42 … | |
22 | | -### Install with git-ssb: |
23 | | - |
24 | | -As a ssb-server plugin: |
25 | | -``` |
| 43 … | +```sh |
26 | 44 … | git clone ssb://%pFqjcdVKHqsrtOjVEAVZeCF0iY4s+3Hr0vA3EFCq5UM=.sha256 ~/.ssb/node_modules/ssb-npm-registry |
27 | 45 … | cd ~/.ssb/node_modules/ssb-npm-registry |
28 | | -./enable.js |
| 46 … | +node ./enable.js |
29 | 47 … | # restart ssb-server |
30 | 48 … | ``` |
31 | 49 … | |
32 | 50 … | To set ssb-npm-registry as your default registry server: |
149 | 167 … | When running the `ssb-npm` command or a ssb-npm bootstrap server |
150 | 168 … | (`ssb-npm-bootstrap` or `ssb-npm-registry/bootstrap/bin.js`), the `--branch` |
151 | 169 … | option is equivalent to adding a message id to the scope. |
152 | 170 … | |
| 171 … | +[ssb-npm]: %iqhz/sQCZCSp91JYAqfQPzHuDYrjw1geKPf1wJ1CvlA=.sha256 |
| 172 … | +[git-ssb]: %n92DiQh7ietE+R+X/I403LQoyf2DtR3WQfCkDKlheQU=.sha256 |
153 | 173 … | [`ssb-ooo`]: %AlNuRW5JCvClmCcdnHVt5vMHegdn43dFw0kCBI1c+CI=.sha256 |
| 174 … | +[Scuttle Shell]: %AVhVlwiF+1XgnJMWJYxGbUP9mG87kzoAuwfmho/stYc=.sha256 |
| 175 … | +[Scuttlebutt]: https://www.scuttlebutt.nz/ |
154 | 176 … | |
155 | 177 … | ## Bootstrapping |
156 | 178 … | |
157 | 179 … | Since the ssb-npm and ssb-npm-registry packages are distributed on ssb-npm, |