File tree Expand file tree Collapse file tree 5 files changed +39
-3
lines changed
Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 1- #!/usr/ bin/env node
1+ #! /bin/sh
22
3- require ( '../lib/binaries/CLI.js' ) ;
3+ SCRIPT_PATH=" $( dirname " $0 " ) /../lib/binaries/CLI.js"
4+
5+ # Check if 'bun' is available, otherwise use 'node'
6+ if command -v bun > /dev/null 2>&1
7+ then
8+ bun " $SCRIPT_PATH " " $@ "
9+ else
10+ node " $SCRIPT_PATH " " $@ "
11+ fi
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ require ( '../lib/binaries/CLI.js' ) ;
Original file line number Diff line number Diff line change 101101 "scripts" : {
102102 "test:unit" : " bash test/unit.sh" ,
103103 "test:e2e" : " bash test/e2e.sh" ,
104- "test" : " bash test/unit.sh && bash test/e2e.sh"
104+ "test" : " bash test/unit.sh && bash test/e2e.sh" ,
105+ "preinstall" : " node ./preinstall.js"
105106 },
106107 "keywords" : [
107108 " cli" ,
Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const path = require ( 'path' ) ;
3+
4+ // Determine platform
5+ const isWindows = process . platform === 'win32' ;
6+
7+ if ( ! isWindows )
8+ process . exit ( 0 )
9+
10+ const sourceFile = 'bin/pm2-windows' ;
11+ const destinationFile = 'bin/pm2' ;
12+
13+ // Resolve file paths
14+ const sourcePath = path . resolve ( __dirname , sourceFile ) ;
15+ const destinationPath = path . resolve ( __dirname , destinationFile ) ;
16+
17+ // Copy the appropriate file based on the platform
18+ fs . copyFile ( sourcePath , destinationPath , ( err ) => {
19+ if ( err ) {
20+ console . error ( `Error copying file from ${ sourcePath } to ${ destinationPath } :` , err ) ;
21+ process . exit ( 1 ) ;
22+ }
23+ console . log ( `Successfully copied ${ sourceFile } to ${ destinationFile } ` ) ;
24+ } ) ;
You can’t perform that action at this time.
0 commit comments