69 lines
2.2 KiB
JavaScript
69 lines
2.2 KiB
JavaScript
const crypto = require("crypto");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const AdmZip = require("adm-zip");
|
|
|
|
const root = path.join(__dirname, "..");
|
|
const destination = path.join(root, "dist", "lumi-core-1.2.0-to-0.2.5-repair.zip");
|
|
const files = [
|
|
"CHANGELOG.md",
|
|
"README.md",
|
|
"package.json",
|
|
"package-lock.json",
|
|
"release-index.json",
|
|
"run.js",
|
|
"update-manifest.json",
|
|
"docs/updates.md",
|
|
"docs/production-diagnostics.md",
|
|
"docs/update-audit-0.2.0.md",
|
|
"knowledge/core/lumi-core.md",
|
|
"scripts/verify-release-metadata.js",
|
|
"scripts/verify-all.js",
|
|
"scripts/build-core-repair-patch.js",
|
|
"scripts/verify-core-repair-patch.js",
|
|
"scripts/verify-update-system.js",
|
|
"scripts/verify-production-diagnostics.js",
|
|
"scripts/production-diagnostics-client.js",
|
|
"scripts/verify-webui.js",
|
|
"src/services/dependency-manager.js",
|
|
"src/services/overlay-connectors.js",
|
|
"src/services/repo-update.js",
|
|
"src/services/production-diagnostics.js",
|
|
"src/services/settings.js",
|
|
"src/services/update-index.js",
|
|
"src/services/update-manager.js",
|
|
"src/services/update-repository.js",
|
|
"src/web/server.js",
|
|
"src/web/public/app.js",
|
|
"src/web/views/admin-updates.ejs",
|
|
"src/web/views/admin-diagnostics.ejs"
|
|
];
|
|
|
|
const hashes = {};
|
|
const zip = new AdmZip();
|
|
for (const relativePath of files) {
|
|
const filePath = path.join(root, relativePath);
|
|
if (!fs.statSync(filePath, { throwIfNoEntry: false })?.isFile()) {
|
|
throw new Error(`Repair patch input is missing: ${relativePath}`);
|
|
}
|
|
const contents = fs.readFileSync(filePath);
|
|
hashes[relativePath] = crypto.createHash("sha256").update(contents).digest("hex");
|
|
zip.addFile(relativePath.replace(/\\/g, "/"), contents);
|
|
}
|
|
|
|
const manifest = {
|
|
schema_version: 1,
|
|
name: "Lumi core 0.2.5 repair",
|
|
target: "core",
|
|
from_versions: ["0.1.9", "1.2.0", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5"],
|
|
to_version: "0.2.5",
|
|
data_policy: "preserve",
|
|
dependency_policy: "sync_on_restart",
|
|
created_at: new Date().toISOString(),
|
|
files: hashes
|
|
};
|
|
zip.addFile("patch-manifest.json", Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`));
|
|
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
zip.writeZip(destination);
|
|
console.log(destination);
|