diff --git a/README.md b/README.md index 006a35719b..7ebe70ac0a 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,84 @@ ### Running demo project +**Note**: *Steps below show the quickest way to get demo shell up and running. +For development configuration please refer to* **Configuring development environment** +*section further in this document.* + +##### Using setup script (recommended) + ```sh git clone https://github.com/Alfresco/dev-platform-webcomponents.git -cd dev-platform-webcomponents/demo-shell-ng2/ +./start.sh +``` + +##### Manual setup + +```sh +git clone https://github.com/Alfresco/dev-platform-webcomponents.git +cd dev-platform-webcomponents/demo-shell-ng2 + npm install +npm install ../ng2-components/ng2-alfresco-documentlist +npm install ../ng2-components/ng2-alfresco-login + npm run build.dev ``` + +### Configuring development environment + +**Get a copy** + +```sh +git clone https://github.com/Alfresco/dev-platform-webcomponents.git +``` + +**Install symlinks for Alfresco components** + +*ng2-alfresco-documentlist component:* + +```sh +cd ng2-components/ng2-alfresco-documentlist +npm link +cd ../../demo-shell-ng +npm link ng2-alfresco-documentlist +``` + +*ng2-alfresco-login component:* + +```sh +cd ng2-components/ng2-alfresco-login +npm link +cd ../../demo-shell-ng +npm link ng2-alfresco-login +``` + +Please refer to [this article](https://docs.npmjs.com/cli/link) for more details on npm link. + +### Building and running + +**Install dependencies:** + + +```sh +cd dev-platform-webcomponents/demo-shell-ng2/ +npm install +``` + +**(Option 1) Fast build and watch for dev purposes:** + +```sh +npm start +``` + +**(Option 2) Build and watch with Gulp:** + +```sh +npm run build.dev +``` + +*or* + +```sh +gulp dev +``` diff --git a/demo-shell-ng2/gulpfile.js b/demo-shell-ng2/gulpfile.js index dc4018ed2a..674cab02ee 100644 --- a/demo-shell-ng2/gulpfile.js +++ b/demo-shell-ng2/gulpfile.js @@ -25,7 +25,16 @@ gulp.task('copy:assets', ['clean'], function() { // copy dependencies gulp.task('copy:libs', ['clean'], function() { return gulp.src([ - 'node_modules/**/*' + 'node_modules/**/*', + '!node_modules/ng2-alfresco-*{,/**/*}' + ]) + .pipe(gulp.dest('dist/node_modules')) +}); + +gulp.task('copy:components', ['clean'], function() { + return gulp.src([ + '../ng2-components/**/*', + '!../ng2-components/README.md' ]) .pipe(gulp.dest('dist/node_modules')) }); @@ -75,7 +84,7 @@ gulp.task('serve', ['build'], function() { gulp.watch(['app/**/*', 'index.html'], ['buildAndReload']); }); -gulp.task('build', ['tslint', 'copy:assets', 'copy:libs', 'copy:typings', 'compile']); +gulp.task('build', ['tslint', 'copy:assets', 'copy:libs', 'copy:components', 'copy:typings', 'compile']); gulp.task('dev', ['build', 'serve'], reload); gulp.task('default', ['build']); gulp.task('buildAndReload', ['build'], reload); diff --git a/demo-shell-ng2/package.json b/demo-shell-ng2/package.json index e8bbbfdbcc..dfc9a48485 100644 --- a/demo-shell-ng2/package.json +++ b/demo-shell-ng2/package.json @@ -8,11 +8,10 @@ "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ", "test": "live-server --open=tests-runner.html", "tsc": "tsc", - "tsc:w": "tsc -w", + "tsc:w": "tsc -w -p tsconfig.dev.json", "lite": "lite-server", "typings": "typings", - "postinstall": "typings install", - "build": "tsc -p .; exit 0" + "postinstall": "typings install" }, "license": "ISC", "dependencies": { @@ -22,8 +21,6 @@ "font-awesome": "^4.5.0", "jquery": "^2.2.2", "material-design-lite": "^1.1.3", - "ng2-alfresco-documentlist": "file:../ng2-components/ng2-alfresco-documentlist", - "ng2-alfresco-login": "file:../ng2-components/ng2-alfresco-login", "ng2-uploader": "denisvuyka/ng2-uploader", "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", diff --git a/demo-shell-ng2/tsconfig.dev.json b/demo-shell-ng2/tsconfig.dev.json new file mode 100644 index 0000000000..0cd78ac35d --- /dev/null +++ b/demo-shell-ng2/tsconfig.dev.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false + }, + "exclude": [ + "dist", + "node_modules", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/start.sh b/start.sh new file mode 100755 index 0000000000..3078965dcf --- /dev/null +++ b/start.sh @@ -0,0 +1,7 @@ +cd demo-shell-ng2 + +npm install +npm install ../ng2-components/ng2-alfresco-documentlist +npm install ../ng2-components/ng2-alfresco-login + +npm run build.dev