Files
AgendaPro/scripts/setup.mjs
T

18 lines
605 B
JavaScript

import path from "node:path";
import { spawnSync } from "node:child_process";
const cacheDir = path.resolve(".cache", "npm");
const npmCli = process.env.npm_execpath || path.join(path.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
const result = spawnSync(process.execPath, [npmCli, "ci", "--cache", cacheDir], {
stdio: "inherit",
// Invoke npm-cli.js through node so paths with spaces need no shell quoting.
shell: false,
});
if (result.error) {
console.error(`No se pudo ejecutar npm: ${result.error.message}`);
process.exit(1);
}
process.exit(result.status ?? 1);