webhelm 1.0.45 → 1.0.46
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 +4 -1
- package/package.json +1 -1
- package/runtime/auto-update.mjs +28 -11
- package/runtime/extension/manifest.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,10 @@ The Extension is bundled with the npm Runtime and staged by WebHelm Daemon at `~
|
|
|
42
42
|
check (`com.lalalic.webhelm.keepalive`, every 30 seconds) and the npm Runtime
|
|
43
43
|
updater (`com.lalalic.webhelm.runtime-update`, every hour and at login).
|
|
44
44
|
The updater checks the npm registry and downloads new releases to a temporary
|
|
45
|
-
location without running npm lifecycle scripts.
|
|
45
|
+
location without running npm lifecycle scripts. Each check and installation
|
|
46
|
+
uses an isolated, disposable npm cache rather than a potentially stale npx
|
|
47
|
+
cache. If npm release metadata has not propagated yet, it defers safely and
|
|
48
|
+
retries on the next scheduled check. It validates that Runtime and
|
|
46
49
|
Extension versions match, stages an immutable copy under
|
|
47
50
|
`~/.local/share/webhelm/runtime-VERSION`, and uses the stable
|
|
48
51
|
`~/.local/share/webhelm/runtime-current` symlink for subsequent launches.
|
package/package.json
CHANGED
package/runtime/auto-update.mjs
CHANGED
|
@@ -20,17 +20,24 @@ export function compareVersions(a,b) {
|
|
|
20
20
|
return 0;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
// The Skill launcher may use a persistent npx cache with a stale packument.
|
|
24
|
+
// New versions can appear in npm view yet still fail ETARGET at npm install.
|
|
25
|
+
// Always query via an isolated, disposable npm cache.
|
|
26
|
+
export function npmLatest({run=execFileSync}={}) {
|
|
27
|
+
const cache=fs.mkdtempSync(path.join(os.tmpdir(),'webhelm-npm-metadata-'));
|
|
28
|
+
try{
|
|
29
|
+
const value=run('npm',['view','webhelm','version','--json','--registry='+REGISTRY,
|
|
30
|
+
'--cache='+cache,'--prefer-online','--fetch-retries=0','--fetch-timeout=8000'],
|
|
31
|
+
{encoding:'utf8',timeout:15000,stdio:['ignore','pipe','pipe']});
|
|
32
|
+
const version=JSON.parse(value);
|
|
33
|
+
compareVersions(version,version);
|
|
34
|
+
return version;
|
|
35
|
+
}finally{fs.rmSync(cache,{recursive:true,force:true});}
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
// npm installs into an isolated temporary prefix; lifecycle scripts never run.
|
|
32
39
|
// The existing offline staging contract (Runtime + yaml) remains unchanged.
|
|
33
|
-
export function downloadRuntime(version,{home=os.homedir()}={}) {
|
|
40
|
+
export function downloadRuntime(version,{home=os.homedir(),run=execFileSync}={}) {
|
|
34
41
|
compareVersions(version,version);
|
|
35
42
|
const cached=path.join(home,'.local/share/webhelm',`runtime-${version}`);
|
|
36
43
|
try {
|
|
@@ -43,9 +50,10 @@ export function downloadRuntime(version,{home=os.homedir()}={}) {
|
|
|
43
50
|
}catch{}
|
|
44
51
|
const temp=fs.mkdtempSync(path.join(os.tmpdir(),'webhelm-npm-upgrade-'));
|
|
45
52
|
try {
|
|
46
|
-
|
|
53
|
+
run('npm',['install','--prefix',temp,'--no-save','--omit=dev','--ignore-scripts',
|
|
47
54
|
'--no-audit','--no-fund','--package-lock=false','--fetch-retries=0',
|
|
48
|
-
|
|
55
|
+
'--registry='+REGISTRY,'--cache='+path.join(temp,'.npm-cache'),
|
|
56
|
+
'--prefer-online','webhelm@'+version],
|
|
49
57
|
{timeout:120000,stdio:['ignore','pipe','pipe']});
|
|
50
58
|
const source=path.join(temp,'node_modules/webhelm');
|
|
51
59
|
const manifest=JSON.parse(fs.readFileSync(path.join(source,'package.json'),'utf8'));
|
|
@@ -129,8 +137,17 @@ export async function upgradeRuntime({home=os.homedir(),source=SOURCE,nodePath=p
|
|
|
129
137
|
JSON.parse(fs.readFileSync(path.join(currentTarget,'package.json'),'utf8')).version===target;
|
|
130
138
|
if(upToDate&&!force)return {status:'current',upgraded:false,version:target,global_cli:migrateLegacyRuntimeCli({home})};
|
|
131
139
|
// Stage before requesting the daemon to drain; download may take time.
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
let staged;
|
|
141
|
+
try{
|
|
142
|
+
staged=compareVersions(target,local)>0
|
|
143
|
+
? await download(target,{home}) : stageRuntimeForLoginGuard({home,source});
|
|
144
|
+
}catch(error){
|
|
145
|
+
const cause=String(error.stderr||'')+' '+String(error.message||'');
|
|
146
|
+
if(/\b(?:ETARGET|ENOVERSIONS|E404)\b/.test(cause))
|
|
147
|
+
return {status:'deferred',upgraded:false,reason:'npm_release_not_yet_resolvable',
|
|
148
|
+
latest:target,detail:'npm registry or cache has not propagated the release; retry later'};
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
134
151
|
if(!force && daemon && compareVersions(daemon.version,target)<0){
|
|
135
152
|
let gate;
|
|
136
153
|
try{gate=await ipc({op:'upgrade-prepare'});}
|