scenri 0.8.3 → 0.9.1
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/CHANGELOG.md +44 -0
- package/README.md +2 -0
- package/dist/chunk-2IGINCPU.js +61 -0
- package/dist/{chunk-WGIZJXNE.js → chunk-CMLJGPYC.js} +25 -3
- package/dist/chunk-ECS5LRHB.js +69 -0
- package/dist/chunk-OJAG3FRX.js +1940 -0
- package/dist/chunk-PAIAXRAC.js +20 -0
- package/dist/chunk-SDVL5OJF.js +255 -0
- package/dist/cli-FYWM4HBN.js +526 -0
- package/dist/index.js +24 -3
- package/dist/install-4W6AARK6.js +4 -0
- package/dist/{launcher-DIZ4MQRF.js → launcher-IVFIYHPN.js} +6 -2
- package/dist/offer-IVTNHIDJ.js +47 -0
- package/dist/paths-6ZXRZUHY.js +3 -0
- package/dist/refresh-FKQABJOC.js +105 -0
- package/dist/serve.js +154 -1945
- package/dist/src-CSR34EBZ.js +3 -0
- package/launcher/Scenri.icns +0 -0
- package/launcher/launch.mjs +162 -0
- package/launcher/scenri.ico +0 -0
- package/launcher/starting.html +81 -0
- package/package.json +2 -1
- package/studio-dist/assets/index-DSSGRUMi.js +104 -0
- package/studio-dist/assets/{index-teI3lJtu.css → index-DfAHZRYM.css} +1 -1
- package/studio-dist/index.html +2 -2
- package/studio-dist/assets/index-DODDNVtQ.js +0 -104
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { adoptRunningInstall } from './chunk-ECS5LRHB.js';
|
|
2
|
+
import { newestStaged, compareSemver } from './chunk-4MAFHYAD.js';
|
|
3
|
+
import { runningNodeMajor, stableExecPath, isOurMacBundle, MAC_SCRIPT, macPlist, writeSupportFiles, writeMacBundle, writeLnk } from './chunk-SDVL5OJF.js';
|
|
4
|
+
import { readLauncherRecord, launcherDir, LAUNCHER_SCHEMA, writeLauncherRecord } from './chunk-2IGINCPU.js';
|
|
5
|
+
import { existsSync, readFileSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
var ASSETS = ["launch.mjs", "Scenri.icns", "scenri.ico"];
|
|
9
|
+
async function refreshLauncher(deps) {
|
|
10
|
+
if (deps.env.SCENRI_NO_DESKTOP === "1") return {};
|
|
11
|
+
if (deps.installKind === "dev") return {};
|
|
12
|
+
const record = readLauncherRecord(deps.homedir);
|
|
13
|
+
if (!record) return {};
|
|
14
|
+
const out = {};
|
|
15
|
+
const running = runningNodeMajor();
|
|
16
|
+
const ownNode = stableExecPath(deps.execPath, deps.platform);
|
|
17
|
+
const nodeGone = !existsSync(record.nodePath);
|
|
18
|
+
const majorChanged = (nodeGone || samePath(record.nodePath, ownNode, deps.platform) || samePath(record.nodePath, deps.execPath, deps.platform)) && record.nodeMajor !== void 0 && record.nodeMajor !== running;
|
|
19
|
+
let rebuilt = false;
|
|
20
|
+
if (deps.installKind === "npx" || deps.installKind === "global") {
|
|
21
|
+
const newest = newestStaged(deps.home, deps.pkg);
|
|
22
|
+
const newer = !newest || compareSemver(deps.version, newest) > 0;
|
|
23
|
+
const rebuild = majorChanged && newest !== null && compareSemver(deps.version, newest) >= 0;
|
|
24
|
+
if (newer || rebuild) {
|
|
25
|
+
const r = await adoptRunningInstall({
|
|
26
|
+
home: deps.home,
|
|
27
|
+
pkg: deps.pkg,
|
|
28
|
+
version: deps.version,
|
|
29
|
+
ownEntry: deps.ownEntry,
|
|
30
|
+
installKind: deps.installKind,
|
|
31
|
+
verifyImpl: deps.verifyImpl,
|
|
32
|
+
force: rebuild
|
|
33
|
+
});
|
|
34
|
+
if (r.adopted) {
|
|
35
|
+
out.adopted = true;
|
|
36
|
+
rebuilt = rebuild;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const support = launcherDir(deps.homedir);
|
|
41
|
+
const artifact = record.artifact.path;
|
|
42
|
+
const ours = existsSync(artifact) && (record.artifact.kind === "macos-app" ? isOurMacBundle(artifact) : true);
|
|
43
|
+
const schemaStale = record.schema !== LAUNCHER_SCHEMA;
|
|
44
|
+
const nodePath = nodeGone ? ownNode : record.nodePath;
|
|
45
|
+
const nodeMajor = nodeGone || rebuilt ? running : record.nodeMajor ?? running;
|
|
46
|
+
const nodeFilesStale = deps.platform === "darwin" && (readText(join(support, "node-path")) !== `${nodePath}
|
|
47
|
+
` || readText(join(support, "node-major")) !== `${nodeMajor}
|
|
48
|
+
`);
|
|
49
|
+
const supportStale = nodeFilesStale || ASSETS.some((f) => !sameFile(join(support, f), join(deps.assetsDir, f)));
|
|
50
|
+
const mac = ours && record.artifact.kind === "macos-app";
|
|
51
|
+
const iconStale = mac && !sameFile(join(artifact, "Contents", "Resources", "Scenri.icns"), join(deps.assetsDir, "Scenri.icns"));
|
|
52
|
+
const bundleStale = mac && (readText(join(artifact, "Contents", "MacOS", "Scenri")) !== MAC_SCRIPT || readText(join(artifact, "Contents", "Info.plist")) !== macPlist({ version: deps.version, schema: LAUNCHER_SCHEMA }));
|
|
53
|
+
if (schemaStale || supportStale || nodeGone) {
|
|
54
|
+
writeSupportFiles({ assetsDir: deps.assetsDir, execPath: nodePath, platform: deps.platform, nodeMajor }, support);
|
|
55
|
+
}
|
|
56
|
+
if (mac && (schemaStale || iconStale || bundleStale)) {
|
|
57
|
+
writeMacBundle({
|
|
58
|
+
path: artifact,
|
|
59
|
+
icns: join(support, "Scenri.icns"),
|
|
60
|
+
version: deps.version,
|
|
61
|
+
schema: LAUNCHER_SCHEMA
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (ours && record.artifact.kind === "windows-lnk" && (schemaStale || nodeGone)) {
|
|
65
|
+
await writeLnk(deps.runImpl, {
|
|
66
|
+
path: artifact,
|
|
67
|
+
target: nodePath,
|
|
68
|
+
args: `"${join(support, "launch.mjs")}"`,
|
|
69
|
+
workdir: support,
|
|
70
|
+
icon: `${join(support, "scenri.ico")},0`
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (schemaStale || supportStale || nodeGone || iconStale || bundleStale || rebuilt) {
|
|
74
|
+
writeLauncherRecord(deps.homedir, {
|
|
75
|
+
...record,
|
|
76
|
+
schema: LAUNCHER_SCHEMA,
|
|
77
|
+
createdBy: deps.version,
|
|
78
|
+
nodePath,
|
|
79
|
+
nodeMajor
|
|
80
|
+
});
|
|
81
|
+
out.refreshed = true;
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function samePath(a, b, platform) {
|
|
86
|
+
return platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
87
|
+
}
|
|
88
|
+
function readText(path) {
|
|
89
|
+
try {
|
|
90
|
+
return readFileSync(path, "utf8");
|
|
91
|
+
} catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function sameFile(a, b) {
|
|
96
|
+
try {
|
|
97
|
+
return readFileSync(a).equals(readFileSync(b));
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { refreshLauncher };
|
|
104
|
+
//# sourceMappingURL=refresh-FKQABJOC.js.map
|
|
105
|
+
//# sourceMappingURL=refresh-FKQABJOC.js.map
|