@volter/sdk 0.5.209 → 0.5.210
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@volter/sdk",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.210",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -487,7 +487,7 @@
|
|
|
487
487
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
488
488
|
"@storybook/react": "10.6.0",
|
|
489
489
|
"@types/node": "^22.0.0",
|
|
490
|
-
"@volter/project": "0.5.
|
|
490
|
+
"@volter/project": "0.5.210",
|
|
491
491
|
"mediabunny": "1.56.2",
|
|
492
492
|
"postcss": "8.5.28",
|
|
493
493
|
"rrweb": "2.1.6",
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
* `AGENTS.md`, `CLAUDE.md`), so the project's agent servers and instructions keep working.
|
|
32
32
|
*/
|
|
33
33
|
import { spawn } from 'node:child_process';
|
|
34
|
-
import { existsSync, lstatSync, readFileSync } from 'node:fs';
|
|
34
|
+
import { existsSync, lstatSync, readFileSync, statSync } from 'node:fs';
|
|
35
35
|
import { mkdir, readdir, readFile, rename, rm, rmdir, writeFile } from 'node:fs/promises';
|
|
36
36
|
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
37
37
|
import { MANIFEST_FILENAME } from '@volter/project/manifest/filename';
|
|
38
38
|
import { hasManifest } from '@volter/project/manifest/locate';
|
|
39
|
+
import { EDITOR_SESSION_DISCOVERY_TIMEOUT_MS, HttpSessionDiscovery } from './discovery';
|
|
40
|
+
import { readLiveRegisteredSessions } from './registry-format';
|
|
39
41
|
import { compareSemver } from './editor-compatibility';
|
|
40
42
|
|
|
41
43
|
export const UPGRADE_USAGE = "upgrade [version] # move this project's @volter packages and its engine pin to one release (default: latest); from a project made before 0.5.203, run the newest release's own: npx <package>@latest upgrade";
|
|
@@ -355,6 +357,34 @@ async function readRelease(product: UpgradingProduct, requested: string | undefi
|
|
|
355
357
|
}
|
|
356
358
|
}
|
|
357
359
|
|
|
360
|
+
/** Whether an editor session is open on `project` now (the same folder on disk, however it was typed).
|
|
361
|
+
* The Next lines close one first; with none open, `close` runs the project's OLD install, whose
|
|
362
|
+
* refusal before 0.5.210 was a wall about other sessions and exit 1. The registry names each live
|
|
363
|
+
* editor's project; a registered editor that did not answer may be this one, and a question nobody
|
|
364
|
+
* could answer keeps the close line. */
|
|
365
|
+
async function editorOpenOn(project: string): Promise<boolean> {
|
|
366
|
+
try {
|
|
367
|
+
const here = statSync(project, { bigint: true });
|
|
368
|
+
const isHere = (path: string | null): boolean => {
|
|
369
|
+
if (path === null) return false;
|
|
370
|
+
try {
|
|
371
|
+
const there = statSync(path, { bigint: true });
|
|
372
|
+
return there.dev === here.dev && there.ino === here.ino;
|
|
373
|
+
} catch {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
const registered = readLiveRegisteredSessions();
|
|
378
|
+
if (registered.length === 0) return false;
|
|
379
|
+
if (registered.some((session) => isHere(session.project))) return true;
|
|
380
|
+
const answered = await new HttpSessionDiscovery().listSessions(EDITOR_SESSION_DISCOVERY_TIMEOUT_MS);
|
|
381
|
+
// listSessions drops a session whose probe failed, and throws only when none answered.
|
|
382
|
+
return answered.length < registered.length || answered.some((session) => isHere(session.project));
|
|
383
|
+
} catch {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
358
388
|
/** A verb as a person runs it from the project folder, through its own install and in any shell (the Next lines
|
|
359
389
|
* at the end of `upgradeProject` say why). */
|
|
360
390
|
function projectLine(command: string, verb: string): string {
|
|
@@ -675,7 +705,8 @@ export async function upgradeProject(product: UpgradingProduct, requested?: stri
|
|
|
675
705
|
// pin that moved alone is read again by the page's Retry. The old session is closed before
|
|
676
706
|
// `npm install` replaces the packages under it, and by the command it was started with.
|
|
677
707
|
if (packagesChanged) {
|
|
678
|
-
|
|
708
|
+
if (await editorOpenOn(project))
|
|
709
|
+
console.log(` ${npx} --no-install ${linked ? product.command : retired?.command ?? product.command} close`);
|
|
679
710
|
if (!linked) console.log(` ${npm} install`);
|
|
680
711
|
console.log(` ${npx} --no-install ${product.command} edit .`);
|
|
681
712
|
} else {
|