Skip to content

Commit

Permalink
Guard console.log behind --console, see #1350
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 17, 2024
1 parent 7a64ca4 commit 1a6ce3b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions js/scripts/hook-pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const optOutRepos = [
'babel'
];

// Console logging via --console
const commandLineArguments = process.argv.slice( 2 );
const outputToConsole = commandLineArguments.includes( '--console' );

( async () => {

// Identify the current repo
Expand All @@ -54,11 +58,11 @@ const optOutRepos = [
Object.keys( gitHooks ).forEach( key => {
if ( gitHooks[ key ] === 'off' ) {
if ( key === '*' ) {
console.log( 'turning off all tasks' );
outputToConsole && console.log( 'turning off all tasks' );
tasksToRun.length = 0;
}
else {
console.log( 'turning off task:', key );
outputToConsole && console.log( 'turning off task:', key );
tasksToRun.splice( tasksToRun.indexOf( key ), 1 );
}
}
Expand All @@ -67,9 +71,6 @@ const optOutRepos = [

const precommitSuccess = await phetTimingLog.startAsync( `hook-pre-commit repo="${repo}"`, async () => {

// Console logging via --console
const commandLineArguments = process.argv.slice( 2 );
const outputToConsole = commandLineArguments.includes( '--console' );
outputToConsole && console.log( 'repo:', repo );

const taskResults = await Promise.allSettled(
Expand Down

0 comments on commit 1a6ce3b

Please sign in to comment.