Script add pkg and clean update

This commit is contained in:
Eugenio Romano
2017-06-27 12:58:33 +01:00
parent 1b259ebef2
commit 00416f76d7
3 changed files with 25 additions and 10 deletions

View File

@@ -259,3 +259,22 @@ For development environment configuration please refer to [project docs](../demo
| -h or --help | show the help | | -h or --help | show the help |
| -r or --registry | against which register you want do this check | | -r or --registry | against which register you want do this check |
| -v or --version | the version of the components to check | | -v or --version | the version of the components to check |
***npm-add-pkg.sh*** check the bundles in the package npm are present
Add a package across all the pacakge json in the project
| Option | Description |
| --- | --- |
| -h or --help | show the help |
| --save | save it in dependencies |
| --save-dev | save it in dev dependencies |
| -sd | skip the demo projects |
* Add a package in the project
```sh
./npm-add-pkg.sh --save-dev NPM_NAME
```

View File

@@ -11,7 +11,6 @@ show_help() {
echo "Usage: npm-clean.sh" echo "Usage: npm-clean.sh"
echo "--save" echo "--save"
echo "--save-dev" echo "--save-dev"
echo "-p name of the package"
echo "-sd or -skipDemo skip the clean of the demo folder of any components" echo "-sd or -skipDemo skip the clean of the demo folder of any components"
} }
@@ -37,24 +36,21 @@ clea_demo() {
EXEC_DEMO=false EXEC_DEMO=false
} }
name_pkg(){
NAME_PKG=$1
}
save(){ save(){
NAME_PKG=$1
SAVE_OPT=true SAVE_OPT=true
} }
save_dev(){ save_dev(){
NAME_PKG=$1
SAVE_DEV_OPT=true SAVE_DEV_OPT=true
} }
while [[ $1 == -* ]]; do while [[ $1 == -* ]]; do
case "$1" in case "$1" in
-h|--help|-\?) show_help; exit 0;; -h|--help|-\?) show_help; exit 0;;
-p) name_pkg $2; shift 2;; --save) save $2; shift 2;;
--save) save; shift;; --save-dev) save_dev $2; shift 2;;
--save-dev) save_dev; shift;;
-sd|--skipDemo) clea_demo; shift;; -sd|--skipDemo) clea_demo; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;; -*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac esac
@@ -70,6 +66,7 @@ do
fi fi
if $SAVE_DEV_OPT == true; then if $SAVE_DEV_OPT == true; then
echo "====== npm install --save-dev ${NAME_PKG} ====="
npm install --save-dev ${NAME_PKG} npm install --save-dev ${NAME_PKG}
fi fi
done done
@@ -85,6 +82,7 @@ fi
cd "$DIR/../ng2-components" cd "$DIR/../ng2-components"
if $SAVE_OPT == true; then if $SAVE_OPT == true; then
npm install --save ${NAME_PKG} npm install --save ${NAME_PKG}
fi fi

View File

@@ -58,12 +58,10 @@ do
done done
cd "$DIR/../demo-shell-ng2" cd "$DIR/../demo-shell-ng2"
npm install rimraf
npm run clean npm run clean
cd "$DIR/../ng2-components" cd "$DIR/../ng2-components"
npm install rimraf
npm run clean npm run clean
cd ${DIR} cd ${DIR}