signing-enclave
Version:
A code signing and notarization tool for macOS and Windows applications. Uses Azure Key Vault for secret and certificate management.
65 lines • 3.11 kB
JavaScript
;
// src/commands/watch.ts
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchCommand = void 0;
const extra_typings_1 = require("@commander-js/extra-typings");
const path_1 = __importDefault(require("path"));
const watcher_1 = require("../watcher");
const utils_1 = require("../utils");
function parseNotarizationOptions(options) {
// validate options
const optionsObj = JSON.parse(options);
if (!optionsObj.appleId ||
!optionsObj.teamId ||
!optionsObj.$appSpecificPassword) {
throw new Error("Invalid notarization options");
}
return optionsObj;
}
exports.watchCommand = new extra_typings_1.Command("watch")
.description("Start watching a folder for new files")
.option("-f, --folder <path>", "Path to the folder to watch", "./watched_folder")
.option("--mac-cert <name>", "Name of the mac certificate to use in Azure KeyVault")
.option("--mac-notarize <json>", "JSON object containing appleId, teamId and the name of the appSpecificPassword reference in Azure KeyVault")
.option("--mac-installer-cert <name>", "Name of the mac installer certificate to use in Azure KeyVault")
.option("--mas-development-cert <name>", "Name of the mac app store certificate to use in Azure KeyVault")
.option("--mas-distribution-cert <name>", "Name of the mac app store certificate to use in Azure KeyVault")
.option("--mas-installer-cert <name>", "Name of the mac app store certificate to use in Azure KeyVault")
.option("--windows-cert <name>", "Name of the windows certificate to use in Azure KeyVault")
.option("--secrets <json>", "JSON object containing the secrets to use in Azure KeyVault")
.action(async (options) => {
const watchFolder = path_1.default.resolve(process.cwd(), options.folder);
// Ensure the watch folder exists
await (0, utils_1.ensureDir)(watchFolder);
const parsedOptions = {
macCert: options.macCert,
macNotarize: options.macNotarize
? parseNotarizationOptions(options.macNotarize)
: undefined,
windowsCert: options.windowsCert,
macInstallerCert: options.macInstallerCert,
masDevelopmentCert: options.masDevelopmentCert,
masDistributionCert: options.masDistributionCert,
masInstallerCert: options.masInstallerCert,
secrets: options.secrets ? JSON.parse(options.secrets) : undefined,
};
const eventEmitter = await (0, watcher_1.doWatchFolder)(watchFolder, parsedOptions);
eventEmitter.on("processing", (message) => {
console.log(message);
});
eventEmitter.on("completed", (message) => {
console.log(message);
});
// Keep the process alive
process.stdin.resume();
// Handle process termination
process.on("SIGINT", () => {
console.log("Closing watcher...");
eventEmitter.emit("close");
process.exit(0);
});
});
//# sourceMappingURL=watch.js.map