Skip to content

Commit a47c44a

Browse files
committed
disable console.log in build scripts
1 parent ea7006a commit a47c44a

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// This is a build scripts, so some logging is desireable as it allows
2+
// us to follow the code path that triggered the error.
3+
/* eslint-disable no-console */
14
const fs = require('fs');
25
const child_process = require('child_process');
36
const binaries = require('./binaries.js');
@@ -7,7 +10,6 @@ function clean(err) {
710
}
811

912
function recompileFromSource() {
10-
// eslint-disable-next-line no-console
1113
console.log('@sentry/profiling-node: Compiling from source...');
1214
let spawn = child_process.spawnSync('npm', ['run', 'build:bindings:configure'], {
1315
stdio: ['inherit', 'inherit', 'pipe'],
@@ -16,9 +18,7 @@ function recompileFromSource() {
1618
});
1719

1820
if (spawn.status !== 0) {
19-
// eslint-disable-next-line no-console
2021
console.log('@sentry/profiling-node: Failed to configure gyp');
21-
// eslint-disable-next-line no-console
2222
console.log('@sentry/profiling-node:', clean(spawn.stderr));
2323
return;
2424
}
@@ -29,36 +29,28 @@ function recompileFromSource() {
2929
shell: true,
3030
});
3131
if (spawn.status !== 0) {
32-
// eslint-disable-next-line no-console
3332
console.log('@sentry/profiling-node: Failed to build bindings');
34-
// eslint-disable-next-line no-console
3533
console.log('@sentry/profiling-node:', clean(spawn.stderr));
3634
return;
3735
}
3836
}
3937

4038
if (fs.existsSync(binaries.target)) {
4139
try {
42-
// eslint-disable-next-line no-console
4340
console.log(`@sentry/profiling-node: Precompiled binary found, attempting to load ${binaries.target}`);
4441
require(binaries.target);
45-
// eslint-disable-next-line no-console
4642
console.log('@sentry/profiling-node: Precompiled binary found, skipping build from source.');
4743
} catch (e) {
48-
// eslint-disable-next-line no-console
4944
console.log('@sentry/profiling-node: Precompiled binary found but failed loading');
50-
// eslint-disable-next-line no-console
5145
console.log('@sentry/profiling-node:', e);
5246
try {
5347
recompileFromSource();
5448
} catch (e) {
55-
// eslint-disable-next-line no-console
5649
console.log('@sentry/profiling-node: Failed to compile from source');
5750
throw e;
5851
}
5952
}
6053
} else {
61-
// eslint-disable-next-line no-console
6254
console.log('@sentry/profiling-node: No precompiled binary found');
6355
recompileFromSource();
6456
}

packages/profiling-node/scripts/copy-target.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// This is a build scripts, so some logging is desireable as it allows
2+
// us to follow the code path that triggered the error.
3+
/* eslint-disable no-console */
14
const fs = require('fs');
25
const path = require('path');
36
const process = require('process');
@@ -13,15 +16,12 @@ const source = path.join(__dirname, '..', 'build', 'Release', 'sentry_cpu_profil
1316
const target = path.join(__dirname, '..', 'lib', binaries.getModuleName());
1417

1518
if (!fs.existsSync(source)) {
16-
// eslint-disable-next-line no-console
1719
console.log('Source file does not exist:', source);
1820
process.exit(1);
1921
} else {
2022
if (fs.existsSync(target)) {
21-
// eslint-disable-next-line no-console
2223
console.log('Target file already exists, overwriting it');
2324
}
24-
// eslint-disable-next-line no-console
2525
console.log('Renaming', source, 'to', target);
2626
fs.renameSync(source, target);
2727
}

packages/profiling-node/scripts/prune-profiler-binaries.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#! /usr/bin/env node
2+
3+
// This is a build scripts, so some logging is desireable as it allows
4+
// us to follow the code path that triggered the error.
5+
/* eslint-disable no-console */
26
const fs = require('fs');
37

48
let SOURCE_DIR, PLATFORM, ARCH, STDLIB, NODE, HELP;
@@ -37,7 +41,6 @@ for (let i = 0; i < process.argv.length; i++) {
3741
}
3842

3943
if (HELP) {
40-
// eslint-disable-next-line no-console
4144
console.log(
4245
`\nSentry: Prune profiler binaries\n
4346
Usage: sentry-prune-profiler-binaries --target_dir_path=... --target_platform=... --target_arch=... --target_stdlib=...\n
@@ -91,7 +94,6 @@ If you are unsure about the execution environment, you can opt to skip some valu
9194
}
9295

9396
if (ARGV_ERRORS.length > 0) {
94-
// eslint-disable-next-line no-console
9597
console.log(ARGV_ERRORS.join('\n'));
9698
process.exit(1);
9799
}
@@ -150,26 +152,22 @@ async function prune(binaries) {
150152
removedBinariesCount++;
151153

152154
if (process.argv.includes('--dry-run')) {
153-
// eslint-disable-next-line no-console
154155
console.log(`Sentry: would have pruned ${binary} (${bytesToHumanReadable(stats.size)})`);
155156
continue;
156157
}
157158

158-
// eslint-disable-next-line no-console
159159
console.log(`Sentry: pruned ${binary} (${bytesToHumanReadable(stats.size)})`);
160160
fs.unlinkSync(binary);
161161
}
162162

163163
if (removedBinariesCount === 0) {
164-
// eslint-disable-next-line no-console
165164
console.log(
166165
'❌ Sentry: no binaries pruned, please make sure target argument values are valid or use --help for more information.',
167166
);
168167
return;
169168
}
170169

171170
if (process.argv.includes('--dry-run')) {
172-
// eslint-disable-next-line no-console
173171
console.log(
174172
`✅ Sentry: would have pruned ${removedBinariesCount} ${
175173
removedBinariesCount === 1 ? 'binary' : 'binaries'
@@ -178,7 +176,6 @@ async function prune(binaries) {
178176
return;
179177
}
180178

181-
// eslint-disable-next-line no-console
182179
console.log(
183180
`✅ Sentry: pruned ${removedBinariesCount} ${
184181
removedBinariesCount === 1 ? 'binary' : 'binaries'

0 commit comments

Comments
 (0)