11/*
22 This script prepares the central `build` directory for NPM package creation.
3- It first copies all non-code files into the `build` directory, including `package.json` which
4- is edited to adjust entry point paths. These corrections are performed so that they align with
3+ It first copies all non-code files into the `build` directory, including `package.json`, which
4+ is edited to adjust entry point paths. These corrections are performed so that the paths align with
55 the directory structure inside `build`.
66*/
77
@@ -13,7 +13,7 @@ const BUILD_DIR = 'build';
1313const ASSETS = [ 'README.md' , 'LICENSE' , 'package.json' , '.npmignore' ] ;
1414const ENTRY_POINTS = [ 'main' , 'module' , 'types' ] ;
1515
16- // check if build dirs exists
16+ // check if build dir exists
1717if ( ! fs . existsSync ( BUILD_DIR ) ) {
1818 console . error ( `Directory ${ BUILD_DIR } DOES NOT exist` ) ;
1919 console . error ( "This script should only be executed after you've run `yarn build`." ) ;
@@ -33,7 +33,7 @@ ASSETS.forEach(asset => {
3333const packageJsonPath = path . join ( process . cwd ( ) , BUILD_DIR , 'package.json' ) ;
3434const pkg : { [ key : string ] : string } = require ( packageJsonPath ) ;
3535
36- // modify entry points to point to correct paths (i.e. delete the build directory)
36+ // modify entry points to point to correct paths (i.e. strip out the build directory)
3737ENTRY_POINTS . filter ( entryPoint => ! ! pkg [ entryPoint ] ) . forEach ( entryPoint => {
3838 pkg [ entryPoint ] = pkg [ entryPoint ] . replace ( `${ BUILD_DIR } /` , '' ) ;
3939} ) ;
@@ -45,4 +45,4 @@ delete pkg.volta;
4545// write modified package.json to file
4646fs . writeFileSync ( packageJsonPath , JSON . stringify ( pkg , null , 2 ) ) ;
4747
48- console . log ( 'Successfully finished postbuild commands' ) ;
48+ console . log ( `\nSuccessfully finished postbuild commands for ${ pkg . name } ` ) ;
0 commit comments