Merge pull request #490 from Alfresco/dev-wabson-480

Improve scripts and script docs (reverted from commit 0bd5603418)
This commit is contained in:
Mario Romano
2016-08-02 12:49:21 +01:00
parent 0bd5603418
commit d9ad2f1bad
8 changed files with 157 additions and 92 deletions

View File

@@ -11,12 +11,11 @@
"version": "0.2.0", "version": "0.2.0",
"author": "Alfresco Software, Ltd.", "author": "Alfresco Software, Ltd.",
"scripts": { "scripts": {
"postinstall": "typings install",
"clean": "rimraf dist node_modules typings", "clean": "rimraf dist node_modules typings",
"typings": "typings install", "typings": "typings install",
"server": "http-server -c-1 -o -p 8875 .", "server": "http-server -c-1 -o -p 8875 .",
"build": "npm run tslint && rimraf dist && tsc && npm run copytemplates && license-check", "build": "npm run tslint && typings install && rimraf dist && tsc && npm run copytemplates && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task", "build:w": "npm run tslint && typings install && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"", "watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"",
"tslint": "npm run tslint-src && npm run tslint-root", "tslint": "npm run tslint-src && npm run tslint-root",
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts", "tslint-src": "tslint -c tslint.json src/{,**/}**.ts",

View File

@@ -4,11 +4,10 @@
"version": "0.2.0", "version": "0.2.0",
"author": "Alfresco Software, Ltd.", "author": "Alfresco Software, Ltd.",
"scripts": { "scripts": {
"postinstall": "typings install",
"clean": "rimraf dist node_modules typings", "clean": "rimraf dist node_modules typings",
"typings": "typings install", "typings": "typings install",
"build": "npm run tslint && rimraf dist && tsc && npm run copytemplates && license-check", "build": "npm run tslint && typings install && rimraf dist && tsc && npm run copytemplates && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task", "build:w": "npm run tslint && typings install && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"", "watch-task": "concurrently \"npm run tsc:w\" \"npm run copytemplates:w\" \"license-check\"",
"tslint": "npm run tslint-src && npm run tslint-root", "tslint": "npm run tslint-src && npm run tslint-root",
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts", "tslint-src": "tslint -c tslint.json src/{,**/}**.ts",

View File

@@ -3,64 +3,42 @@
The Alfresco application development framework comes with a demo project that you can run to get a The Alfresco application development framework comes with a demo project that you can run to get a
feel for what's available. 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 ```ssh
cd alfresco-ng2-components cd alfresco-ng2-components
cd scripts cd scripts
``` ```
Start using published components * 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*)
---
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 ```sh
./start.sh -install ./start.sh -install
``` ```
Or, if you have previously run `-install` but want to update the dependencies, use `-update` * Start the demo (*the standard way of starting the demo after first initialization*):
```sh
./start.sh -update
```
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 ```sh
./start.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 * Start the demo, install all the dependencies, and remove the previous version of the npm packages (*Note. do this only after big changes*):
This will remove previous versions of all packages, before running `npm install` again
```sh ```sh
./start.sh -cleanInstall ./start.sh -cleanInstall
``` ```
Start using linked components * Start the demo and update the dependencies:
---
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 ```sh
./start-linked.sh -install ./start.sh -update
``` ```
When you are restarting, you can skip `-install` * 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:
```sh ```sh
./start-linked.sh ./start-linked.sh
``` ```
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). For development environment configuration please refer to [project docs](demo-shell-ng2/README.md).

View File

@@ -1,13 +0,0 @@
#!/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}

View File

@@ -1,13 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
components_dir="$DIR/../ng2-components"
for comp_dir in $( ls "$components_dir" ); do for PACKAGE in \
test -f "$components_dir/$comp_dir/package.json" && \ ng2-activiti-form \
cd "$components_dir/$comp_dir" && \ ng2-activiti-processlist \
echo "====== clean component: ${$comp_dir} =====" && \ ng2-activiti-tasklist \
npm run clean 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
done done
cd "$DIR/../demo-shell-ng2" cd "$DIR/../demo-shell-ng2"

View File

@@ -1,37 +1,103 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
components_dir="$DIR/../ng2-components"
npm_opts="--loglevel=silent" npm install -g typings
function link_alfresco_ng2_deps() { #LINK CORE
cd $1 echo "====== linking component: ng2-alfresco-core ====="
for dep in $( list-dependencies '^ng2-(alfresco|activiti)-' ); do cd "$DIR/../ng2-components/ng2-alfresco-core"
npm link --ignore-scripts $npm_opts "$dep" npm link
done npm run typings
} npm run build
npm install $npm_opts -g typings #LINK FORM
npm install $npm_opts -g @wabson/list-dependencies 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
# First link each component into /usr/local/lib/node_modules #LINK DATATABLE
for comp_dir in $( ls "$components_dir" ); do echo "====== linking component: ng2-alfresco-datatable ====="
echo "Link $components_dir/$comp_dir" cd "$DIR/../ng2-components/ng2-alfresco-datatable"
test -f "$components_dir/$comp_dir/package.json" && cd "$components_dir/$comp_dir" && npm link --ignore-scripts 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
done 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
# Now run postinstall scripts #LINK ALL THE COMPONENTS INSIDE THE DEMOSHELL
for comp_dir in $( ls "$components_dir" ); do cd "$DIR/../demo-shell-ng2"
echo "Postinstall $components_dir/$comp_dir" for PACKAGE in \
test -f "$components_dir/$comp_dir/package.json" && cd "$components_dir/$comp_dir" && npm run postinstall 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 done
# LINK ALL THE COMPONENTS INSIDE THE DEMOSHELL
link_alfresco_ng2_deps "$DIR/../demo-shell-ng2"

View File

@@ -1,14 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
components_dir="$DIR/../ng2-components"
"$DIR/npm-clean.sh" "$DIR/npm-clean.sh"
for comp_dir in $( ls "$components_dir" ); do for PACKAGE in \
test -f "$components_dir/$comp_dir/package.json" && \ ng2-activiti-form \
cd "$components_dir/$comp_dir" && \ ng2-activiti-processlist \
echo "====== PUBLISHING: ${$comp_dir} =====" && \ ng2-activiti-tasklist \
npm install && \ ng2-alfresco-core \
npm publish 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}
done done

View File

@@ -3,5 +3,19 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
"$DIR/npm-link-demo-shell.sh" "$DIR/npm-link-demo-shell.sh"
"$DIR/npm-build-all.sh"
"$DIR/start.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