rittenhop-dev/versions/5.94.2/node_modules/@sentry/profiling-node/scripts/copy-target.js

28 lines
886 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
// This is a build scripts, so some logging is desireable as it allows
// us to follow the code path that triggered the error.
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
const process = require('process');
const binaries = require('./binaries.js');
const build = path.resolve(__dirname, '..', 'lib');
if (!fs.existsSync(build)) {
fs.mkdirSync(build, { recursive: true });
}
const source = path.join(__dirname, '..', 'build', 'Release', 'sentry_cpu_profiler.node');
const target = path.join(__dirname, '..', 'lib', binaries.getModuleName());
if (!fs.existsSync(source)) {
console.log('Source file does not exist:', source);
process.exit(1);
} else {
if (fs.existsSync(target)) {
console.log('Target file already exists, overwriting it');
}
console.log('Renaming', source, 'to', target);
fs.renameSync(source, target);
}