git ssb

3+

cel / ssb-npm-registry



Commit c3f0d046e99501aa45f129bac5527c631b0b8c8c

Update installation instructions

- Add plugins.install method
- Prefer localhost:8989/blobs/get over blobs.get
- Include tarball id in script rather than looking it up.
  We will keep it up to date in this repo.
cel committed on 5/18/2020, 12:16:50 AM
Parent: 2558247ccda01cff45f814ea8a7f771698789515

Files changed

README.mdchanged
enable.jschanged
README.mdView
@@ -1,32 +1,50 @@
11 # ssb-npm-registry
22
3-Serve an npm registry server backed by SSB.
3 +npm registry server on [Secure Scuttlebutt (SSB)][Scuttlebutt].
44
55 ## Install
66
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
811
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'
925 ```
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
1839 ```
1940
20-## Develop
41 +### Install with [git-ssb][]
2142
22-### Install with git-ssb:
23-
24-As a ssb-server plugin:
25-```
43 +```sh
2644 git clone ssb://%pFqjcdVKHqsrtOjVEAVZeCF0iY4s+3Hr0vA3EFCq5UM=.sha256 ~/.ssb/node_modules/ssb-npm-registry
2745 cd ~/.ssb/node_modules/ssb-npm-registry
28-./enable.js
46 +node ./enable.js
2947 # restart ssb-server
3048 ```
3149
3250 To set ssb-npm-registry as your default registry server:
@@ -149,9 +167,13 @@
149167 When running the `ssb-npm` command or a ssb-npm bootstrap server
150168 (`ssb-npm-bootstrap` or `ssb-npm-registry/bootstrap/bin.js`), the `--branch`
151169 option is equivalent to adding a message id to the scope.
152170
171 +[ssb-npm]: %iqhz/sQCZCSp91JYAqfQPzHuDYrjw1geKPf1wJ1CvlA=.sha256
172 +[git-ssb]: %n92DiQh7ietE+R+X/I403LQoyf2DtR3WQfCkDKlheQU=.sha256
153173 [`ssb-ooo`]: %AlNuRW5JCvClmCcdnHVt5vMHegdn43dFw0kCBI1c+CI=.sha256
174 +[Scuttle Shell]: %AVhVlwiF+1XgnJMWJYxGbUP9mG87kzoAuwfmho/stYc=.sha256
175 +[Scuttlebutt]: https://www.scuttlebutt.nz/
154176
155177 ## Bootstrapping
156178
157179 Since the ssb-npm and ssb-npm-registry packages are distributed on ssb-npm,
enable.jsView
@@ -1,8 +1,6 @@
11 // enable ssb-npm-registry plugin
22
3-// If this file is changed, the readme of ssb-npm-registry should be updated to have the new blob id, the repo pushed to git-ssb and package published to ssb-npm.
4-
53 var fs = require('fs')
64 var path = require('path')
75
86 var ssbAppname = process.env.ssb_appname || 'ssb'

Built with git-ssb-web