zenstack
Version:
FullStack enhancement for Prisma ORM: seamless integration from database to UI
34 lines • 1.63 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.execSync = execSync;
exports.execPackage = execPackage;
const child_process_1 = require("child_process");
/**
* Utility for executing command synchronously and prints outputs on current console
*/
function execSync(cmd, options) {
var _a;
const _b = options !== null && options !== void 0 ? options : {}, { env } = _b, restOptions = __rest(_b, ["env"]);
const mergedEnv = env ? Object.assign(Object.assign({}, process.env), env) : undefined;
(0, child_process_1.execSync)(cmd, Object.assign({ encoding: 'utf-8', stdio: (_a = options === null || options === void 0 ? void 0 : options.stdio) !== null && _a !== void 0 ? _a : 'inherit', env: mergedEnv }, restOptions));
}
/**
* Utility for running package commands through npx/bunx
*/
function execPackage(cmd, options) {
var _a;
const packageManager = ((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.bun) ? 'bunx' : 'npx';
execSync(`${packageManager} ${cmd}`, options);
}
//# sourceMappingURL=exec-utils.js.map
;