Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const binDest = `${this.dest}/.bin`;
// Using any sort of absolute path here would prevent makePortableProxyScript from preserving symlinks when
// calling the binary
const src = path.resolve(this.dest, pkg.bin[binName]);
if (await fs.exists(src)) {
// We ensure that the target is executable
await fs.chmod(src, 0o755);
}
await fs.mkdirp(binDest);
if (process.platform === 'win32') {
const unlockMutex = await lockMutex(src);
try {
await cmdShim.ifExists(src, `${binDest}/${binName}`, {createPwshFile: false});
} finally {
unlockMutex();
}
} else {
await fs.symlink(src, `${binDest}/${binName}`);
}
}
}
await fs.writeFile(
path.join(this.dest, constants.METADATA_FILENAME),
JSON.stringify(
{
manifest: pkg,
artifacts: [],
remote: this.remote,