File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -8,19 +8,20 @@ import * as path from 'path';
88
99const PACKAGE_ASSETS = [ 'gatsby-browser.js' , 'gatsby-node.js' ] ;
1010
11- export function prepack ( buildDir : string ) : void {
11+ export function prepack ( buildDir : string ) : boolean {
1212 // copy package-specific assets to build dir
13- PACKAGE_ASSETS . forEach ( asset => {
13+ return PACKAGE_ASSETS . every ( asset => {
1414 const assetPath = path . resolve ( asset ) ;
1515 try {
1616 if ( ! fs . existsSync ( assetPath ) ) {
1717 console . error ( `Asset ${ asset } does not exist.` ) ;
18- process . exit ( 1 ) ;
18+ return false ;
1919 }
2020 fs . copyFileSync ( assetPath , path . resolve ( buildDir , asset ) ) ;
2121 } catch ( error ) {
2222 console . error ( `Error while copying ${ asset } to ${ buildDir } ` ) ;
23- process . exit ( 1 ) ;
23+ return false ;
2424 }
25+ return true ;
2526 } ) ;
2627}
Original file line number Diff line number Diff line change 9191async function runPackagePrepack ( packagePrepackPath : string ) : Promise < void > {
9292 const { prepack } = await import ( packagePrepackPath ) ;
9393 if ( prepack && typeof prepack === 'function' ) {
94- prepack ( buildDir ) ;
94+ const success = prepack ( buildDir ) ;
95+ if ( ! success ) {
96+ process . exit ( 1 ) ;
97+ }
9598 }
9699}
97100
You can’t perform that action at this time.
0 commit comments