From ce60915fd9c8a55ff75bace2eb8f850594a6aa12 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Thu, 30 May 2019 17:59:22 +0100 Subject: [PATCH] Reorg script moving in folders (#4791) * organize script in folder part 1 * improve test e2e * fix smart build script * fix relative path --- package.json | 2 +- scripts/README.md | 18 ------------- .../{ng-packagr.sh => build/build-all-lib.sh} | 4 +-- scripts/{ => build}/build-content-services.sh | 2 +- scripts/{ => build}/build-core.sh | 2 +- scripts/{ => build}/build-extensions.sh | 2 +- scripts/{ => build}/build-insights.sh | 2 +- .../build-process-services-cloud.sh | 2 +- scripts/{ => build}/build-process-services.sh | 2 +- scripts/{ => build}/build-testing.sh | 2 +- .../{ => misc}/config/config-verdaccio.yaml | 0 scripts/{ => misc}/simulate-publish.sh | 0 scripts/npm-clean.sh | 25 ------------------- scripts/npm-move-tag.sh | 2 +- scripts/pr-undeploy.sh | 0 scripts/smart-build.sh | 14 +++++------ scripts/test-e2e-lib.sh | 6 ++--- scripts/travis/deploy/deploy.sh | 4 +-- .../{ => travis/deploy}/move-dist-folder.js | 0 scripts/{ => travis/deploy}/pr-deploy.js | 0 scripts/{ => travis/deploy}/pr-publish.sh | 0 21 files changed, 22 insertions(+), 67 deletions(-) rename scripts/{ng-packagr.sh => build/build-all-lib.sh} (85%) rename scripts/{ => build}/build-content-services.sh (98%) rename scripts/{ => build}/build-core.sh (98%) rename scripts/{ => build}/build-extensions.sh (96%) rename scripts/{ => build}/build-insights.sh (97%) rename scripts/{ => build}/build-process-services-cloud.sh (98%) rename scripts/{ => build}/build-process-services.sh (98%) rename scripts/{ => build}/build-testing.sh (96%) rename scripts/{ => misc}/config/config-verdaccio.yaml (100%) rename scripts/{ => misc}/simulate-publish.sh (100%) delete mode 100755 scripts/npm-clean.sh delete mode 100644 scripts/pr-undeploy.sh rename scripts/{ => travis/deploy}/move-dist-folder.js (100%) rename scripts/{ => travis/deploy}/pr-deploy.js (100%) rename scripts/{ => travis/deploy}/pr-publish.sh (100%) diff --git a/package.json b/package.json index b920777509..7bc3e7b933 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "01s": "", "unit-test": "concurrently \"ng test content-services --watch=false\" \"ng test process-services --watch=false\" \"ng test core --watch=false\" \"ng test extensions --watch=false\" \"ng test insights --watch=false\" \"ng test process-services-cloud --watch=false\" ", "prepublishOnly": "npm run build-lib", - "build-lib": "./scripts/ng-packagr.sh", + "build-lib": "./scripts/build/build-all-lib.sh", "bundlesize-check": "bundlesize", "affected:libs": "./node_modules/.bin/nx affected:libs", "webpack-bundle-analyzer": "webpack-bundle-analyzer demo-shell/dist/stats.json", diff --git a/scripts/README.md b/scripts/README.md index fd86e50c49..0d982331ee 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,7 +4,6 @@ - [Quick examples](#quick-examples) - [start.sh Demo shell script](#start.sh) - [Ng2 components framework alfresco build](#npm-build-all.sh) -- [Clean components and Demo](#npm-clean.sh) The Alfresco application development framework comes with a demo project that you can run to get a feel of what's available. @@ -205,26 +204,9 @@ The default behaviour of the ***npm-build-all.sh*** install node_modules and bui ./npm-build-all.sh -si ``` -* Clean all your local components and the demo shell: - -```sh -./npm-clean.sh -``` For development environment configuration please refer to [project docs](../demo-shell/README.md). -# npm-clean.sh - -***npm-clean.sh*** clean all the projects folders : lib and demo-shell. - -## Options - -| Option | Description | -| --- | --- | -| -h or --help | show the help | - -# npm-check-bundles.sh - ***npm-check-bundles.sh*** check the bundles in the package npm are present ## Options diff --git a/scripts/ng-packagr.sh b/scripts/build/build-all-lib.sh similarity index 85% rename from scripts/ng-packagr.sh rename to scripts/build/build-all-lib.sh index 000b9051ef..b1665b4f06 100755 --- a/scripts/ng-packagr.sh +++ b/scripts/build/build-all-lib.sh @@ -25,10 +25,10 @@ echo "====== Run process-services-cloud =====" ./build-process-services-cloud.sh echo "====== Run testing =====" -./build-testing.sh +./build-testing.sh echo "====== Copy schema =====" -cp ../lib/core/app-config/schema.json ../lib/dist/core/app.config.schema.json +cp ../../lib/core/app-config/schema.json ../../lib/dist/core/app.config.schema.json npm run bundlesize-check diff --git a/scripts/build-content-services.sh b/scripts/build/build-content-services.sh similarity index 98% rename from scripts/build-content-services.sh rename to scripts/build/build-content-services.sh index b6076f471e..7f3047ce5d 100755 --- a/scripts/build-content-services.sh +++ b/scripts/build/build-content-services.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Content Services ======" echo "====== Build ======" diff --git a/scripts/build-core.sh b/scripts/build/build-core.sh similarity index 98% rename from scripts/build-core.sh rename to scripts/build/build-core.sh index 30c55370e2..0ddbf2330d 100755 --- a/scripts/build-core.sh +++ b/scripts/build/build-core.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Core ======" echo "====== Build ======" diff --git a/scripts/build-extensions.sh b/scripts/build/build-extensions.sh similarity index 96% rename from scripts/build-extensions.sh rename to scripts/build/build-extensions.sh index 827d6fd34f..bd28ee2ba9 100755 --- a/scripts/build-extensions.sh +++ b/scripts/build/build-extensions.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Extensions ======" echo "====== Build ======" diff --git a/scripts/build-insights.sh b/scripts/build/build-insights.sh similarity index 97% rename from scripts/build-insights.sh rename to scripts/build/build-insights.sh index 4ac37b8505..5e7c74053b 100755 --- a/scripts/build-insights.sh +++ b/scripts/build/build-insights.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Insights ======" echo "====== Build ======" diff --git a/scripts/build-process-services-cloud.sh b/scripts/build/build-process-services-cloud.sh similarity index 98% rename from scripts/build-process-services-cloud.sh rename to scripts/build/build-process-services-cloud.sh index 67ccd05a29..5cf7725ef2 100755 --- a/scripts/build-process-services-cloud.sh +++ b/scripts/build/build-process-services-cloud.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Process Services Cloud ======" echo "====== Build ======" diff --git a/scripts/build-process-services.sh b/scripts/build/build-process-services.sh similarity index 98% rename from scripts/build-process-services.sh rename to scripts/build/build-process-services.sh index 6c982cfe6d..fc82f2b9b7 100755 --- a/scripts/build-process-services.sh +++ b/scripts/build/build-process-services.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Process Services ======" echo "====== Build ======" diff --git a/scripts/build-testing.sh b/scripts/build/build-testing.sh similarity index 96% rename from scripts/build-testing.sh rename to scripts/build/build-testing.sh index 3afa9b3fe6..f93c44982a 100755 --- a/scripts/build-testing.sh +++ b/scripts/build/build-testing.sh @@ -2,7 +2,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. +cd $DIR/../.. echo "====== Testing ======" echo "====== Build ======" diff --git a/scripts/config/config-verdaccio.yaml b/scripts/misc/config/config-verdaccio.yaml similarity index 100% rename from scripts/config/config-verdaccio.yaml rename to scripts/misc/config/config-verdaccio.yaml diff --git a/scripts/simulate-publish.sh b/scripts/misc/simulate-publish.sh similarity index 100% rename from scripts/simulate-publish.sh rename to scripts/misc/simulate-publish.sh diff --git a/scripts/npm-clean.sh b/scripts/npm-clean.sh deleted file mode 100755 index 6f8bad8267..0000000000 --- a/scripts/npm-clean.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -eval EXEC_CLEAN_DEMO=true - -show_help() { - echo "Usage: npm-clean.sh" - echo "" -} - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; - esac -done - -npm install rimraf - -cd "$DIR/../" -npm run clean-lock -npm run clean - -cd ${DIR} diff --git a/scripts/npm-move-tag.sh b/scripts/npm-move-tag.sh index 4b9f877a1a..d9871f6ddf 100644 --- a/scripts/npm-move-tag.sh +++ b/scripts/npm-move-tag.sh @@ -11,7 +11,7 @@ eval projects=( "@alfresco/adf-core" "@alfresco/adf-extensions" ) show_help() { - echo "Usage: npm-clean.sh" + echo "Usage: npm-move-tag.sh" echo "" echo "-v version package to apply new tag" echo "-t new tag name to add" diff --git a/scripts/pr-undeploy.sh b/scripts/pr-undeploy.sh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/scripts/smart-build.sh b/scripts/smart-build.sh index 4406b2bbb6..9abacdc11e 100755 --- a/scripts/smart-build.sh +++ b/scripts/smart-build.sh @@ -48,7 +48,7 @@ libs=(`echo $affected | sed 's/^$/\n/g'`) for i in "${libs[@]}" do if [ "$i" == "extensions$" ] ; then - ./scripts/build-extensions.sh || exit 1; + ./scripts/build/build-extensions.sh || exit 1; fi done @@ -56,7 +56,7 @@ done for i in "${libs[@]}" do if [ "$i" == "core$" ] ; then - ./scripts/build-core.sh || exit 1; + ./scripts/build/build-core.sh || exit 1; fi done @@ -64,7 +64,7 @@ done for i in "${libs[@]}" do if [ "$i" == "content-services$" ] ; then - ./scripts/build-content-services.sh || exit 1; + ./scripts/build/build-content-services.sh || exit 1; fi done @@ -72,7 +72,7 @@ done for i in "${libs[@]}" do if [ "$i" == "process-services$" ] ; then - ./scripts/build-process-services.sh || exit 1; + ./scripts/build/build-process-services.sh || exit 1; fi done @@ -80,7 +80,7 @@ done for i in "${libs[@]}" do if [ "$i" == "process-services-cloud$" ] ; then - ./scripts/build-process-services-cloud.sh || exit 1; + ./scripts/build/build-process-services-cloud.sh || exit 1; fi done @@ -88,7 +88,7 @@ done for i in "${libs[@]}" do if [ "$i" == "insights$" ] ; then - ./scripts/build-insights.sh || exit 1; + ./scripts/build/build-insights.sh || exit 1; fi done @@ -96,6 +96,6 @@ done for i in "${libs[@]}" do if [ "$i" == "testing$" ] ; then - ./scripts/build-testing.sh || exit 1; + ./scripts/build/build-testing.sh || exit 1; fi done diff --git a/scripts/test-e2e-lib.sh b/scripts/test-e2e-lib.sh index 65107b5d5b..12287c4183 100755 --- a/scripts/test-e2e-lib.sh +++ b/scripts/test-e2e-lib.sh @@ -91,7 +91,7 @@ set_timeout(){ } set_save_screenshot(){ - SAVE_SCREENSHOT=true + export SAVE_SCREENSHOT=true } set_development(){ @@ -124,7 +124,7 @@ lite_server(){ } max_instances(){ - MAXINSTANCES=$1 + export MAXINSTANCES=$1 } disable_control_flow(){ @@ -176,12 +176,10 @@ done rm -rf ./e2e/downloads/ rm -rf ./e2e-output/screenshots/ -export SAVE_SCREENSHOT=$SAVE_SCREENSHOT export TIMEOUT=$TIMEOUT export SELENIUM_SERVER=$SELENIUM_SERVER -export MAXINSTANCES=$MAXINSTANCES export SELENIUM_PROMISE_MANAGER=$SELENIUM_PROMISE_MANAGER if $EXEC_VERSION_JSAPI == true; then diff --git a/scripts/travis/deploy/deploy.sh b/scripts/travis/deploy/deploy.sh index d2d5ff666d..7dbea6186f 100755 --- a/scripts/travis/deploy/deploy.sh +++ b/scripts/travis/deploy/deploy.sh @@ -6,10 +6,10 @@ cd $DIR/../../../ #if [ "$TRAVIS_PULL_REQUEST" != "false" ]; #then - node ./scripts/move-dist-folder.js --base-href $TRAVIS_BUILD_NUMBER && (./scripts/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1); + node ./scripts/travis/deploy/move-dist-folder.js --base-href $TRAVIS_BUILD_NUMBER && (./scripts/travis/deploy/pr-publish.sh -n $TRAVIS_BUILD_NUMBER -r $REPO_DOCKER -u $USERNAME_DOCKER -p $PASSWORD_DOCKER || exit 1); #fi; #if [ "$TRAVIS_PULL_REQUEST" != "false" ]; #then - (node --no-deprecation ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1); + (node --no-deprecation ./scripts/travis/deploy/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1); #fi; diff --git a/scripts/move-dist-folder.js b/scripts/travis/deploy/move-dist-folder.js similarity index 100% rename from scripts/move-dist-folder.js rename to scripts/travis/deploy/move-dist-folder.js diff --git a/scripts/pr-deploy.js b/scripts/travis/deploy/pr-deploy.js similarity index 100% rename from scripts/pr-deploy.js rename to scripts/travis/deploy/pr-deploy.js diff --git a/scripts/pr-publish.sh b/scripts/travis/deploy/pr-publish.sh similarity index 100% rename from scripts/pr-publish.sh rename to scripts/travis/deploy/pr-publish.sh