import { resolve } from "node:path";

import { buildAndValidatePortablePackage } from "./lib/portable-package.mjs";

const outputIndex = process.argv.indexOf("--output");
const outputRoot = outputIndex >= 0 ? resolve(process.argv[outputIndex + 1]) : resolve(".build", "portable-release");
const result = await buildAndValidatePortablePackage({ outputRoot });
console.log(JSON.stringify({
  package: result.packageManifest.package_name,
  sha256: result.packageManifest.zip_sha256,
  status: result.status,
}, null, 2));
