Skip to content

Commit 298d1d0

Browse files
committed
Move root node_modules post-install
1 parent b1ca319 commit 298d1d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/scripts/postinstall

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ var logger = require( 'debug' );
3333

3434
var debug = logger( 'stdlib:post-install' );
3535

36+
// Define the folder name for storing node_modules dependencies:
37+
var NODE_MODULES = 'node_modules;'
38+
3639
// Resolve the root project directory (WARNING: this is fragile and likely needs to be updated should this file move!):
3740
var ROOT_DIR = path.resolve( __dirname, '..', '..' );
3841

@@ -80,6 +83,15 @@ function main() {
8083

8184
out = [];
8285

86+
debug( 'Checking for root node_modules...' );
87+
odir = path.join( ROOT_DIR, NODE_MODULES );
88+
if ( fs.existsSync( odir ) ) {
89+
debug( 'Detected root node_modules. Moving...' );
90+
ndir = path.join( DEST_DIR, NODE_MODULES );
91+
fs.renameSync( odir, ndir );
92+
out.push( [ odir, ndir ] );
93+
}
94+
8395
debug( 'Reading package directory...' );
8496
list = fs.readdirSync( PKG_DIR );
8597

0 commit comments

Comments
 (0)