File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11const fs = require ( 'fs' )
22const path = require ( 'path' )
3- const mkdir = name => fs . existsSync ( name ) || fs . mkdirSync ( name )
3+ const mkdir = dir => fs . existsSync ( dir ) || fs . mkdirSync ( dir )
4+ const checkPath = file => fs . existsSync ( file ) && file
45
5- process . chdir ( __dirname )
6- mkdir ( 'node_modules ')
6+ // Link "node_modules/shared" to wherever "@react-spring/shared" can be found.
7+ createAlias ( 'shared' , '@react-spring/shared ')
78
8- // Link "node_modules/shared" to "node_modules/@react-spring/shared"
9- const target = '@react-spring/shared'
10- fs . symlinkSync ( target , 'node_modules/shared' )
9+ function createAlias ( alias , target ) {
10+ target =
11+ // Look for "node_modules/@react-spring/{self}/node_modules/{target}"
12+ checkPath ( path . join ( __dirname , 'node_modules' , target ) ) ||
13+ // Look for "node_modules/{target}"
14+ checkPath ( path . resolve ( __dirname , '../..' , target ) )
15+
16+ if ( target ) {
17+ let origin = path . join ( __dirname , 'node_modules' )
18+ mkdir ( origin )
19+ target = path . relative ( origin , target )
20+ origin = path . join ( origin , alias )
21+ fs . symlinkSync ( target , origin )
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments