[ADF-922] Regenerate package-lock.json files for every package and create script for doing that in the future (#2012)

* Updated package-lock.json files

* npm-relock-pkgs.sh

* Update README.md

* Fix ng2-alfresco-search sass problem
This commit is contained in:
Popovics András
2017-06-23 19:32:20 +01:00
committed by Eugenio Romano
parent 6f6a0aca5d
commit ba9c459a83
36 changed files with 85386 additions and 1245 deletions

View File

@@ -200,6 +200,43 @@ The default behaviour of the ***npm-build-all.sh*** install node_modules and bui
For development environment configuration please refer to [project docs](../demo-shell-ng2/README.md).
# npm-relock-pkgs.sh
***npm-relock-pkgs.sh*** Deletes and regenerates package-lock.json files for each|passed components, depending on the component's actual package.json
## Options
| Option | Description |
| --- | --- |
| -h or --help | show the help |
| -t or --test | If you want run the test suites after "npm install" of each component
## Examples
* Regenerate package-lock.json files for every package
```sh
./npm-relock-pkgs.sh
```
* Regenerate package-lock.json files for ng2-alfresco-core and ng2-alfresco-search components
```sh
./npm-relock-pkgs.sh ng2-alfresco-core ng2-alfresco-search
```
* Regenerate package-lock.json files for every package and run test suite for them
```sh
./npm-relock-pkgs.sh -t
```
* Regenerate package-lock.json files for for ng2-alfresco-core and ng2-alfresco-search components and run test suite for them
```sh
./npm-relock-pkgs.sh -t ng2-alfresco-core ng2-alfresco-search
```
# npm-clean.sh
***npm-clean.sh*** clean all the projects folder : ng2-components, ng2-components/*.*/demo and demo-shell-ng2.

78
scripts/npm-relock-pkgs.sh Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -f
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval RUN_TEST=false
eval SELECTED_UNITS=""
eval SELECTED_UNITS_ONLY=false
eval projects=( "ng2-alfresco-core"
"ng2-alfresco-datatable"
"ng2-activiti-diagrams"
"ng2-activiti-analytics"
"ng2-activiti-form"
"ng2-activiti-tasklist"
"ng2-activiti-processlist"
"ng2-alfresco-documentlist"
"ng2-alfresco-login"
"ng2-alfresco-search"
"ng2-alfresco-social"
"ng2-alfresco-tag"
"ng2-alfresco-social"
"ng2-alfresco-upload"
"ng2-alfresco-viewer"
"ng2-alfresco-webscript"
"ng2-alfresco-userinfo" )
show_help() {
echo "Usage: npm-relock-pkgs.sh [options] [packages...]"
echo ""
echo "Options:"
echo "-t or -test run the test suites for every package after npm install"
}
enable_test(){
RUN_TEST=true
}
test_project() {
echo "====== test project: $1 ====="
npm run test -- --component $1 || exit 1
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--test) enable_test $2; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
for PACKAGE in "$@"
do
SELECTED_UNITS="$SELECTED_UNITS \"$PACKAGE\""
SELECTED_UNITS_ONLY=true
done
if $SELECTED_UNITS_ONLY == true; then
eval projects=($SELECTED_UNITS)
fi
echo "====== Regenerate package-lock.json ====="
for PACKAGE in ${projects[@]}
do
echo "====== $PACKAGE ====="
DESTDIR="$DIR/../ng2-components/$PACKAGE"
cd $DESTDIR
npm install rimraf
npm run clean-lock
npm run clean
npm install
if $RUN_TEST == true; then
test_project $PACKAGE
fi
done