Skip to content

Commit

Permalink
[pkg] bail out if error occurs
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Wang <skygragon@gmail.com>
  • Loading branch information
skygragon committed Nov 24, 2018
1 parent 450f85a commit 7704e11
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions bin/pkg
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ if (os === 'darwin') {
var proc = require('child_process').spawn(bin, args);
proc.stdout.on('data', x => console.log(x.toString().trimRight('\n')));
proc.stderr.on('data', x => console.log(x.toString().trimRight('\n')));
proc.on('close', process.exit);
20 changes: 13 additions & 7 deletions bin/pkg.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ set arch=%1
set os=%2
set ver=%3

set dist=dist\
set file=leetcode-cli.node%ver%.%os%.%arch%.zip

mkdir %dist%
del /q %dist%\*
del /q *.zip

for %%x in (company cookie.chrome cookie.firefox cpp.lint cpp.run github leetcode.cn lintcode solution.discuss) do (
echo [%%x]
node bin\leetcode ext -i %%x
if %ERRORLEVEL% gtr 0 exit /b 1
)

set dist=dist\
mkdir %dist%
del /q %dist%\*

for /r . %%x in (*.node) do copy %%x %dist%
npm run pkg -- node%ver%-%os%-%arch%
call npm run pkg -- node%ver%-%os%-%arch%
if %ERRORLEVEL% gtr 0 exit /b 1

set file=leetcode-cli.node%ver%.%os%.%arch%.zip
7z a %file% %dist%
7z a %file% %dist%
if %ERRORLEVEL% gtr 0 exit /b 1
exit 0
15 changes: 9 additions & 6 deletions bin/pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ arch=$1
os=$2
ver=$3

DIST=./dist
FILE=leetcode-cli.node$ver.$os.$arch.tar.gz

mkdir -p $DIST
rm -rf $DIST/*
rm -rf $FILE

plugins="company cookie.chrome cookie.firefox cpp.lint cpp.run github leetcode.cn lintcode solution.discuss"

for plugin in $plugins; do
echo "[$plugin]"
./bin/leetcode ext -i $plugin
done

DIST=./dist
mkdir -p $DIST
rm -rf $DIST/*

find node_modules -name "*.node" -exec cp {} $DIST \;
npm run pkg -- node$ver-$os-$arch

FILE=leetcode-cli.node$ver.$os.$arch.tar.gz
tar zcvf $FILE $DIST
tar zcvf $FILE $DIST
ls -al $FILE
exit 0

0 comments on commit 7704e11

Please sign in to comment.