From 00416f76d715c5ca2fe0aa199d961e6b1cae2b48 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 27 Jun 2017 12:58:33 +0100 Subject: [PATCH] Script add pkg and clean update --- scripts/README.md | 19 +++++++++++++++++++ scripts/npm-add-pkg.sh | 14 ++++++-------- scripts/npm-clean.sh | 2 -- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 42be3efdee..92edf4c6fb 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -259,3 +259,22 @@ For development environment configuration please refer to [project docs](../demo | -h or --help | show the help | | -r or --registry | against which register you want do this 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 +``` \ No newline at end of file diff --git a/scripts/npm-add-pkg.sh b/scripts/npm-add-pkg.sh index b626950ab8..1eafe93a23 100755 --- a/scripts/npm-add-pkg.sh +++ b/scripts/npm-add-pkg.sh @@ -11,7 +11,6 @@ show_help() { echo "Usage: npm-clean.sh" echo "--save" echo "--save-dev" - echo "-p name of the package" echo "-sd or -skipDemo skip the clean of the demo folder of any components" } @@ -37,24 +36,21 @@ clea_demo() { EXEC_DEMO=false } -name_pkg(){ - NAME_PKG=$1 -} - save(){ + NAME_PKG=$1 SAVE_OPT=true } save_dev(){ + NAME_PKG=$1 SAVE_DEV_OPT=true } while [[ $1 == -* ]]; do case "$1" in -h|--help|-\?) show_help; exit 0;; - -p) name_pkg $2; shift 2;; - --save) save; shift;; - --save-dev) save_dev; shift;; + --save) save $2; shift 2;; + --save-dev) save_dev $2; shift 2;; -sd|--skipDemo) clea_demo; shift;; -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; esac @@ -70,6 +66,7 @@ do fi if $SAVE_DEV_OPT == true; then + echo "====== npm install --save-dev ${NAME_PKG} =====" npm install --save-dev ${NAME_PKG} fi done @@ -85,6 +82,7 @@ fi cd "$DIR/../ng2-components" + if $SAVE_OPT == true; then npm install --save ${NAME_PKG} fi diff --git a/scripts/npm-clean.sh b/scripts/npm-clean.sh index 091ac3b19a..527195b976 100755 --- a/scripts/npm-clean.sh +++ b/scripts/npm-clean.sh @@ -58,12 +58,10 @@ do done cd "$DIR/../demo-shell-ng2" -npm install rimraf npm run clean cd "$DIR/../ng2-components" -npm install rimraf npm run clean cd ${DIR}