puppeteer-finder
Version:
Find a executable Chrome / Edge / Firefox in your system
30 lines • 1.04 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const win32_1 = __importDefault(require("./win32"));
const darwin_1 = __importDefault(require("./darwin"));
const linux_1 = __importDefault(require("./linux"));
const ERROR_PLATFORM_NOT_SUPPORT = new Error('platform not support');
const ERROR_NO_INSTALLATIONS_FOUND = new Error('no chrome installations found');
function findChromes() {
switch (process.platform) {
case 'win32': return (0, win32_1.default)();
case 'darwin': return (0, darwin_1.default)();
case 'linux':
case 'android':
return (0, linux_1.default)();
default:
throw ERROR_PLATFORM_NOT_SUPPORT;
}
}
module.exports = function findChrome() {
const installations = findChromes();
if (installations.length) {
return installations[0];
}
else {
throw ERROR_NO_INSTALLATIONS_FOUND;
}
};
//# sourceMappingURL=index.js.map