@@ -359,12 +359,20 @@ function main(argv) {
359359 process . exit ( 1 ) ;
360360 }
361361
362- //if (files.includes('package.json') ?
363- //!files.includes('yarn.lock') : files.includes('yarn.lock')) {
364- //console.error('pr-check.js - any update to package.json or yarn.lock ' +
365- //'must include the other file. Please update through yarn.');
366- //process.exit(1);
367- //}
362+ // Make sure changes to package.json also update yarn.lock.
363+ if ( files . indexOf ( 'package.json' ) != - 1 && files . indexOf ( 'yarn.lock' ) == - 1 ) {
364+ console . error ( fileLogPrefix , util . colors . red ( 'ERROR:' ) ,
365+ 'Updates to' , util . colors . cyan ( 'package.json' ) ,
366+ 'must be accompanied by a corresponding update to' ,
367+ util . colors . cyan ( 'yarn.lock' ) ) ;
368+ console . error ( fileLogPrefix , util . colors . yellow ( 'NOTE:' ) ,
369+ 'To update' , util . colors . cyan ( 'yarn.lock' ) , 'after changing' ,
370+ util . colors . cyan ( 'package.json' ) + ',' , 'run' ,
371+ '"' + util . colors . cyan ( 'yarn install' ) + '"' ,
372+ 'and include the change to' , util . colors . cyan ( 'yarn.lock' ) ,
373+ 'in your PR.' ) ;
374+ process . exit ( 1 ) ;
375+ }
368376
369377 const sortedBuildTargets = [ ] ;
370378 for ( const t of buildTargets ) {
0 commit comments