@streamorchard/grapevine 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -5
- package/package.json +1 -1
- package/scripts/check-shipped.js +5 -4
package/README.md
CHANGED
|
@@ -157,10 +157,22 @@ peer.link.on('event', (from, name, params) => {
|
|
|
157
157
|
|
|
158
158
|
Give your app the same `GRAPEVINE_DIR` (or `place: { env: { GRAPEVINE_DIR: testDir } }`), so tests never touch the real folder.
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
As a process of its own, for launch tests, it prints a JSON line for everything that happens and takes commands on stdin:
|
|
161
161
|
|
|
162
|
-
```
|
|
163
|
-
npx grapevine-stand-in
|
|
162
|
+
```js
|
|
163
|
+
// The installed copy, by its path: never `npx grapevine-stand-in`, which would fetch a package of
|
|
164
|
+
// that name from npm if Grapevine weren't installed.
|
|
165
|
+
const child = spawn(process.execPath, [
|
|
166
|
+
require.resolve('@streamorchard/grapevine/stand-in-peer'),
|
|
167
|
+
'--as',
|
|
168
|
+
'com.glowingpear.streammultiview',
|
|
169
|
+
'--dir',
|
|
170
|
+
testDir,
|
|
171
|
+
'--uses',
|
|
172
|
+
'drops.farming@1.0',
|
|
173
|
+
'--provides',
|
|
174
|
+
'players@1.0',
|
|
175
|
+
]);
|
|
164
176
|
```
|
|
165
177
|
|
|
166
178
|
Example messages for every capability version, good and bad, are in `@streamorchard/grapevine/fixtures`. Check that what your app sends passes them.
|
|
@@ -197,12 +209,20 @@ When it ships a release that uses Grapevine, record it (next section).
|
|
|
197
209
|
|
|
198
210
|
Once an app ships a capability version, Grapevine records it. From then on that version can't change in place, and other apps can say which release to update to.
|
|
199
211
|
|
|
200
|
-
|
|
212
|
+
Give the app a script for it, in its `package.json`:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
"scripts": { "grapevine:check": "grapevine-check" }
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Then, in the app's repo, at the start of every change:
|
|
201
219
|
|
|
202
220
|
```sh
|
|
203
|
-
|
|
221
|
+
npm run grapevine:check
|
|
204
222
|
```
|
|
205
223
|
|
|
224
|
+
Use the script, not `npx grapevine-check`: in a checkout where Grapevine isn't installed yet, `npx` would fetch and run whatever package on npm has that name. `npm run` only uses what's installed.
|
|
225
|
+
|
|
206
226
|
- **It reads** the `grapevine` field from each of the app's release tags (`v*`), and Grapevine's record from GitHub (the installed copy if it's offline, or with `--offline`).
|
|
207
227
|
- **It lists** any capability version a release shipped that isn't recorded yet, with the command to record it, e.g. `npm run released -- com.streamorchard.peardrops 0.1.6 drops.farming@1.0 players@1.0`.
|
|
208
228
|
- **That command runs in a Grapevine checkout** (its `app-shipped` skill), followed by a pull request and a patch release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamorchard/grapevine",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Lets desktop apps on the same computer find each other and talk, privately: local sockets, JSON-RPC, pairing and versioned capabilities.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"author": "StreamOrchard",
|
package/scripts/check-shipped.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Run in an app's repo (
|
|
2
|
+
// Run in an app's repo, through a script ("grapevine:check": "grapevine-check"; never npx, which
|
|
3
|
+
// would fetch a package of that name when Grapevine isn't installed): lists the capability versions the app's releases
|
|
3
4
|
// have shipped that Grapevine hasn't recorded yet, with the command that records them (Grapevine's
|
|
4
5
|
// app-shipped skill). Until they're recorded, those versions can still be changed in place, and
|
|
5
6
|
// other apps can't say which release to update to.
|
|
@@ -7,9 +8,9 @@
|
|
|
7
8
|
// The app says what it speaks in its package.json, so every release tag has it:
|
|
8
9
|
// "grapevine": { "app": "com.streamorchard.peardrops", "provides": { "drops.farming": "1.0" }, "uses": { "players": "1.0" } }
|
|
9
10
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// npm run grapevine:check prints what needs recording (exit 0)
|
|
12
|
+
// npm run grapevine:check -- --strict exits 1 when something does
|
|
13
|
+
// npm run grapevine:check -- --offline uses the record in the installed package, not GitHub's
|
|
13
14
|
'use strict';
|
|
14
15
|
|
|
15
16
|
const fs = require('fs');
|