Skip to content

Commit

Permalink
Improve console messages, see #1047
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 7, 2021
1 parent aeaea1f commit cff6eaa
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions js/scripts/hook-pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,34 @@ catch( e ) {
// Run typescript type checker if it exists in the checked-out shas
try {
const isRepoTypeScript = require( '../../../perennial-alias/js/common/isRepoTypeScript' );
const tsc = require( '../../../chipper/js/grunt/tsc' );
if ( isRepoTypeScript.apiVersion === '1.0' && tsc.apiVersion === '1.0' &&
isRepoTypeScript( repo ) ) {

( async () => {
const results = await tsc( `../${repo}`, [] );

if ( results.code === 0 ) {
outputToConsole && console.log( 'tsc passed' );
if ( isRepoTypeScript.apiVersion === '1.0' ) {
if ( isRepoTypeScript( repo ) ) {

const tsc = require( '../../../chipper/js/grunt/tsc' );
if ( tsc.apiVersion === '1.0' ) {
( async () => {
const results = await tsc( `../${repo}`, [] );

if ( results.code === 0 ) {
outputToConsole && console.log( 'tsc passed' );
}
else {
console.log( results );
process.exit( results.code );
}
} )();
}
else {
console.log( results );
process.exit( results.code );
outputToConsole && console.log( 'chipper/js/grunt/tsc not compatible' );
}
} )();
}
else {
outputToConsole && console.log( 'skipping tsc for non-typescript repo' );
}
}
else {
console.log( 'chipper/js/grunt/tsc not compatible' );
outputToConsole && console.log( 'isRepoTypeScript not compatible' );
}
}
catch( e ) {
Expand Down

0 comments on commit cff6eaa

Please sign in to comment.