Fix build problem (#1861)

* fix sourcemap
fix relative path and pre publish build
change travis wait
all test run build and remove unused cpx

* global test task
modify publish script to accept options

* appveyor run

* different approach single test run

* make it work the analytics test
modify start demo shell script to use a different registry

* sourcemap demo shell working

* update readme and add install after any clean
add registry option in start.sh script
add develop and normal mode in demo shell
add -d option in start.sh to point to the local components
add -c option in build script to point to the local components
This commit is contained in:
Mario Romano
2017-05-11 18:08:35 +01:00
committed by Eugenio Romano
parent b0be88ec37
commit 6da0eaba37
88 changed files with 3203 additions and 774 deletions

View File

@@ -25,7 +25,13 @@ feel for what's available.
* Start the demo, install all the dependencies, and remove the previous version of the npm packages (*Note. do this only after big changes*):
```sh
./start.sh -cleanInstall or -c
./start.sh -c -i
```
* Start the demo using an alternative npm registry
```sh
./start.sh -registry 'http://npm.local.me:8080/'
```
* Start the demo and update the dependencies:
@@ -34,6 +40,12 @@ feel for what's available.
./start.sh -update or -u
```
* Start the demo in development mode building the relative folder ng2-components with all the components and pointing to this component instead to the node_modules one
```sh
./start.sh -develop -d
```
* If you want to build all your local component:
```sh
@@ -46,6 +58,12 @@ feel for what's available.
./npm-buid-alll.sh -t or -test
```
* If you want clean the ng2-components folder node_modules before to build
```sh
./npm-buid-alll.sh -c
```
* If you want clean all your local component and the demo shell:
```sh

View File

@@ -2,6 +2,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval RUN_TEST=false
eval EXEC_CLEAN=false
eval projects=( "ng2-alfresco-core"
"ng2-alfresco-datatable"
@@ -20,11 +21,11 @@ eval projects=( "ng2-alfresco-core"
"ng2-alfresco-viewer"
"ng2-alfresco-webscript"
"ng2-alfresco-userinfo" )
show_help() {
echo "Usage: npm-build-all.sh"
echo ""
echo "-t or -test build all your local component and run also the test on them"
echo "-c or -clean the ndode_moduels folder before to start the build"
}
enable_test(){
@@ -33,30 +34,45 @@ enable_test(){
test_project() {
echo "====== test project: $1 ====="
npm run test || exit 1
npm run test -- --component $1 || exit 1
}
clean() {
EXEC_CLEAN=true
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--test) enable_test; shift;;
-c|--clean) clean; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
cd "$DIR/../ng2-components/"
npm install package-json-merge -g
npm install rimraf -g
if $EXEC_CLEAN == true; then
echo "====== Clean ng2-components ====="
npm install rimraf
npm run clean
fi
echo "====== Regenerate global ng2-components package.json ====="
npm install package-json-merge
npm run pkg-build
npm install && npm run build || exit 1
echo "====== Install ng2-components dependencies ====="
npm install
echo "====== Build ng2-components ====="
npm run build || exit 1
for PACKAGE in ${projects[@]}
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
DESTDIR="$DIR/../ng2-components/"
cd $DESTDIR
if $RUN_TEST == true; then
test_project $PACKAGE
fi
done

View File

@@ -20,7 +20,7 @@ eval projects=( "ng2-activiti-diagrams"
"ng2-alfresco-webscript"
"ng2-alfresco-userinfo" )
npm install rimraf -g
npm install rimraf
for PACKAGE in ${projects[@]}
do

View File

@@ -2,24 +2,57 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
"$DIR/npm-clean.sh"
eval FORCE_PUBLISH=false
eval NPM_REGISTRY=""
eval OPTIONS=""
cd "$DIR/../demo-shell-ng2"
show_help() {
echo "Usage: npm-publish.sh"
echo ""
echo "-f or -force publish the package with force"
echo "-r or -registry to publish in an alternative npm registry -registry 'http://npm.local.me:8080/' "
echo "-t or -tag to add a tag when publish a package"
}
enable_force(){
FORCE_PUBLISH=true
OPTIONS="$OPTIONS -force"
}
add_tag(){
eval TAG=$1
if [[ "${TAG}" == "" ]]
then
echo "tag missing -t | -tag"
exit 0
fi
echo "====== TAG WILL BE ADDED DURING THE PUBLISH: ${TAG} ====="
OPTIONS="$OPTIONS -tag $1"
}
change_registry(){
NPM_REGISTRY=$1
if [[ "${NPM_REGISTRY}" == "" ]]
then
echo "NPM registry required WITH OPTION -r | -registry"
exit 0
fi
echo "====== CHANGE REGISTRY: ${NPM_REGISTRY} ====="
npm config set registry ${NPM_REGISTRY}
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-t|--tag) add_tag $2; shift 2;;
-f|--force) enable_force; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
-r|--registry) change_registry $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac
done
@@ -42,15 +75,10 @@ for PACKAGE in \
ng2-alfresco-userinfo
do
DESTDIR="$DIR/../ng2-components/${PACKAGE}"
echo "====== PUBLISHING: ${DESTDIR} ====="
echo "====== PUBLISHING: ${DESTDIR} ===== npm publish ${OPTIONS}"
cd ${DESTDIR}
npm run clean
npm install
if FORCE_PUBLISH == false; then
npm run publish:prod
fi
if FORCE_PUBLISH == true; then
npm run test && npm run publish --force || exit 1
fi
npm publish ${OPTIONS}
cd ${DIR}
done

View File

@@ -2,28 +2,49 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/../demo-shell-ng2"
eval EXEC_INSTALL=false
eval EXEC_UPDATE=false
eval EXEC_CLEAN=false
eval EXEC_DEVELOP=false
show_help() {
echo "Usage: start.sh"
echo ""
echo "-d or -develop start the demo shell using the relative ng2-components folder to link the components"
echo "-i or -install start the demo shell and install the dependencies"
echo "-u or -update start the demo shell and update the dependencies"
echo "-c or -cleanInstall clean the demo shell install the dependencies and start the the demo shell"
echo "-c or -clean clean the demo shell and reinstall the dependencies"
echo "-r or -registry to download the packages from an alternative npm registry example -registry 'http://npm.local.me:8080/' "
}
install() {
npm install
EXEC_INSTALL=true
}
update() {
echo "update"
npm run update
EXEC_UPDATE=true
}
cleanInstall() {
npm run clean
npm install
develop() {
EXEC_DEVELOP=true
}
change_registry(){
NPM_REGISTRY=$1
if [[ "${NPM_REGISTRY}" == "" ]]
then
echo "NPM registry required WITH OPTION -r | -registry"
exit 0
fi
echo "====== CHANGE REGISTRY: ${NPM_REGISTRY} ====="
npm config set registry ${NPM_REGISTRY}
}
clean() {
EXEC_CLEAN=true
EXEC_INSTALL=true
}
while [[ $1 == -* ]]; do
@@ -31,9 +52,47 @@ while [[ $1 == -* ]]; do
-h|--help|-\?) show_help; exit 0;;
-i|--install) install; shift;;
-u|--update) update; shift;;
-c|--cleanInstall) cleanInstall; shift;;
-c|--clean) clean; shift;;
-d|--develop) develop; shift;;
-r|--registry) change_registry $2; shift 2;;
-*) shift;;
esac
done
npm run start
if $EXEC_CLEAN == true; then
echo "====== Clean Demo shell ====="
cd "$DIR/../demo-shell-ng2"
npm install rimraf
npm run clean
fi
if $EXEC_DEVELOP == true; then
echo "====== Build ng2-components folder====="
cd "$DIR/../scripts"
sh npm-build-all.sh
fi
if $EXEC_INSTALL == true; then
echo "====== Install Demo shell ====="
cd "$DIR/../demo-shell-ng2"
npm install
fi
if $EXEC_UPDATE == true; then
echo "====== Update Demo shell ====="
cd "$DIR/../demo-shell-ng2"
npm update
fi
if $EXEC_DEVELOP == true; then
echo "====== Start Demo shell development mode====="
cd "$DIR/../demo-shell-ng2"
npm run start:dev
fi
if $EXEC_DEVELOP == false; then
echo "====== Start Demo shell ====="
cd "$DIR/../demo-shell-ng2"
npm run start
fi