diff --git a/ng2-components/ng2-activiti-processlist/package.json b/ng2-components/ng2-activiti-processlist/package.json index 56d9f49c9f..57ae7e3288 100644 --- a/ng2-components/ng2-activiti-processlist/package.json +++ b/ng2-components/ng2-activiti-processlist/package.json @@ -11,11 +11,12 @@ "version": "0.2.0", "author": "Alfresco Software, Ltd.", "scripts": { + "postinstall": "typings install", "clean": "rimraf dist node_modules typings", "typings": "typings install", "server": "http-server -c-1 -o -p 8875 .", - "build": "npm run tslint && typings install && rimraf dist && tsc && npm run copytemplates && license-check", - "build:w": "npm run tslint && typings install && rimraf dist && npm run watch-task", + "build": "npm run tslint && rimraf dist && tsc && npm run copytemplates && license-check", + "build:w": "npm run tslint && rimraf dist && npm run watch-task", "watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"", "tslint": "npm run tslint-src && npm run tslint-root", "tslint-src": "tslint -c tslint.json src/{,**/}**.ts", diff --git a/ng2-components/ng2-activiti-tasklist/package.json b/ng2-components/ng2-activiti-tasklist/package.json index dda05ee92a..554cb86957 100644 --- a/ng2-components/ng2-activiti-tasklist/package.json +++ b/ng2-components/ng2-activiti-tasklist/package.json @@ -4,10 +4,11 @@ "version": "0.2.0", "author": "Alfresco Software, Ltd.", "scripts": { + "postinstall": "typings install", "clean": "rimraf dist node_modules typings", "typings": "typings install", - "build": "npm run tslint && typings install && rimraf dist && tsc && npm run copytemplates && license-check", - "build:w": "npm run tslint && typings install && rimraf dist && npm run watch-task", + "build": "npm run tslint && rimraf dist && tsc && npm run copytemplates && license-check", + "build:w": "npm run tslint && rimraf dist && npm run watch-task", "watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"", "tslint": "npm run tslint-src && npm run tslint-root", "tslint-src": "tslint -c tslint.json src/{,**/}**.ts", diff --git a/scripts/README.md b/scripts/README.md index a3a4f48b7b..f9381dc58b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -3,42 +3,64 @@ The Alfresco application development framework comes with a demo project that you can run to get a feel for what's available. -* Start by navigating into the app development framework source folder, and then the script folder: +Start by navigating into the app development framework source folder, and then the script folder: ```ssh cd alfresco-ng2-components cd scripts ``` -* Start the demo and Install all the dependencies (*Note. do it this way only the first time, and be aware, it will take some time*) +Start using published components +--- + +This is recommended if you are running from the `master` branch. + +Start the demo-shell app after installing all the dependencies from npm (*Note. do it this way only the first time, and be aware, it will take some time*) ```sh ./start.sh -install ``` -* Start the demo (*the standard way of starting the demo after first initialization*): - -```sh -./start.sh -``` - -* 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 -``` - -* Start the demo and update the dependencies: +Or, if you have previously run `-install` but want to update the dependencies, use `-update` ```sh ./start.sh -update ``` -* If you want to use your local components use the following script with any of the previous option. It will npm link all the components -in the demo shell: +If there are no big changes in the demo-shell since you last started then you can start without `-install` and `-update` to skip fetching packages, which should be much quicker + +```sh +./start.sh +``` + +If you get errors when starting which do not go away with `-update` or `-install,` or if you want to test starting the demo shell from a clean environment, then use the `-cleanInstall` option + +This will remove previous versions of all packages, before running `npm install` again + +```sh +./start.sh -cleanInstall +``` + +Start using linked components +--- + +This is recommended if you are using the `development` branch or a feature branch off `development` + +If you want to use your local components use the following script with any of the previous options. It will npm link all the components +in the demo shell before starting up the demo-shell. + +For a new environment, use `-install` + +```sh +./start-linked.sh -install +``` + +When you are restarting, you can skip `-install` ```sh ./start-linked.sh ``` -For development environment configuration please refer to [project docs](demo-shell-ng2/README.md). \ No newline at end of file +The parameters `-update` and `-cleanInstall` work as described above for `start.sh` + +For development environment configuration please refer to [project docs](demo-shell-ng2/README.md). diff --git a/scripts/npm-build-all.sh b/scripts/npm-build-all.sh new file mode 100755 index 0000000000..a7ea0c224d --- /dev/null +++ b/scripts/npm-build-all.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +components_dir="$DIR/../ng2-components" + +for comp_dir in $( ls "$components_dir" ); do + echo $comp_dir + test -f "$components_dir/$comp_dir/package.json" && \ + cd "$components_dir/$comp_dir" && \ + npm run build +done + +cd ${DIR} diff --git a/scripts/npm-clean.sh b/scripts/npm-clean.sh index c1d492be4c..ccb842e61b 100755 --- a/scripts/npm-clean.sh +++ b/scripts/npm-clean.sh @@ -1,23 +1,13 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +components_dir="$DIR/../ng2-components" -for PACKAGE in \ - ng2-activiti-form \ - ng2-activiti-processlist \ - ng2-activiti-tasklist \ - ng2-alfresco-core \ - ng2-alfresco-datatable \ - ng2-alfresco-documentlist \ - ng2-alfresco-login \ - ng2-alfresco-search \ - ng2-alfresco-upload \ - ng2-alfresco-viewer \ - ng2-alfresco-webscript -do - echo "====== clean component: ${PACKAGE} =====" - cd "$DIR/../ng2-components/${PACKAGE}" - npm run clean +for comp_dir in $( ls "$components_dir" ); do + test -f "$components_dir/$comp_dir/package.json" && \ + cd "$components_dir/$comp_dir" && \ + echo "====== clean component: ${$comp_dir} =====" && \ + npm run clean done cd "$DIR/../demo-shell-ng2" diff --git a/scripts/npm-link-demo-shell.sh b/scripts/npm-link-demo-shell.sh index a0ba56f46b..1d4eb5845c 100755 --- a/scripts/npm-link-demo-shell.sh +++ b/scripts/npm-link-demo-shell.sh @@ -1,103 +1,37 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +components_dir="$DIR/../ng2-components" -npm install -g typings +npm_opts="--loglevel=silent" -#LINK CORE -echo "====== linking component: ng2-alfresco-core =====" -cd "$DIR/../ng2-components/ng2-alfresco-core" -npm link -npm run typings -npm run build +function link_alfresco_ng2_deps() { + cd $1 + for dep in $( list-dependencies '^ng2-(alfresco|activiti)-' ); do + npm link --ignore-scripts $npm_opts "$dep" + done +} -#LINK FORM -echo "====== linking component: ng2-activiti-form =====" -cd "$DIR/../ng2-components/ng2-activiti-form" -npm link ng2-alfresco-core -npm link -npm run typings -npm run build +npm install $npm_opts -g typings +npm install $npm_opts -g @wabson/list-dependencies -#LINK DATATABLE -echo "====== linking component: ng2-alfresco-datatable =====" -cd "$DIR/../ng2-components/ng2-alfresco-datatable" -npm link ng2-alfresco-core -npm link -npm run typings -npm run build - -#LINK DOCUMENTLIST -echo "====== linking component: ng2-alfresco-documentlist =====" -cd "$DIR/../ng2-components/ng2-alfresco-documentlist" -npm link ng2-alfresco-core -npm link ng2-alfresco-datatable -npm link -npm run typings -npm run build - -#LINK WEBSCRIPT -echo "====== linking component: ng2-alfresco-webscript =====" -cd "$DIR/../ng2-components/ng2-alfresco-webscript" -npm link ng2-alfresco-core -npm link ng2-alfresco-datatable -npm link -npm run typings -npm run build - -#LINK TASKLIST -echo "====== linking component: ng2-activiti-tasklist =====" -cd "$DIR/../ng2-components/ng2-activiti-tasklist" -npm link ng2-alfresco-core -npm link ng2-alfresco-datatable -npm link ng2-activiti-form -npm link -npm run typings -npm run build - -#LINK PROCESSLIST -echo "====== linking component: ng2-activiti-processlist =====" -cd "$DIR/../ng2-components/ng2-activiti-processlist" -npm link ng2-alfresco-core -npm link ng2-alfresco-datatable -npm link -npm run typings -npm run build - -#LINK ALL THE OTHERS COMPONENTS -for PACKAGE in \ - ng2-alfresco-login \ - ng2-alfresco-search \ - ng2-alfresco-upload \ - ng2-alfresco-viewer \ - ng2-alfresco-webscript -do - DESTDIR="$DIR/../ng2-components/${PACKAGE}" - echo "====== linking component: ${PACKAGE} =====" - cd "$DESTDIR" - npm link ng2-alfresco-core - npm link - npm run typings - npm run build +# First link each component into /usr/local/lib/node_modules +for comp_dir in $( ls "$components_dir" ); do + echo "Link $components_dir/$comp_dir" + test -f "$components_dir/$comp_dir/package.json" && cd "$components_dir/$comp_dir" && npm link --ignore-scripts done +# Now link inter-dependencies between components +for comp_dir in $( ls "$components_dir" ); do + echo "Link dependencies of $components_dir/$comp_dir" + test -f "$components_dir/$comp_dir/package.json" && link_alfresco_ng2_deps "$components_dir/$comp_dir" +done -#LINK ALL THE COMPONENTS INSIDE THE DEMOSHELL -cd "$DIR/../demo-shell-ng2" -for PACKAGE in \ - ng2-activiti-form \ - ng2-activiti-processlist \ - ng2-activiti-tasklist \ - ng2-alfresco-core \ - ng2-alfresco-datatable \ - ng2-alfresco-documentlist \ - ng2-alfresco-login \ - ng2-alfresco-search \ - ng2-alfresco-upload \ - ng2-alfresco-viewer \ - ng2-alfresco-webscript -do - DESTDIR="$DIR/../ng2-components/${PACKAGE}" - echo "====== demo shell linking: ${PACKAGE} =====" - npm link ${PACKAGE} -done \ No newline at end of file +# Now run postinstall scripts +for comp_dir in $( ls "$components_dir" ); do + echo "Postinstall $components_dir/$comp_dir" + test -f "$components_dir/$comp_dir/package.json" && cd "$components_dir/$comp_dir" && npm run postinstall +done + +# LINK ALL THE COMPONENTS INSIDE THE DEMOSHELL +link_alfresco_ng2_deps "$DIR/../demo-shell-ng2" diff --git a/scripts/npm-publish.sh b/scripts/npm-publish.sh index 98f4954326..17d1b7e80b 100755 --- a/scripts/npm-publish.sh +++ b/scripts/npm-publish.sh @@ -1,26 +1,14 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +components_dir="$DIR/../ng2-components" "$DIR/npm-clean.sh" -for PACKAGE in \ - ng2-activiti-form \ - ng2-activiti-processlist \ - ng2-activiti-tasklist \ - ng2-alfresco-core \ - ng2-alfresco-datatable \ - ng2-alfresco-documentlist \ - ng2-alfresco-login \ - ng2-alfresco-search \ - ng2-alfresco-upload \ - ng2-alfresco-viewer \ - ng2-alfresco-webscript -do - DESTDIR="$DIR/../ng2-components/${PACKAGE}" - echo "====== PUBLISHING: ${DESTDIR} =====" - cd ${DESTDIR} - npm install - npm publish - cd ${DIR} +for comp_dir in $( ls "$components_dir" ); do + test -f "$components_dir/$comp_dir/package.json" && \ + cd "$components_dir/$comp_dir" && \ + echo "====== PUBLISHING: ${$comp_dir} =====" && \ + npm install && \ + npm publish done diff --git a/scripts/start-linked.sh b/scripts/start-linked.sh index 1c0529c063..24fe13d5f1 100755 --- a/scripts/start-linked.sh +++ b/scripts/start-linked.sh @@ -3,19 +3,5 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" "$DIR/npm-link-demo-shell.sh" - -cd "$DIR/../demo-shell-ng2" - -if [[ $1 = "-install" ]]; then - npm install - npm run start -elif [[ $1 = "-update " ]]; then - npm run update - npm run start -elif [[ $1 = "-cleanInstall" ]]; then - npm run clean - npm install - npm run start -else - npm run start -fi +"$DIR/npm-build-all.sh" +"$DIR/start.sh" $@