mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-27 08:15:42 +00:00
Add custom cursor packs and harden native postinstall builds
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const npmExecPath = process.env.npm_execpath;
|
||||
const hasNpmExecPath = typeof npmExecPath === "string" && npmExecPath.length > 0;
|
||||
const npmInvoker = hasNpmExecPath
|
||||
? {
|
||||
command: process.execPath,
|
||||
argsPrefix: [npmExecPath],
|
||||
shell: false,
|
||||
}
|
||||
: {
|
||||
command: process.platform === "win32" ? "npm.cmd" : "npm",
|
||||
argsPrefix: [],
|
||||
shell: process.platform === "win32",
|
||||
};
|
||||
|
||||
function runScript(scriptName) {
|
||||
console.log(`[postinstall] Running npm script: ${scriptName}`);
|
||||
const result = spawnSync(npmInvoker.command, [...npmInvoker.argsPrefix, "run", scriptName], {
|
||||
stdio: "inherit",
|
||||
env: process.env,
|
||||
shell: npmInvoker.shell,
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
console.error(
|
||||
`[postinstall] Failed to start "${scriptName}" (${result.error.message}).`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result.signal) {
|
||||
console.error(`[postinstall] "${scriptName}" was terminated by signal ${result.signal}.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result.status !== 0) {
|
||||
console.error(
|
||||
`[postinstall] "${scriptName}" exited with code ${result.status}.`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!runScript("rebuild:native")) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!runScript("build:platform-native-helpers")) {
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user