Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Automating repacking script and github tagging after publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Apr 17, 2020
1 parent 66b9f53 commit 1bb30f6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "A react-native implementation for sending BLE advertisements",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"postpublish" : "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push --tags"
},
"keywords": [
"react",
Expand Down
41 changes: 30 additions & 11 deletions repack.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
#! /bin/sh

PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]')

NPMFILE="../react-native-ble-advertiser-$PACKAGE_VERSION.tgz"

echo Packing $PACKAGE_VERSION into $NPMFILE

npm pack

echo Installing new Lib on Example app

cd example
npm i ../react-native-ble-advertiser-0.0.13.tgz

if [ $1 = "android" ]
then
npx react-native run-android
else
cd ios
pod install
cd ..
npx react-native run-ios
fi
npm i $NPMFILE
cd ios
pod install
cd ..

if [ -z "$1" ] then
echo Running on "$1"
case "$1" in
"android") npx react-native run-android
;;
"ios") npx react-native run-ios --device
;;
esac
fi

cd ..

0 comments on commit 1bb30f6

Please sign in to comment.