@acryldev/blends 1.7.20 → 1.7.22
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/dist/index.js +3 -3
- package/docs/framework/README.md +2 -1
- package/docs/framework/guides/share-blends.md +166 -0
- package/docs/framework/guides/share-plugins.md +155 -56
- package/pack/lib/os-version.mjs +19 -0
- package/pack/pack-blank-mac.mjs +19 -0
- package/package.json +1 -1
- package/plugins/builder/plugin.json +1 -1
- package/plugins/desktop-shell/main.ts +30 -4
- package/plugins/desktop-shell/menu.ts +11 -3
- package/plugins/desktop-shell/package.json +2 -1
- package/plugins/extensions/plugin.json +1 -1
- package/plugins/manifest/plugin.json +1 -1
- package/plugins/plugin-share/index.ts +7 -4
- package/plugins/plugin-share/plugin.json +1 -1
- package/plugins/plugin-share/releases-fallback.ts +37 -0
package/dist/index.js
CHANGED
|
@@ -55,11 +55,11 @@ var packages = {
|
|
|
55
55
|
"path": "../plugins/settings"
|
|
56
56
|
},
|
|
57
57
|
"@acryldev/sign-in": {
|
|
58
|
-
"version": "0.2.
|
|
58
|
+
"version": "0.2.3",
|
|
59
59
|
"path": "../plugins/sign-in"
|
|
60
60
|
},
|
|
61
61
|
"@acryldev/control": {
|
|
62
|
-
"version": "0.3.
|
|
62
|
+
"version": "0.3.1",
|
|
63
63
|
"path": "../runtime/control"
|
|
64
64
|
},
|
|
65
65
|
"@acryldev/diagnostics": {
|
|
@@ -95,7 +95,7 @@ var packages = {
|
|
|
95
95
|
"path": "../plugins/versions"
|
|
96
96
|
},
|
|
97
97
|
"@acryldev/blends-frame": {
|
|
98
|
-
"version": "0.2.
|
|
98
|
+
"version": "0.2.13",
|
|
99
99
|
"path": "../plugins/blends-frame"
|
|
100
100
|
}
|
|
101
101
|
};
|
package/docs/framework/README.md
CHANGED
|
@@ -54,7 +54,8 @@ They are enabled as they are built.
|
|
|
54
54
|
| Look up a call | [API](api/index.md), [Routing](api/routing.md), [Context](api/context.md), [Request](api/request.md), [API summary](api/summary.md) |
|
|
55
55
|
| Understand the design | [Concepts](concepts/motivation.md) |
|
|
56
56
|
| Copy a pattern | [Guides](guides/best-practices.md), [Validation](guides/validation.md), [Testing](guides/testing.md), [Data, migrations and choosing a store](guides/data.md), [Forms, sessions and a database](guides/forms-and-sessions.md), [Client components without a bundler](guides/client-modules.md), [Bring your own tool](guides/bring-your-own-tool.md) |
|
|
57
|
-
| Share a
|
|
57
|
+
| Share a whole app (a Blend): GitHub, the Blends store, make from it, update, WebBoxes | [Share a Blend](guides/share-blends.md) |
|
|
58
|
+
| Share a plugin with other people: GitHub, the plugin registry, npm, pull, update | [Share a plugin](guides/share-plugins.md) |
|
|
58
59
|
| Run the 90-minute workshop | [Workshop](workshop/README.md), and the room around it in [Facilitator notes](workshop/facilitator.md) |
|
|
59
60
|
| Use Acryl inside a Cordis app | [Acryl in a Cordis app](cordis/acryl-in-a-cordis-app.md), [Plugin lifecycle](cordis/plugin-lifecycle.md), [Mounting](cordis/mounting.md) |
|
|
60
61
|
| Move from the 0.3 router calls | [Migration from 0.3](cordis/migration-from-0-3.md) |
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Share a Blend: publish it, list it in the store, make apps from it, update them
|
|
2
|
+
|
|
3
|
+
A Blend is a whole app: a folder with a `blend.yaml`, its plugins and its data. Sharing one puts that folder in a GitHub repository, and optionally lists it in
|
|
4
|
+
the Blends store at [acrylblends.github.io](https://acrylblends.github.io). Anyone can then make an app from it and, when you release a newer version, bring
|
|
5
|
+
it in while keeping their own changes. Sharing a single plugin is a different, smaller thing: see [Share a plugin](share-plugins.md).
|
|
6
|
+
|
|
7
|
+
Every command and every output below was run on 2026-11-21 with the published packages (`acryl` 0.3.0, `@acryldev/blends` 1.7.21), as two people, Ana and
|
|
8
|
+
Ben, each with a home folder of their own, against the GitHub organization `inboxxobni`. Outputs are pasted as they came, with npm's install notices left
|
|
9
|
+
out and the folder names shortened to `<folder>`. You need Node.js 22.19 or newer, npm, git and `gh` signed in (`gh auth login`) to share; making an app
|
|
10
|
+
from a public Blend needs no login.
|
|
11
|
+
|
|
12
|
+
## 1. Make an app
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npx acryl@latest new sh-guide-notes
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Next:
|
|
20
|
+
cd sh-guide-notes
|
|
21
|
+
npm run dev
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The folder is a git repository with one commit. Put something in it (here a plugin `plugins/greeting/`, with a row for it in `blend.yaml`) and give the
|
|
25
|
+
app a description: a Blend is listed in the store with its description, so `blend.yaml` needs `metadata.description`. Without one, the plan says so:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
{"ok":false,"reason":"the store lists an app with its description: add one to blend.yaml (metadata.description)"}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 2. Share it to your own GitHub, and list it in the store
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm run share -- --owner inboxxobni --visibility public --list --category business
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
It shows what it would do and sends nothing until you type `yes`:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Share this app to a new public repository github.com/inboxxobni/sh-guide-notes: 2 changed files, saved first, and the versions saved so far. Listed in the Blends store as inboxxobni.sh-guide-notes, Community, under business (licence MIT, people start from v0.1.0).
|
|
41
|
+
Type yes to send it: yes
|
|
42
|
+
shared to https://github.com/inboxxobni/sh-guide-notes.git (created)
|
|
43
|
+
listed in the Blends store from v0.1.0: acrylblends.github.io shows it within about an hour
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Option | Does |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `--owner <account>` | the GitHub account or organization for a new repository; yours when absent |
|
|
49
|
+
| `--visibility private\|public` | who can see a new repository; private when absent, and kept in `blend.yaml` |
|
|
50
|
+
| `--list` | also list it in the Blends store as Community under your name; public only |
|
|
51
|
+
| `--category <address>`, `--subcategory <address>` | where the store puts it, one of the categories on [acrylblends.github.io/blends](https://acrylblends.github.io/blends) |
|
|
52
|
+
| `--license <id>` | an SPDX id; MIT when absent |
|
|
53
|
+
| `--json` | print the plan as JSON and send nothing |
|
|
54
|
+
|
|
55
|
+
`npm run share -- --json` printed this plan before the real run:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
{"repository":"inboxxobni/sh-guide-notes","create":true,"visibility":"public","changes":2,"listing":{"id":"inboxxobni.sh-guide-notes","placement":{"category":"business"},"license":"MIT","tag":"v0.1.0"}}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Only a person's `yes` at the terminal sends it; an agent gets the plan and cannot answer. A file that holds a secret stops the share, and a private app never
|
|
62
|
+
goes to a public repository. The repository gets the topic `acrylblends-blend` and a release tag `v0.1.0`; the store finds it by that topic.
|
|
63
|
+
|
|
64
|
+
The store's sync runs hourly (to see it sooner, the Deploy workflow of the store's repository can be run by hand). Once the sync had run,
|
|
65
|
+
`https://acrylblends.github.io/blends/b/inboxxobni.sh-guide-notes/` answered 200 and read, in part: Community Blend, made and maintained by @inboxxobni, not by
|
|
66
|
+
ACRYL, listed automatically from its public repository and not reviewed by ACRYL; version 0.1.1 (the later release, see below); and this command for starting
|
|
67
|
+
a project from it:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
npm create @acryldev/blends my-app -- --from github:inboxxobni/sh-guide-notes#v0.1.1
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 3. Make an app from a shared Blend
|
|
74
|
+
|
|
75
|
+
Ben, from a folder of his own, in either of the two forms:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
npx acryl@latest new ben-notes --from github:inboxxobni/sh-guide-notes#v0.1.0
|
|
79
|
+
npm create @acryldev/blends@latest from-store -- --from github:inboxxobni/sh-guide-notes#v0.1.1
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
created ben-notes from sh-guide-notes (A tiny test app for the sharing guide, answering a greeting at /greeting.) in <folder>/ben-notes: 446 files, Acryl docs in docs/framework
|
|
84
|
+
Next:
|
|
85
|
+
cd ben-notes
|
|
86
|
+
npm install
|
|
87
|
+
see README.md or the package.json scripts
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`cd ben-notes && npm install && npm run dev` starts it. The app is Ben's: its history starts at one commit, and it remembers where it came from
|
|
91
|
+
(`package.json` `acryl.from`) so that it can be updated.
|
|
92
|
+
|
|
93
|
+
An official starter has a short id (`npx acryl new my-app --from acrylblends.csv-explorer`). A Community Blend has the id the store shows
|
|
94
|
+
(`inboxxobni.sh-guide-notes`), and that works the same way: the id is looked up in the store's list of Community Blends and the app is made from the release
|
|
95
|
+
the store lists, as if you had written its `github:` form. The app remembers that release, so `update` works. When neither the starters nor the Community list
|
|
96
|
+
know an id, the error says so.
|
|
97
|
+
|
|
98
|
+
## 4. Release a newer version
|
|
99
|
+
|
|
100
|
+
Ana changes the app and shares again. `npm run share` alone pushes the change; to release a new version for people to update to, share with `--list`, which
|
|
101
|
+
moves past a version that is already tagged:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
npm run share -- --list
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
Share this app to https://github.com/inboxxobni/sh-guide-notes.git (public): the versions saved so far. Listed in the Blends store as inboxxobni.sh-guide-notes, Community, under business (licence MIT, people start from v0.1.1).
|
|
109
|
+
Type yes to send it: yes
|
|
110
|
+
shared to https://github.com/inboxxobni/sh-guide-notes.git
|
|
111
|
+
listed in the Blends store from v0.1.1: acrylblends.github.io shows it within about an hour
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`blend.yaml` now says version 0.1.1 and the repository has the tags `v0.1.0` and `v0.1.1`.
|
|
115
|
+
|
|
116
|
+
## 5. Update an app, keeping its own changes
|
|
117
|
+
|
|
118
|
+
Inside Ben's app, which has a file of his own (`BEN-NOTES.md`), committed:
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
npx acrylblends@latest update
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Write it with `@latest`: plain `npx acrylblends update` runs the copy installed in the app, which may be older than the fixes for what you want to update.
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
ben-notes was made from github:inboxxobni/sh-guide-notes 0.1.0. Asking the repository for its latest release...
|
|
128
|
+
github:inboxxobni/sh-guide-notes 0.1.1 is available.
|
|
129
|
+
Getting github:inboxxobni/sh-guide-notes v0.1.1 (@acryldev/create-blends@1.7.21, as the app was made)...
|
|
130
|
+
created ben-notes from sh-guide-notes (...) in <temporary folder>/ben-notes: 446 files, Acryl docs in docs/framework
|
|
131
|
+
Merging github:inboxxobni/sh-guide-notes 0.1.1 into ben-notes (your changes are kept)...
|
|
132
|
+
Installing its dependencies (npm install)...
|
|
133
|
+
Updated to github:inboxxobni/sh-guide-notes 0.1.1.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Afterwards `plugins/greeting/index.ts` answered Ana's new text and `BEN-NOTES.md` was still there.
|
|
137
|
+
|
|
138
|
+
When Ben and the release changed the same lines, nothing is written:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
github:inboxxobni/sh-guide-notes 0.1.2 is available.
|
|
142
|
+
Merging github:inboxxobni/sh-guide-notes 0.1.2 into ben-notes (your changes are kept)...
|
|
143
|
+
error: you and github:inboxxobni/sh-guide-notes 0.1.2 both changed the same lines of: plugins/greeting/index.ts. Nothing was changed; ask the agent to bring in github:inboxxobni/sh-guide-notes 0.1.2 by hand, or undo your change there and update again
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 6. Put it online on WebBoxes.ai
|
|
147
|
+
|
|
148
|
+
[WebBoxes.ai](https://webboxes.ai) runs ACRYL apps for you. **Proven 2026-11-21 by the WebBoxes team, not run for this guide** (it needs a WebBoxes.ai
|
|
149
|
+
account); what follows is what they reported, in their words shortened, and what WebBoxes.ai does is that product's own.
|
|
150
|
+
|
|
151
|
+
1. **Start the deploy.** From the Blend's card in the store, `webboxes.ai/blueprints` has a **Deploy** button; ACRYL Control Center's store cards have **Deploy to WebBoxes.ai**,
|
|
152
|
+
which opens the New WebBox form with the Blend filled in: `https://webboxes.ai/dashboard/webboxes?blend=<id>&name=<name>` for a Blend in the store, or `?github=<owner>/<repo>` for
|
|
153
|
+
your own repository (a Blend you shared to GitHub in step 2). If you are signed out, it goes to sign-in and comes back to the form.
|
|
154
|
+
2. **Create.** The box ran in under two minutes for a store Blend (88 seconds in their run) and in 17 seconds for a repository, and opens the app inside the ACRYL
|
|
155
|
+
frame. **Open app** shows it; the right panel has **Terminal**, **Claude Code**, **Codex** and **Pi** tabs, which work in the box's `/workspace`.
|
|
156
|
+
3. **Publish** gives the box an address of its own. An anonymous visitor of that address gets the app, and gets nothing of the workspace (the terminal and agent
|
|
157
|
+
routes answer 404 to anyone but the owner).
|
|
158
|
+
4. **Update.** When the Blend you made the box from has a newer release (a newer version in the store, or a newer tag of the repository), the box shows **Update to X**.
|
|
159
|
+
It runs `npx acrylblends@latest update`, which is step 5 above (your edits are kept), then `npm install`, then restarts the box, and shows the command's output.
|
|
160
|
+
The button appears only when `update --check` itself says a newer release exists.
|
|
161
|
+
|
|
162
|
+
## What this guide does not cover
|
|
163
|
+
|
|
164
|
+
- Sharing to a private repository works with the same command and `--visibility private`; the store lists public Blends only. It was not run here.
|
|
165
|
+
- A Blend is shared through GitHub only. npm is a target for single plugins, not for whole apps: see [Share a plugin](share-plugins.md). A box made before `@acryldev/blends` 1.7.21 keeps its older CLI for the app inside it, so a repository with a `blend.yaml` and no `acryl.template.json` may not update there.
|
|
166
|
+
- Control Center and the frame have buttons for these steps; the guide shows the commands because they can be copied and run once.
|
|
@@ -1,117 +1,216 @@
|
|
|
1
1
|
# Share a plugin: publish it, pull it, update it
|
|
2
2
|
|
|
3
|
-
A plugin is a folder in `plugins/`. Another person's app takes it from a GitHub release, from the public plugin registry
|
|
4
|
-
|
|
5
|
-
organization. They run in the app's folder, with the app running (`npm run dev`, or the desktop app): a pull installs into the running app.
|
|
3
|
+
A plugin is a folder in `plugins/`. Another person's app takes it from a GitHub release, from the public plugin registry at
|
|
4
|
+
[cordisplugins.github.io](https://cordisplugins.github.io), from npm, or from a list your group keeps. To share a whole app instead, see [Share a Blend](share-blends.md).
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
Every command and every output below was run on 2026-11-21 as two people, Ana (publishes) and Ben (pulls), each with an app and a home folder of their own, made with
|
|
7
|
+
`@acryldev/blends` 1.7.21, against the GitHub organization `inboxxobni`. Outputs are pasted as they came, with the `npm run` banner lines left out. The npm steps
|
|
8
|
+
ran in npm's own dry run (see "To npm"), so nothing was published to npm. Commands run in the app's folder with the app running (`npm run dev`, or the desktop
|
|
9
|
+
app): a pull installs into the running app. You need `gh` signed in (`gh auth login`) to publish; pulling a public plugin needs no login.
|
|
8
10
|
|
|
9
11
|
## 1. Make the plugin
|
|
10
12
|
|
|
11
|
-
`plugins/
|
|
13
|
+
`plugins/sh-guide-clock/package.json` (the folder name is the plugin's name):
|
|
12
14
|
|
|
13
15
|
```json
|
|
14
|
-
{ "name": "
|
|
16
|
+
{ "name": "sh-guide-clock", "version": "0.1.0", "description": "A clock for the sharing guide.", "type": "module", "main": "index.ts" }
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
`plugins/
|
|
19
|
+
`plugins/sh-guide-clock/index.ts`:
|
|
18
20
|
|
|
19
21
|
```ts
|
|
20
22
|
import type { Context } from '@deepseek-ai/cordis'
|
|
21
23
|
import { Acryl } from 'acrylblends'
|
|
22
24
|
|
|
23
|
-
export const name = '
|
|
25
|
+
export const name = 'sh-guide-clock'
|
|
24
26
|
export const inject = ['router']
|
|
25
27
|
|
|
26
28
|
export function apply(ctx: Context): void {
|
|
27
|
-
ctx.router.route('/
|
|
29
|
+
ctx.router.route('/sh-guide-clock', new Acryl().get('/', (c) => c.json({ text: 'a clock, v0.1.0' })))
|
|
28
30
|
}
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
Saving the folder starts the plugin in the running app: in the frame it
|
|
32
|
-
|
|
33
|
+
Saving the folder starts the plugin in the running app: in the frame it answered `{"text":"a clock, v0.1.0"}` at `/app/sh-guide-clock` (under `npm start`, at
|
|
34
|
+
`/sh-guide-clock`).
|
|
33
35
|
|
|
34
36
|
## 2. Publish it
|
|
35
37
|
|
|
36
38
|
```sh
|
|
37
|
-
npm run acryl -- plugin publish
|
|
39
|
+
npm run acryl -- plugin publish sh-guide-clock --owner inboxxobni
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
It
|
|
41
|
-
|
|
42
|
-
plan and cannot answer. It ends with the line to give a friend:
|
|
42
|
+
It shows the plan and sends nothing until you type `yes`. `--owner` is the GitHub account or organization (yours when absent), `--license <id>` the license (MIT
|
|
43
|
+
when absent):
|
|
43
44
|
|
|
44
45
|
```
|
|
45
|
-
|
|
46
|
+
Publish to inboxxobni/sh-guide-clock (a new repository), public, version 0.1.0, license MIT.
|
|
47
|
+
Files: README.md, index.ts, package.json.
|
|
48
|
+
The repository gets the topic cordis-plugin, so the public plugin registry (cordisplugins.github.io) lists it within about an hour.
|
|
49
|
+
A friend gets exactly these bytes with: npm run acryl -- plugin pull github:inboxxobni/sh-guide-clock@0.1.0@sha256:64aa517d77ad481addbbc4a13e97e173bda0c31d2b01809e606153517e82ae08
|
|
50
|
+
Nothing was sent. Only a person can say yes: they run `npm run acryl -- plugin publish sh-guide-clock` in their own terminal, or press Share in the frame. `--license <id>` changes the license before the yes.
|
|
51
|
+
Publish inboxxobni/sh-guide-clock v0.1.0 under MIT? Type yes to send it: yes
|
|
52
|
+
Published: https://github.com/inboxxobni/sh-guide-clock/releases/tag/v0.1.0
|
|
53
|
+
A friend gets exactly these bytes with:
|
|
54
|
+
npm run acryl -- plugin pull github:inboxxobni/sh-guide-clock@0.1.0@sha256:64aa517d77ad481addbbc4a13e97e173bda0c31d2b01809e606153517e82ae08
|
|
46
55
|
```
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
Only a person's `yes` at the terminal publishes; an agent gets the plan and cannot answer. A plugin that holds a secret is refused, naming the file.
|
|
58
|
+
|
|
59
|
+
The same in the app: Settings > Plugins > My plugins > **Share...** on the plugin, then **Save here** (this computer only), **Share privately**, **Share publicly**,
|
|
60
|
+
**Publish to npm** or **List in the registry**. It shows the plan and asks again before it sends anything.
|
|
50
61
|
|
|
51
62
|
| Target | How | Result |
|
|
52
63
|
| --- | --- | --- |
|
|
53
64
|
| GitHub | `plugin publish`, or Share publicly / Share privately | a repository and a release holding exactly the plugin's files, and the pull line |
|
|
54
|
-
| The public registry | `plugin publish` (always public), or **List in the registry** | the repository has the topic `cordis-plugin`;
|
|
55
|
-
| npm | `plugin publish <name> --to npm
|
|
65
|
+
| The public plugin registry | `plugin publish` (always public), or **List in the registry** | the repository has the topic `cordis-plugin`; the registry lists it at its next sync (hourly) |
|
|
66
|
+
| npm | `plugin publish <name> --to npm`, or **Publish to npm** | the package `@<scope>/<name>` on the npm registry (see below) |
|
|
56
67
|
|
|
57
|
-
|
|
68
|
+
## 3. Pull it
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
Ben, in his app:
|
|
60
71
|
|
|
61
72
|
```sh
|
|
62
|
-
npm run acryl -- plugin
|
|
63
|
-
npm run acryl -- plugin publish hello-ana --to npm --scope acme # as @acme/hello-ana
|
|
64
|
-
npm run acryl -- plugin publish hello-ana --to npm --registry https://npm.example.com/ # another registry
|
|
73
|
+
npm run acryl -- plugin pull github:inboxxobni/sh-guide-clock@0.1.0@sha256:64aa517d77ad481addbbc4a13e97e173bda0c31d2b01809e606153517e82ae08
|
|
65
74
|
```
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
```
|
|
77
|
+
{
|
|
78
|
+
"ok": true,
|
|
79
|
+
"name": "sh-guide-clock",
|
|
80
|
+
"version": "0.1.0",
|
|
81
|
+
"integrity": "sha512-O4qRgyQU7+pl+Gih+sBcd073Wc+FejM+KNaXjBkM5ml75Hg2k/UiFs4Jr32oQg2Dbf3O73yYuyvdRf5ECZ0xqQ==",
|
|
82
|
+
"digest": "64aa517d77ad481addbbc4a13e97e173bda0c31d2b01809e606153517e82ae08",
|
|
83
|
+
"action": "installed",
|
|
84
|
+
"state": "active",
|
|
85
|
+
"remembered": true
|
|
86
|
+
}
|
|
87
|
+
```
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
The plugin was live at once (`{"text":"a clock, v0.1.0"}`), and `blend.yaml` remembers where it came from, so a copy of the app fetches the same bytes.
|
|
90
|
+
`npm run acryl -- plugin list` says who released it:
|
|
73
91
|
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
```
|
|
93
|
+
"name": "sh-guide-clock",
|
|
94
|
+
"state": "active",
|
|
95
|
+
"pulledFrom": "github:inboxxobni/sh-guide-clock@0.1.0",
|
|
96
|
+
"author": "inboxxobni",
|
|
97
|
+
"release": "0.1.0"
|
|
80
98
|
```
|
|
81
99
|
|
|
82
|
-
|
|
83
|
-
public package needs no login; a private scope or registry is read through your own npm configuration.
|
|
100
|
+
The other forms of a source:
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
```sh
|
|
103
|
+
npm run acryl -- plugin pull github:<owner>/<repo> # the latest release
|
|
104
|
+
npm run acryl -- plugin pull github:<owner>/<repo>@<version> # one version
|
|
105
|
+
npm run acryl -- plugin pull github:<owner>/<repo>@<version>@sha256:<digest> # exactly these bytes (the line the publisher gave)
|
|
106
|
+
npm run acryl -- plugin pull registry:<id> # by the id the registry shows
|
|
107
|
+
npm run acryl -- plugin pull npm:@<scope>/<name>[@<version>] # from npm
|
|
108
|
+
```
|
|
87
109
|
|
|
88
|
-
|
|
89
|
-
line is pulled on its own; a refused one is named with its reason while the others run.
|
|
110
|
+
With `@sha256:<digest>` a release with other bytes is refused. By registry id (after the registry had listed the plugin):
|
|
90
111
|
|
|
91
112
|
```sh
|
|
92
|
-
npm run acryl -- plugin
|
|
93
|
-
npm run acryl -- plugin remove hello-ana
|
|
113
|
+
npm run acryl -- plugin pull registry:sh-guide-clock
|
|
94
114
|
```
|
|
95
115
|
|
|
116
|
+
```
|
|
117
|
+
{
|
|
118
|
+
"ok": true,
|
|
119
|
+
"name": "sh-guide-clock",
|
|
120
|
+
"version": "0.1.1",
|
|
121
|
+
"integrity": "sha512-kFO4j0zQjgVmlP38yMttbHDRNIQLTG8wgMUtkE8DlELeBF8Ptw93uPFVrZUgaYuaCfJ5iR6TBH3E+UK8kntGAg==",
|
|
122
|
+
"digest": "4efa1130533055e7a6ce94cfd54f593a6d47c88fe74a47a71c3b6d08e1ce3472",
|
|
123
|
+
"action": "installed",
|
|
124
|
+
"state": "active",
|
|
125
|
+
"remembered": true
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The registry's own listed checksum is checked against the bytes that arrive. In the app: Settings > Plugins > **Registry**, search, **Add to my app** (it says it runs
|
|
130
|
+
someone else's code and asks first), or **Add by address** for a `github:` line from a colleague.
|
|
131
|
+
|
|
132
|
+
A group's plugins in one command: put one source per line in a file (`#` starts a comment), then `npm run acryl -- plugin pull --from group.txt`. Each line is
|
|
133
|
+
pulled on its own; a refused one is named with its reason while the others run. `plugin remove <name>` takes one out; its folder goes too when it is exactly the
|
|
134
|
+
release as pulled, and stays (with the app starting it again at its next start) when you changed it.
|
|
135
|
+
|
|
136
|
+
If a pull says `GitHub answered 403`: GitHub allows 60 requests an hour without a sign-in, counted per internet address, so a room full of people on one network
|
|
137
|
+
can use it up together; it came back after the hour. From `@acryldev/plugin-share` 0.1.6 a pull uses your `gh` login when GitHub refuses the anonymous request, and
|
|
138
|
+
the refusal then says "sign in with `gh auth login`".
|
|
139
|
+
|
|
96
140
|
## 4. Update it, and keep your own edits
|
|
97
141
|
|
|
98
|
-
Ana changes the plugin and runs the same `plugin publish` again:
|
|
99
|
-
|
|
142
|
+
Ana changes the plugin and runs the same `plugin publish` again: a version that is already released is not released twice, so the plan names the next patch
|
|
143
|
+
(0.1.1). Ben, who has added a file of his own (`BEN.md`) and a comment line to `index.ts`, pulls the new release the same way:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
npm run acryl -- plugin pull github:inboxxobni/sh-guide-clock@0.1.1@sha256:4efa1130533055e7a6ce94cfd54f593a6d47c88fe74a47a71c3b6d08e1ce3472
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
{
|
|
151
|
+
"ok": true,
|
|
152
|
+
"name": "sh-guide-clock",
|
|
153
|
+
"version": "0.1.1",
|
|
154
|
+
"integrity": "sha512-kFO4j0zQjgVmlP38yMttbHDRNIQLTG8wgMUtkE8DlELeBF8Ptw93uPFVrZUgaYuaCfJ5iR6TBH3E+UK8kntGAg==",
|
|
155
|
+
"digest": "4efa1130533055e7a6ce94cfd54f593a6d47c88fe74a47a71c3b6d08e1ce3472",
|
|
156
|
+
"action": "updated",
|
|
157
|
+
"state": "active",
|
|
158
|
+
"remembered": true,
|
|
159
|
+
"kept": [
|
|
160
|
+
"BEN.md",
|
|
161
|
+
"index.ts"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The plugin served the new text (`{"text":"a clock, v0.1.1"}`), `BEN.md` was still there and the first line of `index.ts` was still Ben's comment. What it does:
|
|
167
|
+
|
|
168
|
+
- A folder you never touched is replaced by the new release, live.
|
|
169
|
+
- A folder you changed is merged: the release you pulled is fetched again as the common ancestor, a file only you changed keeps your change, a file of your own stays,
|
|
170
|
+
and a file both changed is merged line by line. The answer names the files that kept something of yours (`kept`).
|
|
171
|
+
- When you and the release changed the same lines, nothing is written. Ben changed the line the release also changed:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
refused: plugins/sh-guide-clock has changes of your own to index.ts, and the new release changes it too. plugins/sh-guide-clock is untouched: move it out of plugins/ and pull again, then bring your changes back by hand.
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
- A plugin another account released under the same name is never merged: it is refused, naming where the copy in the app came from.
|
|
178
|
+
|
|
179
|
+
In the app, the Registry tab shows **Update to v0.1.1** instead of "Added" when the registry lists a newer release than the one you pulled; it asks first and does
|
|
180
|
+
the same as the command.
|
|
181
|
+
|
|
182
|
+
## To npm
|
|
100
183
|
|
|
101
184
|
```sh
|
|
102
|
-
npm run acryl -- plugin
|
|
185
|
+
npm run acryl -- plugin publish sh-guide-clock --to npm --scope guide-test
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
It uses **your own** npm login and nothing else: it asks `npm whoami`. The scope is the account of that login, or `--scope`; `--registry <address>` names another
|
|
189
|
+
registry. A version npm already has makes it the next patch. The plan and the `yes` are the same as for GitHub:
|
|
190
|
+
|
|
103
191
|
```
|
|
192
|
+
Publish to npm as @guide-test/sh-guide-clock (registry https://registry.npmjs.org/, signed in as the account of your own npm login), public, version 0.1.1, license MIT.
|
|
193
|
+
Files: README.md, index.ts, package.json.
|
|
194
|
+
A friend gets exactly these bytes with: npm run acryl -- plugin pull npm:@guide-test/sh-guide-clock@0.1.1@sha256:5af6caf8b8086985f0094c113aa81ce687e8fab1f204609e46ef69a8d5801e13
|
|
195
|
+
Publish @guide-test/sh-guide-clock v0.1.1 under MIT? Type yes to send it: yes
|
|
196
|
+
Published: https://www.npmjs.com/package/@guide-test/sh-guide-clock
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
That run was a **dry run**: the app was started with `npm_config_dry_run=true` in its environment, which makes npm stop before it sends the package (the line
|
|
200
|
+
`Published:` is the app's, and `npm view @guide-test/sh-guide-clock` still answered `E404 Not Found`). The computer had no npm login, so `npm whoami` was answered by
|
|
201
|
+
a stand-in program first on the `PATH` that printed an account name; everything else was the real npm. Use the same two settings to try it without publishing.
|
|
202
|
+
|
|
203
|
+
Signed out, the plan is refused and says how to sign in:
|
|
104
204
|
|
|
105
|
-
|
|
205
|
+
```
|
|
206
|
+
refused: npm whoami failed: you are not signed in to npm on https://registry.npmjs.org/ (sign in with: npm login --registry https://registry.npmjs.org/). fix it, or sign in with: npm login (--registry <address> for another registry); nothing was sent.
|
|
207
|
+
```
|
|
106
208
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
- When Ben and the release changed the same lines, nothing is written: the pull is refused naming the file, and his folder is exactly as it was. Move the folder
|
|
111
|
-
out of `plugins/`, pull again, and bring his change back by hand.
|
|
112
|
-
- A plugin another account released under the same name is never merged: it is refused naming where the copy in the app came from.
|
|
209
|
+
In the app, Settings > Plugins > **Share...** > **Publish to npm** does the same (the account field is the scope), and the card then reads "Shared on npm" with a
|
|
210
|
+
copyable pull line. `plugin pull npm:` was **not run** against the real npm registry: there is no public plugin in this form on npm yet. It is covered by tests,
|
|
211
|
+
which publish and pull a package, check the integrity npm lists, refuse a wrong one, and update in place.
|
|
113
212
|
|
|
114
213
|
## Try it without touching your own account
|
|
115
214
|
|
|
116
|
-
Use a throwaway GitHub organization and a second app with its own home folder, so the two people never share files. Publishing as the organization needs
|
|
117
|
-
|
|
215
|
+
Use a throwaway GitHub organization and a second app with its own home folder, so the two people never share files. Publishing as the organization needs `gh`
|
|
216
|
+
signed in as one of its members: `--owner <organization>`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version a packed app carries (Info.plist, the Windows installer, Settings > Installed apps, and the About window's): the higher of its
|
|
3
|
+
* package.json's, which a product's release sets to its tag (v0.2.8 -> 0.2.8), and its Blend's own, blend.yaml's `metadata.version`, which the person
|
|
4
|
+
* raises as they change the app and package.json does not follow.
|
|
5
|
+
*/
|
|
6
|
+
const triple = (version) => {
|
|
7
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/u.exec(version ?? '')
|
|
8
|
+
return match === null ? undefined : match.slice(1).map(Number)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** The higher of two x.y.z versions; one that is not x.y.z loses, and a tie keeps package.json's. */
|
|
12
|
+
export function osVersion(packageVersion, blendVersion) {
|
|
13
|
+
const a = triple(packageVersion)
|
|
14
|
+
const b = triple(blendVersion)
|
|
15
|
+
if (b === undefined) return packageVersion
|
|
16
|
+
if (a === undefined) return blendVersion
|
|
17
|
+
const at = a.findIndex((part, index) => part !== b[index])
|
|
18
|
+
return at !== -1 && b[at] > a[at] ? blendVersion : packageVersion
|
|
19
|
+
}
|
package/pack/pack-blank-mac.mjs
CHANGED
|
@@ -28,11 +28,13 @@ import {
|
|
|
28
28
|
statSync,
|
|
29
29
|
writeFileSync,
|
|
30
30
|
} from 'node:fs'
|
|
31
|
+
import { createRequire } from 'node:module'
|
|
31
32
|
import { tmpdir } from 'node:os'
|
|
32
33
|
import { basename, dirname, join, resolve } from 'node:path'
|
|
33
34
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
34
35
|
import { desktopEntry, launcherScript, tarballName } from './lib/arch-linux.mjs'
|
|
35
36
|
import { createSource, repositoryOnlyIn } from './lib/create-source.mjs'
|
|
37
|
+
import { osVersion } from './lib/os-version.mjs'
|
|
36
38
|
|
|
37
39
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
38
40
|
/**
|
|
@@ -532,6 +534,23 @@ manifest.build = {
|
|
|
532
534
|
// A Debian package names its maintainer and the app's home page; electron-builder reads both from the manifest.
|
|
533
535
|
manifest.author ??= { name: 'ACRYL Blends', email: 'build@acryldev.dev' }
|
|
534
536
|
manifest.homepage ??= 'https://acrylblends.github.io'
|
|
537
|
+
// The version the OS shows in Installed apps and the About window: the Blend's own when the person raised it past package.json's (lib/os-version.mjs).
|
|
538
|
+
// The packer has no dependencies; the app's own yaml (the frame's) reads blend.yaml.
|
|
539
|
+
const blendVersion = await (async () => {
|
|
540
|
+
try {
|
|
541
|
+
const { parse } = await import(
|
|
542
|
+
pathToFileURL(createRequire(join(app, 'package.json')).resolve('yaml')).href
|
|
543
|
+
)
|
|
544
|
+
const version = parse(readFileSync(join(app, 'blend.yaml'), 'utf8'))?.metadata?.version
|
|
545
|
+
return typeof version === 'string' ? version : undefined
|
|
546
|
+
} catch {
|
|
547
|
+
return undefined
|
|
548
|
+
}
|
|
549
|
+
})()
|
|
550
|
+
manifest.version = osVersion(manifest.version, blendVersion)
|
|
551
|
+
log(
|
|
552
|
+
`version ${manifest.version}${blendVersion === undefined ? '' : ` (package.json and the Blend's ${blendVersion})`}`,
|
|
553
|
+
)
|
|
535
554
|
// 4a. The product's own git (app-storage.md, "Git on a clean machine"): a clean Mac has only the shim that asks to install the Command Line Tools, and
|
|
536
555
|
// versions, export, the terminals and the agents all run `git`. It lies beside the app in Resources/git, and the desktop shell puts it first on the
|
|
537
556
|
// frame host's PATH (plugins/desktop-shell/git.ts).
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"provides": [],
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@deepseek-ai/cordis": "4.0.4",
|
|
9
|
-
"@acryldev/blends-core": "0.6.
|
|
9
|
+
"@acryldev/blends-core": "0.6.2",
|
|
10
10
|
"@acryldev/plugin-hub-core": "0.2.3"
|
|
11
11
|
},
|
|
12
12
|
"mount": "mount it after agent and extensions: root.plugin(builder, { dir: join(root, 'plugins') }); dir must be an extensions source",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { mkdirSync, readFileSync, unwatchFile, watchFile } from 'node:fs'
|
|
12
12
|
import { join } from 'node:path'
|
|
13
13
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
14
|
+
import { readAppVersions } from '@acryldev/blends-core'
|
|
14
15
|
import {
|
|
15
16
|
app,
|
|
16
17
|
BrowserWindow,
|
|
@@ -94,11 +95,36 @@ try {
|
|
|
94
95
|
const projectRoot = chosen.root
|
|
95
96
|
/** Where the Program is: the bundle of a product (its apps' sources hold only the person's files), else the app folder itself. */
|
|
96
97
|
const programRoot = storage === undefined ? projectRoot : bundledRoot
|
|
97
|
-
|
|
98
|
+
/** The versions the About window shows: a packed app's own (Electron's stands in for it in an app run from its folder, so none then), its Blend's and the framework's. */
|
|
99
|
+
function ownVersions(): {
|
|
100
|
+
readonly product?: string
|
|
101
|
+
readonly blend?: string
|
|
102
|
+
readonly framework?: string
|
|
103
|
+
} {
|
|
104
|
+
return {
|
|
105
|
+
...(app.isPackaged ? { product: app.getVersion() } : {}),
|
|
106
|
+
...readAppVersions(chosen.root, programRoot),
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
{
|
|
110
|
+
const own = ownVersions()
|
|
111
|
+
// macOS's About panel: the version, then in parentheses the Blend's and the framework's.
|
|
98
112
|
app.setAboutPanelOptions({
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
applicationVersion: own.product ?? own.blend ?? '',
|
|
114
|
+
version: [
|
|
115
|
+
own.product === undefined || own.blend === undefined ? undefined : `Blend ${own.blend}`,
|
|
116
|
+
own.framework === undefined ? undefined : `ACRYL Blends ${own.framework}`,
|
|
117
|
+
]
|
|
118
|
+
.filter((part): part is string => part !== undefined)
|
|
119
|
+
.join(' · '),
|
|
120
|
+
...(git === undefined
|
|
121
|
+
? {}
|
|
122
|
+
: {
|
|
123
|
+
credits:
|
|
124
|
+
'Includes Git, free software under the GNU GPL version 2. Its licence and the offer of its source are in Settings > App.',
|
|
125
|
+
}),
|
|
101
126
|
})
|
|
127
|
+
}
|
|
102
128
|
|
|
103
129
|
/** Where the window opens: `acrylblends.desktopPath` in package.json (the todo template sets `/todo`), else the root. */
|
|
104
130
|
function startPath(): string {
|
|
@@ -499,7 +525,7 @@ if (!app.requestSingleInstanceLock()) {
|
|
|
499
525
|
new MenuItem({
|
|
500
526
|
label: `About ${app.getName()}`,
|
|
501
527
|
click: () => {
|
|
502
|
-
const about = aboutText(app.getName(),
|
|
528
|
+
const about = aboutText(app.getName(), ownVersions(), process.versions)
|
|
503
529
|
const owner = BrowserWindow.getFocusedWindow() ?? live()[0]
|
|
504
530
|
const options = { type: 'info' as const, buttons: ['OK'], ...about }
|
|
505
531
|
if (owner === undefined) void dialog.showMessageBox(options)
|
|
@@ -76,17 +76,25 @@ export function aboutPlacement(
|
|
|
76
76
|
: help
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* What the About dialog says: the product's version (a packed app's own; an app run from its folder has none, and Electron's is never shown as it),
|
|
81
|
+
* the Blend's version and the ACRYL Blends framework's, then the runtime it runs on (what a bug report needs).
|
|
82
|
+
*/
|
|
80
83
|
export function aboutText(
|
|
81
84
|
name: string,
|
|
82
|
-
|
|
85
|
+
app: { readonly product?: string; readonly blend?: string; readonly framework?: string },
|
|
83
86
|
versions: Readonly<Record<string, string | undefined>>,
|
|
84
87
|
): { readonly message: string; readonly detail: string } {
|
|
88
|
+
const own = [
|
|
89
|
+
...(app.product === undefined ? [] : [`Version ${app.product}`]),
|
|
90
|
+
...(app.blend === undefined ? [] : [`Blend ${app.blend}`]),
|
|
91
|
+
...(app.framework === undefined ? [] : [`ACRYL Blends ${app.framework}`]),
|
|
92
|
+
]
|
|
85
93
|
const runtime = (['electron', 'chrome', 'node'] as const)
|
|
86
94
|
.filter((key) => versions[key] !== undefined)
|
|
87
95
|
.map(
|
|
88
96
|
(key) =>
|
|
89
97
|
`${key === 'chrome' ? 'Chromium' : key === 'node' ? 'Node.js' : 'Electron'} ${versions[key]}`,
|
|
90
98
|
)
|
|
91
|
-
return { message: name, detail: [
|
|
99
|
+
return { message: name, detail: [...own, ...runtime].join('\n') }
|
|
92
100
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acryldev/desktop-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Run the app as a desktop app: an Electron window on the app's own server. `npm run desktop`; the app's code never imports electron.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./package.json": "./package.json"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"@acryldev/blends-core": "workspace:^",
|
|
42
43
|
"@acryldev/instance": "workspace:*",
|
|
43
44
|
"@acryldev/node-server": "workspace:*"
|
|
44
45
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"provides": ["extensions"],
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@deepseek-ai/cordis": "4.0.4",
|
|
9
|
-
"@acryldev/blends-core": "0.6.
|
|
9
|
+
"@acryldev/blends-core": "0.6.2"
|
|
10
10
|
},
|
|
11
11
|
"mount": "mount it after instance: root.plugin(extensions, { sources: [{ dir: join(root, 'plugins'), trust: 'install' }] })",
|
|
12
12
|
"entries": {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@deepseek-ai/cordis": "4.0.4",
|
|
9
9
|
"yaml": "2.9.0",
|
|
10
|
-
"@acryldev/blends-core": "0.6.
|
|
10
|
+
"@acryldev/blends-core": "0.6.2"
|
|
11
11
|
},
|
|
12
12
|
"mount": "in src/app.ts: const manifest = loadManifest(join(chosen.root, 'blend.yaml')); await compose(root, manifest, registry)",
|
|
13
13
|
"entries": {
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
firstRegistryPort,
|
|
25
25
|
gitCli,
|
|
26
26
|
githubCli,
|
|
27
|
-
githubReleasesOverHttps,
|
|
28
27
|
httpsDownload,
|
|
29
28
|
InvalidPluginSourceError,
|
|
30
29
|
NPM_REGISTRY,
|
|
@@ -77,6 +76,7 @@ import {
|
|
|
77
76
|
import { LIST_MAX_BYTES, parsePullList, pullListLocation } from './pull-list.ts'
|
|
78
77
|
import { type PulledRecord, pulledRecords, withPulledRecord } from './pulled-records.ts'
|
|
79
78
|
import { lookUpRegistry, REGISTRY_INDEX_URL } from './registry-source.ts'
|
|
79
|
+
import { LIMITED, releasesWithLoginFallback } from './releases-fallback.ts'
|
|
80
80
|
|
|
81
81
|
export type {
|
|
82
82
|
PublishOptions,
|
|
@@ -300,7 +300,7 @@ export class PluginShare extends Service {
|
|
|
300
300
|
super(ctx, 'pluginShare')
|
|
301
301
|
this.own = ctx
|
|
302
302
|
this.dir = resolve(config.dir ?? join(ctx.appInstance.root, 'plugins'))
|
|
303
|
-
this.releases = config.releases ??
|
|
303
|
+
this.releases = config.releases ?? releasesWithLoginFallback()
|
|
304
304
|
this.download = config.download ?? httpsDownload()
|
|
305
305
|
this.registryIndex = config.registryIndex ?? REGISTRY_INDEX_URL
|
|
306
306
|
this.npmRegistry = config.npm ?? firstRegistryPort(npmRegistryOverHttps(), npmRegistryViaCli())
|
|
@@ -870,10 +870,13 @@ export class PluginShare extends Service {
|
|
|
870
870
|
expectIntegrity === undefined ? {} : { expectIntegrity },
|
|
871
871
|
)
|
|
872
872
|
} catch (cause) {
|
|
873
|
+
const reason = reasonOf(cause)
|
|
873
874
|
return refuse(
|
|
874
875
|
'fetch',
|
|
875
|
-
|
|
876
|
-
|
|
876
|
+
reason,
|
|
877
|
+
LIMITED.test(reason)
|
|
878
|
+
? 'GitHub limits requests that are not signed in (60 an hour per address): sign in with `gh auth login`, or wait an hour, and run the same line again; nothing was installed'
|
|
879
|
+
: 'check the source with the person who released it; nothing was installed',
|
|
877
880
|
)
|
|
878
881
|
}
|
|
879
882
|
// An npm package is `@scope/name` and lives in the folder `name`; a package from any other source must already be named for a folder.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a `github:` pull reads releases: GitHub's public API with no login (a public plugin needs none) and, when GitHub refuses that anonymous request
|
|
3
|
+
* for its limit (60 an hour for everyone behind one address: a workshop room, an office), the person's own `gh` login, which has a limit of its own.
|
|
4
|
+
* A person without `gh` gets the first answer, GitHub's own.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
githubReleasesOverHttps,
|
|
8
|
+
githubReleasesViaGh,
|
|
9
|
+
type ReleasePort,
|
|
10
|
+
} from '@acryldev/plugin-hub-core'
|
|
11
|
+
|
|
12
|
+
/** What the anonymous port says when GitHub limits or refuses it. */
|
|
13
|
+
export const LIMITED = /GitHub answered (?:403|429)/u
|
|
14
|
+
|
|
15
|
+
export function releasesWithLoginFallback(
|
|
16
|
+
anonymous: ReleasePort = githubReleasesOverHttps(),
|
|
17
|
+
signedIn: () => ReleasePort = githubReleasesViaGh,
|
|
18
|
+
): ReleasePort {
|
|
19
|
+
const viaLogin = new Set<string>()
|
|
20
|
+
return {
|
|
21
|
+
async release(owner, repo, tag) {
|
|
22
|
+
try {
|
|
23
|
+
return await anonymous.release(owner, repo, tag)
|
|
24
|
+
} catch (cause) {
|
|
25
|
+
if (!LIMITED.test(cause instanceof Error ? cause.message : String(cause))) throw cause
|
|
26
|
+
try {
|
|
27
|
+
const found = await signedIn().release(owner, repo, tag)
|
|
28
|
+
for (const asset of found?.assets ?? []) viaLogin.add(asset.url)
|
|
29
|
+
return found
|
|
30
|
+
} catch {
|
|
31
|
+
throw cause
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
download: (url) => (viaLogin.has(url) ? signedIn().download(url) : anonymous.download(url)),
|
|
36
|
+
}
|
|
37
|
+
}
|