runbay 0.1.4 → 0.1.5
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/out/main/index.js +23 -5
- package/package.json +1 -1
package/out/main/index.js
CHANGED
|
@@ -56,8 +56,9 @@ function cachedIcon(key, candidates) {
|
|
|
56
56
|
}
|
|
57
57
|
async function resolve(key, candidates) {
|
|
58
58
|
const cacheDir = node_path.join(electron.app.getPath("userData"), "icon-cache");
|
|
59
|
-
const cacheFile = node_path.join(cacheDir, node_crypto.createHash("sha1").update(`
|
|
60
|
-
if (node_fs.existsSync(cacheFile))
|
|
59
|
+
const cacheFile = node_path.join(cacheDir, node_crypto.createHash("sha1").update(`v3:${key}`).digest("hex"));
|
|
60
|
+
if (node_fs.existsSync(cacheFile) && Date.now() - node_fs.statSync(cacheFile).mtimeMs < 7 * 24 * 36e5)
|
|
61
|
+
return toDataUrl(node_fs.readFileSync(cacheFile));
|
|
61
62
|
for (const url of await candidates()) {
|
|
62
63
|
const buf = await download(url);
|
|
63
64
|
if (buf) {
|
|
@@ -171,6 +172,23 @@ async function readJsonSafe(file2) {
|
|
|
171
172
|
async function readPackageJson(dir) {
|
|
172
173
|
return readJsonSafe(node_path.join(dir, "package.json"));
|
|
173
174
|
}
|
|
175
|
+
function repoUrl(pkg) {
|
|
176
|
+
const repo = pkg.repository;
|
|
177
|
+
const raw = typeof repo === "string" ? repo : typeof repo?.url === "string" ? repo.url : void 0;
|
|
178
|
+
if (!raw) return void 0;
|
|
179
|
+
let url = raw.trim().replace(/^git\+/, "");
|
|
180
|
+
const ssh = url.match(/^ssh:\/\/git@([^/]+)\/(.+)$/);
|
|
181
|
+
if (ssh) url = `https://${ssh[1]}/${ssh[2]}`;
|
|
182
|
+
const scp = url.match(/^git@([^:/]+)[:/](.+)$/);
|
|
183
|
+
if (scp) url = `https://${scp[1]}/${scp[2]}`;
|
|
184
|
+
url = url.replace(/\.git$/, "").replace(/\/+$/, "");
|
|
185
|
+
try {
|
|
186
|
+
const parsed = new URL(url);
|
|
187
|
+
return parsed.protocol === "https:" || parsed.protocol === "http:" ? url : void 0;
|
|
188
|
+
} catch {
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
174
192
|
async function readPkgMeta(dir, pkgName) {
|
|
175
193
|
const pkg = dir ? await readPackageJson(dir) ?? {} : {};
|
|
176
194
|
const binField = pkg.bin;
|
|
@@ -178,7 +196,7 @@ async function readPkgMeta(dir, pkgName) {
|
|
|
178
196
|
return {
|
|
179
197
|
version: typeof pkg.version === "string" ? pkg.version : void 0,
|
|
180
198
|
description: typeof pkg.description === "string" ? pkg.description : void 0,
|
|
181
|
-
homepage: typeof pkg.homepage === "string" ? pkg.homepage :
|
|
199
|
+
homepage: typeof pkg.homepage === "string" ? pkg.homepage : repoUrl(pkg),
|
|
182
200
|
bins
|
|
183
201
|
};
|
|
184
202
|
}
|
|
@@ -697,13 +715,13 @@ async function applySelfUpdate() {
|
|
|
697
715
|
return { state: "done", message: `Updated to ${target} — restart to apply` };
|
|
698
716
|
}
|
|
699
717
|
if (!await installedGlobally()) {
|
|
700
|
-
return { state: "manual", message: `npm install -g ${PKG}
|
|
718
|
+
return { state: "manual", message: `npm install -g ${PKG}@${target}` };
|
|
701
719
|
}
|
|
702
720
|
const root = await globalRoot();
|
|
703
721
|
const shim = node_path.join(node_path.dirname(root), `${PKG}.cmd`);
|
|
704
722
|
const script = node_path.join(electron.app.getPath("userData"), "update.cmd");
|
|
705
723
|
const log = node_path.join(electron.app.getPath("userData"), "update.log");
|
|
706
|
-
const install = `call npm install -g ${PKG}
|
|
724
|
+
const install = `call npm install -g ${PKG}@${target}${registryFlag}`;
|
|
707
725
|
const body = [
|
|
708
726
|
"@echo off",
|
|
709
727
|
"ping -n 5 127.0.0.1 >nul",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runbay",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Not an installer. A launcher. Detect, launch, update and uninstall apps installed from the command line (npm, pnpm, yarn, bun, scoop) — in one modern window.",
|
|
5
5
|
"main": "./out/main/index.js",
|
|
6
6
|
"bin": {
|