File tree Expand file tree Collapse file tree 3 files changed +39
-22
lines changed Expand file tree Collapse file tree 3 files changed +39
-22
lines changed Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #!/usr/ bin/env node
22
3- plugins=" company cookie.chrome cookie.firefox cpp.lint cpp.run github leetcode.cn lintcode solution.discuss"
3+ const arch = require ( 'os' ) . arch ( ) ;
4+ var os = process . platform ;
5+ const ver = process . versions . node . split ( '.' ) [ 0 ] ;
46
5- for plugin in $plugins ; do
6- echo " [$plugin ]"
7- ./bin/leetcode ext -i $plugin
8- done
7+ var bin = './bin/pkg.sh' ;
8+ var args = [ arch , os , ver ] ;
99
10- ver=` node -v | sed ' s/^v//' | awk -F. ' {print $1}' `
11- case ` uname` in
12- Linux) os=linux ;;
13- Darwin) os=macos ;;
14- * ) echo " OS not supported!" && exit 1
15- esac
16- case ` uname -m` in
17- x86_64) arch=x64 ;;
18- i? 86) arch=x32 ;;
19- * ) echo " Arch not supported!" && exit 1
20- esac
10+ if ( os === 'darwin' ) {
11+ args [ 1 ] = 'macos' ;
12+ } else if ( os === 'win32' ) {
13+ bin = 'cmd.exe' ;
14+ args = [ '/c' , 'pkg.bat' ] . concat ( args ) ;
15+ }
2116
22- mkdir -p dist/
23- rm -rf dist/*
24- find node_modules -name " *.node" -exec cp {} dist/ \;
25- npm run pkg -- node$ver -$os -$arch
26- tar zcvf leetcode-cli.$os .tar.gz dist/
17+ var proc = require ( 'child_process' ) . spawn ( bin , args ) ;
18+ proc . stdout . on ( 'data' , x => console . log ( x . toString ( ) . trimRight ( '\n' ) ) ) ;
19+ proc . stderr . on ( 'data' , x => console . log ( x . toString ( ) . trimRight ( '\n' ) ) ) ;
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ arch=$1
4+ os=$2
5+ ver=$3
6+
7+ plugins=" company cookie.chrome cookie.firefox cpp.lint cpp.run github leetcode.cn lintcode solution.discuss"
8+
9+ for plugin in $plugins ; do
10+ echo " [$plugin ]"
11+ # ./bin/leetcode ext -i $plugin
12+ done
13+
14+ DIST=./dist
15+ mkdir -p $DIST
16+ rm -rf $DIST /*
17+
18+ find node_modules -name " *.node" -exec cp {} $DIST \;
19+ npm run pkg -- node$ver -$os -$arch
20+
21+ FILE=leetcode-cli.node$ver .$os .$arch .tar.gz
22+ tar zcvf $FILE $DIST
23+ ls -al $FILE
Original file line number Diff line number Diff line change 7171 "mocha" : " 5.2.0" ,
7272 "nock" : " 10.0.2" ,
7373 "nyc" : " 13.1.0" ,
74+ "pkg" : " ^4.3.4" ,
7475 "rewire" : " 4.0.1"
7576 }
7677}
You can’t perform that action at this time.
0 commit comments