feat(core): add staged self-updates and unify application version

This commit is contained in:
手瓜一十雪 committed 2026-10-18 12:50:11 +08:00
1 parent c54aeffc77
commit 5032cbb8c0
45 files changed
+1860 -165

No files matched your search

+13
View File
@@ -11,8 +11,21 @@ if (!fs.statSync(entryPoint, { throwIfNoEntry: false })?.isFile()) {
throw new Error(`release entry point must be at the archive root: ${entryPoint}`);
}
const release = JSON.parse(fs.readFileSync(path.join(root, 'release.json'), 'utf8'));
const runtimePackage = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
if (release.version !== runtimePackage.version) {
throw new Error('release version does not match its runtime package');
}
const actualEntries = fs.readdirSync(root).filter(name => !['node', 'node.exe'].includes(name));
if (JSON.stringify([...release.entries].sort()) !== JSON.stringify(actualEntries.sort())) {
throw new Error('release file manifest does not match the packaged files');
}
const sqliteRoot = path.join(root, 'native', 'sqlite');
const sqlite = JSON.parse(fs.readFileSync(path.join(sqliteRoot, 'manifest.json'), 'utf8'));
if (release.target !== sqlite.target) {
throw new Error('release target does not match its native artifacts');
}
if (sqlite.package !== '@appthreat/sqlite3' || sqlite.version !== '9.1.0' || sqlite.nativeInterface !== 1
|| !/^(win32|linux|darwin)-(x64|arm64)$/.test(sqlite.target)) {
throw new Error('release has an invalid SQLite native manifest');