2024-03-05 07:03:53 +01:00
|
|
|
// Sign the app and binaries for macOS
|
|
|
|
|
2023-11-05 08:00:47 +01:00
|
|
|
const { signAsync } = require("@electron/osx-sign");
|
2024-02-24 00:14:25 +01:00
|
|
|
const path = require("path");
|
2024-03-05 07:03:53 +01:00
|
|
|
const fs = require("fs");
|
2023-11-05 08:00:47 +01:00
|
|
|
|
2024-03-05 07:03:53 +01:00
|
|
|
/**
|
|
|
|
* Sign the app and binaries for macOS
|
|
|
|
* @param {string} waveAppPath - Path to the Wave.app
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
*/
|
|
|
|
async function signApp(waveAppPath) {
|
|
|
|
const binDirPath = path.resolve(waveAppPath, "Contents", "Resources", "app.asar.unpacked", "bin");
|
|
|
|
const binFilePaths = fs
|
|
|
|
.readdirSync(binDirPath, { recursive: true, withFileTypes: true })
|
|
|
|
.filter((f) => f.isFile())
|
|
|
|
.map((f) => path.resolve(binDirPath, f.path, f.name));
|
|
|
|
console.log("waveAppPath", waveAppPath);
|
|
|
|
console.log("binDirPath", binDirPath);
|
|
|
|
console.log("binFilePaths", binFilePaths);
|
|
|
|
return signAsync({
|
|
|
|
app: waveAppPath,
|
|
|
|
binaries: binFilePaths,
|
2024-02-24 00:14:25 +01:00
|
|
|
})
|
2024-03-05 07:03:53 +01:00
|
|
|
.then(() => {
|
|
|
|
console.log("signing success");
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
console.log("signing error", e);
|
|
|
|
process.exit(1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (require.main === module) {
|
|
|
|
console.log("running osx-sign");
|
|
|
|
const waveAppPath = path.resolve(__dirname, "temp", "Wave.app");
|
|
|
|
(async () => {
|
|
|
|
await signApp(waveAppPath);
|
|
|
|
console.log("signing complete");
|
|
|
|
})();
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
signApp,
|
|
|
|
};
|