poku
Version:
🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.
28 lines (25 loc) • 816 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntime = void 0;
const node_path_1 = require("path");
const node_process_1 = require("process");
const getRuntime = () => {
const { _, POKU_RUNTIME } = node_process_1.env;
if (POKU_RUNTIME)
return POKU_RUNTIME;
if (typeof _ === 'string') {
const bin = (0, node_path_1.basename)(_);
if (bin.indexOf('bun') !== -1)
return 'bun';
if (bin.indexOf('deno') !== -1)
return 'deno';
if (bin.indexOf('node') !== -1 || bin.indexOf('tsx') !== -1)
return 'node';
}
if (typeof Deno !== 'undefined')
return 'deno';
if (typeof Bun !== 'undefined')
return 'bun';
return 'node';
};
exports.getRuntime = getRuntime;