@acryldev/blends 1.7.12 → 1.7.14
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.d.ts +4 -4
- package/dist/index.js +61 -17
- package/dist/index.js.map +1 -1
- package/pack/lib/create-source.mjs +13 -1
- package/pack/pack-blank-mac.mjs +6 -1
- package/package.json +1 -1
- package/plugins/desktop-shell/frame.ts +7 -2
- package/plugins/desktop-shell/inherited.ts +26 -0
- package/plugins/desktop-shell/main.ts +19 -1
- package/plugins/desktop-shell/menu.ts +32 -0
- package/plugins/desktop-shell/package.json +1 -1
- package/plugins/plugin-share/package.json +1 -1
- package/plugins/plugin-share/plugin.json +1 -1
- package/plugins/save/package.json +1 -1
- package/plugins/save/plugin.json +1 -1
- package/plugins/save/share.ts +31 -4
package/dist/index.d.ts
CHANGED
|
@@ -220,10 +220,10 @@ interface UpdateOptions {
|
|
|
220
220
|
export declare function parseUpdateOptions(argv: readonly string[]): UpdateOptions;
|
|
221
221
|
/** What the update needs outside the app folder. Tests pass their own. */
|
|
222
222
|
interface UpdateWorld {
|
|
223
|
-
/** The
|
|
224
|
-
latest(
|
|
225
|
-
/** Make
|
|
226
|
-
make(
|
|
223
|
+
/** The newest release of `source` (a registry id: its version; `github:owner/repo`: its newest version tag), or undefined when there is none. */
|
|
224
|
+
latest(source: string): Promise<string | undefined>;
|
|
225
|
+
/** Make `source` at `release` as a new app named `name` inside `folder` (git repository, no install); resolves to the exit code. */
|
|
226
|
+
make(source: string, name: string, folder: string, release: string): Promise<number>;
|
|
227
227
|
}
|
|
228
228
|
export declare function update(options: UpdateOptions, io: Io, world?: UpdateWorld): Promise<number>;
|
|
229
229
|
interface UpgradeOptions {
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var packages = {
|
|
|
47
47
|
"path": "../plugins/app-shell"
|
|
48
48
|
},
|
|
49
49
|
"@acryldev/workspace": {
|
|
50
|
-
"version": "0.2.
|
|
50
|
+
"version": "0.2.3",
|
|
51
51
|
"path": "../plugins/workspace"
|
|
52
52
|
},
|
|
53
53
|
"@acryldev/settings": {
|
|
@@ -75,7 +75,7 @@ var packages = {
|
|
|
75
75
|
"path": "../plugins/support"
|
|
76
76
|
},
|
|
77
77
|
"@acryldev/loopback-http": {
|
|
78
|
-
"version": "0.2.
|
|
78
|
+
"version": "0.2.1",
|
|
79
79
|
"path": "../runtime/loopback-http"
|
|
80
80
|
},
|
|
81
81
|
"@acryldev/web": {
|
|
@@ -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.10",
|
|
99
99
|
"path": "../plugins/blends-frame"
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -3533,6 +3533,25 @@ function blendOfApp(yaml) {
|
|
|
3533
3533
|
version
|
|
3534
3534
|
};
|
|
3535
3535
|
}
|
|
3536
|
+
function sourceOfApp(yaml) {
|
|
3537
|
+
const blend = blendOfApp(yaml);
|
|
3538
|
+
if (blend === void 0) return void 0;
|
|
3539
|
+
const metadata = /^metadata:\n((?:[ \t]+.*\n?)*)/mu.exec(yaml)?.[1] ?? "";
|
|
3540
|
+
const from = /^[ \t]+from:[ \t]*["']?([^"'\s]+)/mu.exec(metadata)?.[1];
|
|
3541
|
+
if (from === void 0) return {
|
|
3542
|
+
source: blend.id,
|
|
3543
|
+
current: blend.version
|
|
3544
|
+
};
|
|
3545
|
+
const [source = blend.id, release] = from.split("#");
|
|
3546
|
+
return {
|
|
3547
|
+
source,
|
|
3548
|
+
current: release === void 0 ? blend.version : release.replace(/^v/u, "")
|
|
3549
|
+
};
|
|
3550
|
+
}
|
|
3551
|
+
/** The newest `vX.Y.Z` (or `X.Y.Z`) tag among `git ls-remote --tags` lines, as tagged. */
|
|
3552
|
+
function newestTag(lsRemote) {
|
|
3553
|
+
return lsRemote.split("\n").map((line) => /refs\/tags\/(v?\d+\.\d+\.\d+)$/u.exec(line.trim())?.[1]).filter((tag) => tag !== void 0).reduce((best, tag) => best === void 0 || isNewerVersion(tag.replace(/^v/u, ""), best.replace(/^v/u, "")) ? tag : best, void 0);
|
|
3554
|
+
}
|
|
3536
3555
|
/** `0.2.0` is newer than `0.1.9`; anything that is not three numbers is never newer. */
|
|
3537
3556
|
function isNewerVersion(candidate, current) {
|
|
3538
3557
|
const parse = (text) => /^(\d+)\.(\d+)\.(\d+)$/u.exec(text)?.slice(1).map(Number);
|
|
@@ -3545,19 +3564,37 @@ function isNewerVersion(candidate, current) {
|
|
|
3545
3564
|
function registryWorld(io) {
|
|
3546
3565
|
return {
|
|
3547
3566
|
async latest(id) {
|
|
3567
|
+
if (id.startsWith("github:")) {
|
|
3568
|
+
const run = spawnSync("git", [
|
|
3569
|
+
"ls-remote",
|
|
3570
|
+
"--tags",
|
|
3571
|
+
"--refs",
|
|
3572
|
+
`https://github.com/${id.slice(7)}.git`
|
|
3573
|
+
], {
|
|
3574
|
+
encoding: "utf8",
|
|
3575
|
+
windowsHide: true,
|
|
3576
|
+
timeout: 3e4,
|
|
3577
|
+
env: {
|
|
3578
|
+
...process.env,
|
|
3579
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
3580
|
+
}
|
|
3581
|
+
});
|
|
3582
|
+
if (run.status !== 0) throw new Error(`${id} could not be read: ${(run.stderr ?? "").trim() || "git ls-remote failed"}`);
|
|
3583
|
+
return newestTag(run.stdout ?? "");
|
|
3584
|
+
}
|
|
3548
3585
|
const answer = await fetch(REGISTRY_INDEX, { signal: AbortSignal.timeout(2e4) });
|
|
3549
3586
|
if (!answer.ok) throw new Error(`the registry answered ${answer.status} (${REGISTRY_INDEX})`);
|
|
3550
3587
|
return (await answer.json()).entries?.find((entry) => entry.id === id)?.version;
|
|
3551
3588
|
},
|
|
3552
|
-
make: (id, name, folder) => new Promise((done) => {
|
|
3589
|
+
make: (id, name, folder, release) => new Promise((done) => {
|
|
3553
3590
|
const { file, args } = packageManagerInvocation("npm", [
|
|
3554
3591
|
"exec",
|
|
3555
3592
|
"--yes",
|
|
3556
|
-
|
|
3593
|
+
`@acryldev/create-blends@${VERSION}`,
|
|
3557
3594
|
"--",
|
|
3558
3595
|
name,
|
|
3559
3596
|
"--from",
|
|
3560
|
-
id,
|
|
3597
|
+
id.startsWith("github:") ? `${id}#${release}` : id,
|
|
3561
3598
|
"--no-install"
|
|
3562
3599
|
]);
|
|
3563
3600
|
const run = spawnSync(file, args, {
|
|
@@ -3581,14 +3618,20 @@ async function update(options, io, world = registryWorld(io)) {
|
|
|
3581
3618
|
const say = (line) => io.stdout.write(`${line}\n`);
|
|
3582
3619
|
const manifest = join(app, "blend.yaml");
|
|
3583
3620
|
if (!existsSync(manifest)) throw new Error(`${app} has no blend.yaml: it was not made from a Blend, so there is nothing to update from`);
|
|
3584
|
-
const
|
|
3585
|
-
if (
|
|
3586
|
-
|
|
3587
|
-
const
|
|
3588
|
-
|
|
3589
|
-
|
|
3621
|
+
const origin = sourceOfApp(readFileSync(manifest, "utf8"));
|
|
3622
|
+
if (origin === void 0) throw new Error(`${manifest} names no metadata id and version`);
|
|
3623
|
+
const fromRepository = origin.source.startsWith("github:");
|
|
3624
|
+
const blend = {
|
|
3625
|
+
id: origin.source,
|
|
3626
|
+
version: origin.current
|
|
3627
|
+
};
|
|
3628
|
+
say(`${basename(app)} was made from ${blend.id} ${blend.version}. Asking ${fromRepository ? "the repository" : "the registry"} for its latest release...`);
|
|
3629
|
+
const newest = await world.latest(blend.id);
|
|
3630
|
+
if (newest === void 0) {
|
|
3631
|
+
say(fromRepository ? `${blend.id} has no release tags (vX.Y.Z), so there is nothing to update from it yet.` : `${blend.id} is not a Blend in the registry, so there is nothing to update from it.`);
|
|
3590
3632
|
return 0;
|
|
3591
3633
|
}
|
|
3634
|
+
const latest = newest.replace(/^v/u, "");
|
|
3592
3635
|
if (!isNewerVersion(latest, blend.version)) {
|
|
3593
3636
|
say(`${blend.id} ${blend.version} is the latest release: nothing to update.`);
|
|
3594
3637
|
return 0;
|
|
@@ -3636,9 +3679,9 @@ async function update(options, io, world = registryWorld(io)) {
|
|
|
3636
3679
|
}
|
|
3637
3680
|
const scratch = mkdtempSync(join(tmpdir(), "acrylblends-update-"));
|
|
3638
3681
|
try {
|
|
3639
|
-
say(`Getting ${blend.id} ${
|
|
3682
|
+
say(`Getting ${blend.id} ${newest} (@acryldev/create-blends@${VERSION}, as the app was made)...`);
|
|
3640
3683
|
const name = basename(app);
|
|
3641
|
-
if (await world.make(blend.id, name, scratch) !== 0) throw new Error(`${blend.id} ${latest} could not be made; the app is unchanged`);
|
|
3684
|
+
if (await world.make(blend.id, name, scratch, newest) !== 0) throw new Error(`${blend.id} ${latest} could not be made; the app is unchanged`);
|
|
3642
3685
|
const fetched = git([
|
|
3643
3686
|
"fetch",
|
|
3644
3687
|
"-q",
|
|
@@ -3654,7 +3697,7 @@ async function update(options, io, world = registryWorld(io)) {
|
|
|
3654
3697
|
"-p",
|
|
3655
3698
|
base,
|
|
3656
3699
|
"-m",
|
|
3657
|
-
`${blend.id} ${latest} from the registry`
|
|
3700
|
+
`${blend.id} ${latest} from ${fromRepository ? "its repository" : "the registry"}`
|
|
3658
3701
|
]).out;
|
|
3659
3702
|
if (!release) throw new Error("the new release could not be recorded in the app");
|
|
3660
3703
|
say(`Merging ${blend.id} ${latest} into ${name} (your changes are kept)...`);
|
|
@@ -4473,8 +4516,9 @@ Usage:
|
|
|
4473
4516
|
acrylblends upgrade [plugin...] [--dir d] [--dry-run] [--force] [--diff]
|
|
4474
4517
|
Bring the library plugins an app carries (the router, the server, the door, ...) up to this
|
|
4475
4518
|
version: untouched files are replaced, an edited file stops it (diff shown) unless --force
|
|
4476
|
-
acrylblends update [--dir d] [--check] Bring the newer release of
|
|
4477
|
-
|
|
4519
|
+
acrylblends update [--dir d] [--check] Bring the newer release of what this app was made from (blend.yaml metadata.from: a registry
|
|
4520
|
+
Blend, or a shared GitHub repository's newest vX.Y.Z tag) into it, keeping your changes
|
|
4521
|
+
(a git merge); --check only says whether there is one
|
|
4478
4522
|
acrylblends plugins List the plugin library
|
|
4479
4523
|
acrylblends open [dir] Print the address of the frame running this app (the URL npm run dev printed),
|
|
4480
4524
|
for a page that has to be opened again after its session ended
|