inferay 0.1.2 → 0.1.7
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 +1 -1
- package/src/cli.js +1 -1
- package/src/config.js +3 -3
- package/src/platform.js +1 -1
- package/src/releases.js +3 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
package/src/config.js
CHANGED
|
@@ -2,10 +2,10 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const CONFIG_DIR = join(homedir(), ".inferay");
|
|
6
6
|
export const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
async function readConfig() {
|
|
9
9
|
try {
|
|
10
10
|
return JSON.parse(await readFile(CONFIG_PATH, "utf8"));
|
|
11
11
|
} catch (error) {
|
|
@@ -16,7 +16,7 @@ export async function readConfig() {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
async function writeConfig(config) {
|
|
20
20
|
await mkdir(dirname(CONFIG_PATH), { recursive: true });
|
|
21
21
|
await writeFile(CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`);
|
|
22
22
|
}
|
package/src/platform.js
CHANGED
|
@@ -21,7 +21,7 @@ export function defaultInstallPath() {
|
|
|
21
21
|
return "/Applications/inferay.app";
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function devAppCandidates(cwd = process.cwd()) {
|
|
25
25
|
return [
|
|
26
26
|
resolve(cwd, "build/dev-macos-arm64/inferay-dev.app"),
|
|
27
27
|
resolve(cwd, "build/dev-macos-arm64/inferay.app"),
|
package/src/releases.js
CHANGED
|
@@ -50,7 +50,7 @@ export function findAsset(release, platform) {
|
|
|
50
50
|
return preferred.map((matcher) => assets.find(matcher)).find(Boolean);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
function findChecksumAsset(release) {
|
|
54
54
|
const assets = Array.isArray(release.assets) ? release.assets : [];
|
|
55
55
|
return assets.find((asset) => /checksums?\.txt$/i.test(asset.name || ""));
|
|
56
56
|
}
|
|
@@ -72,14 +72,14 @@ export async function downloadAsset(asset) {
|
|
|
72
72
|
return destination;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
async function sha256(filePath) {
|
|
76
76
|
const hash = createHash("sha256");
|
|
77
77
|
const file = await readFile(filePath);
|
|
78
78
|
hash.update(file);
|
|
79
79
|
return hash.digest("hex");
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
async function verifyChecksum(filePath, expected) {
|
|
83
83
|
if (!expected) {
|
|
84
84
|
return null;
|
|
85
85
|
}
|