From b735fa369ccf5661b1617f00378832cb81fe6f9e Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 26 Jan 2018 14:57:01 +0000 Subject: [PATCH] 2.1.0 (#110) * add custom event polyfill * enable polyfills by default (#103) * fix overlay viewer in templates (#104) * [ADF-2125] Removed 'ng2-' from generator instructions (#105) * [ADF-2125] Removed 'ng2-' from generator instructions * [ADF-2125] Fixed link that was displayed badly * [ADF-2125] Fixed small grammar and display glitches * [ADF-2125] Fixed generator names * fix style issues * [ADF-2164] Add docker support to the generated app (#107) * Add docker support to the generated app * added the travis configuration for the DOCKER pipeline * docker publish instructions * fix docker target folder * [ADF-2145] Add the app routes files in the generator 2 (#108) * add route file * fix module * travis conf * [hackathon] command line mode support (#106) * command line mode support * code cleanup * update travis settings * Update dependencies 2.1.0 (#109) * update depenccies 2.1.0 * fix import pdfjs --- .travis.yml | 8 ++ README.md | 40 ++++++-- __tests__/app.js | 6 +- app/index.js | 92 +++++++++++++------ .../adf-cli-acs-aps-template/.travis.yml | 12 +++ .../adf-cli-acs-aps-template/Dockerfile | 6 ++ .../adf-cli-acs-aps-template/README.md | 41 +++++++++ .../adf-cli-acs-aps-template/docker.md | 62 +++++++++++++ .../adf-cli-acs-aps-template/nginx.conf | 25 +++++ .../adf-cli-acs-aps-template/package.json | 66 ++++++------- .../src/app/app.module.ts | 39 +------- .../src/app/app.routes.ts | 66 +++++++++++++ .../documentlist/documentlist.component.html | 6 +- .../documentlist/documentlist.component.ts | 13 ++- .../src/custom-style.scss | 6 +- .../adf-cli-acs-aps-template/src/main.ts | 2 +- .../adf-cli-acs-aps-template/src/polyfills.ts | 43 +++++---- .../adf-cli-acs-aps-template/tslint.json | 13 +-- .../adf-cli-acs-template/.travis.yml | 12 +++ app/templates/adf-cli-acs-template/Dockerfile | 6 ++ app/templates/adf-cli-acs-template/README.md | 41 +++++++++ app/templates/adf-cli-acs-template/docker.md | 61 ++++++++++++ app/templates/adf-cli-acs-template/nginx.conf | 25 +++++ .../adf-cli-acs-template/package.json | 60 ++++++------ .../src/app/app.module.ts | 18 +--- .../src/app/app.routes.ts | 42 +++++++++ .../documentlist/documentlist.component.html | 6 +- .../documentlist/documentlist.component.ts | 12 +-- .../src/custom-style.scss | 5 +- .../adf-cli-acs-template/src/main.ts | 2 +- .../adf-cli-acs-template/src/polyfills.ts | 42 +++++---- .../adf-cli-acs-template/tslint.json | 13 +-- .../adf-cli-aps-template/.travis.yml | 12 +++ app/templates/adf-cli-aps-template/Dockerfile | 6 ++ app/templates/adf-cli-aps-template/README.md | 41 +++++++++ app/templates/adf-cli-aps-template/docker.md | 62 +++++++++++++ app/templates/adf-cli-aps-template/nginx.conf | 25 +++++ .../adf-cli-aps-template/package.json | 66 ++++++------- .../src/app/app.module.ts | 31 +------ .../src/app/app.routes.ts | 60 ++++++++++++ .../src/custom-style.scss | 6 +- .../adf-cli-aps-template/src/main.ts | 2 +- .../adf-cli-aps-template/src/polyfills.ts | 42 +++++---- .../adf-cli-aps-template/tslint.json | 13 +-- app/utils.js | 2 +- docs/README.md | 24 ++--- package.json | 3 +- 47 files changed, 950 insertions(+), 336 deletions(-) create mode 100644 app/templates/adf-cli-acs-aps-template/Dockerfile create mode 100644 app/templates/adf-cli-acs-aps-template/docker.md create mode 100644 app/templates/adf-cli-acs-aps-template/nginx.conf create mode 100644 app/templates/adf-cli-acs-aps-template/src/app/app.routes.ts create mode 100644 app/templates/adf-cli-acs-template/Dockerfile create mode 100644 app/templates/adf-cli-acs-template/docker.md create mode 100644 app/templates/adf-cli-acs-template/nginx.conf create mode 100644 app/templates/adf-cli-acs-template/src/app/app.routes.ts create mode 100644 app/templates/adf-cli-aps-template/Dockerfile create mode 100644 app/templates/adf-cli-aps-template/docker.md create mode 100644 app/templates/adf-cli-aps-template/nginx.conf create mode 100644 app/templates/adf-cli-aps-template/src/app/app.routes.ts diff --git a/.travis.yml b/.travis.yml index 4c1c32f0..2efb82fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,12 @@ +sudo: required +dist: trusty +addons: + chrome: stable +before_script: + - "sudo chown root /opt/google/chrome/chrome-sandbox" + - "sudo chmod 4755 /opt/google/chrome/chrome-sandbox" language: node_js +sudo: required node_js: - "8" diff --git a/README.md b/README.md index 580953d8..143f861d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ npm install -g yo Then the Alfresco Application Generator: ```sh -npm install -g generator-ng2-alfresco-app +npm install -g generator-alfresco-adf-app ``` ## Generating a new application project @@ -33,7 +33,7 @@ npm install -g generator-ng2-alfresco-app First, move in the folder where you want create your project. ```sh -yo ng2-alfresco-app +yo alfresco-adf-app ``` You will need to run the following scripts in the generated folder: @@ -48,21 +48,43 @@ Commands above install all project dependencies, start the project and watch for Alternatively you can use generator with install switch to trigger automatic installation of dependencies via npm install script: ```sh -yo ng2-alfresco-app --install +yo alfresco-adf-app --install ``` +### Using from the command line + +You can use the generator in the unattended mode by providing all necessary options from the command line: + +```sh +yo ng2-alfresco-app -n app2 -b adf-cli-aps-template -i +``` + +Options: + +| Name | Alias | Type | Description | +| --- | --- | --- | --- | +| --name=\ | -n \ | string | Application name | +| --blueprint=\ | -b \ | string | Blueprint name | +| --install | -i | boolean | Install dependencies upon generation | + +Default blueprint names: + +- adf-cli-acs-aps-template +- adf-cli-acs-template +- adf-cli-aps-template + ## Updating generator ```sh -npm update -g generator-ng2-alfresco-app +npm update -g generator-alfresco-adf-app ``` ## Getting current version -* Show current version generator-ng2-alfresco-app installed +* Show current version generator-alfresco-adf-app installed ```sh -yo ng2-alfresco-app --version +yo alfresco-adf-app --version ``` ## Contributing to the generator @@ -75,7 +97,7 @@ yo ng2-alfresco-app --version 6. Push to the branch: `git push origin my-new-feature` 7. Submit a pull request -> to Contribute to the existing code base Add test cases to cover the new behaviour, and make sure all the existing tests are still green. +To Contribute to the existing code base, add test cases to cover the new behaviour, and make sure all the existing tests are still green. To test the generator: @@ -96,10 +118,10 @@ Requirements for new projects: ```sh # OS X / Linux -DEBUG=yeoman:generator yo ng2-alfresco-app +DEBUG=yeoman:generator yo alfresco-adf-app # Windows -set DEBUG=yeoman:generator & yo ng2-alfresco-app +set DEBUG=yeoman:generator & yo alfresco-adf-app ``` More on [debugging generators](http://yeoman.io/authoring/debugging.html). diff --git a/__tests__/app.js b/__tests__/app.js index 790086f1..74a9a84a 100644 --- a/__tests__/app.js +++ b/__tests__/app.js @@ -10,7 +10,7 @@ describe('Alfresco component generator', () => { return helpers.run(path.join(__dirname, '../app')) .withPrompts({ name: 'adf-cli-acs-template', - blueprint: 'Content Services' + blueprint: 'adf-cli-acs-template' }); }); @@ -65,7 +65,7 @@ describe('Alfresco component generator', () => { return helpers.run(path.join(__dirname, '../app')) .withPrompts({ name: 'adf-cli-aps-template', - blueprint: 'Process Services' + blueprint: 'adf-cli-aps-template' }); }); @@ -124,7 +124,7 @@ describe('Alfresco component generator', () => { return helpers.run(path.join(__dirname, '../app')) .withPrompts({ name: 'adf-cli-acs-aps-template', - blueprint: 'Process and Content Services' + blueprint: 'adf-cli-acs-aps-template' }); }); diff --git a/app/index.js b/app/index.js index 8ad19dd0..5ecd4fe3 100644 --- a/app/index.js +++ b/app/index.js @@ -1,61 +1,101 @@ -const Generator = require('yeoman-generator'); const utils = require('./utils'); const alflogo = require('alfresco-logo'); +const CLIGenerator = require('generator-alfresco-common').cli_generator; +const filters = require('generator-alfresco-common').prompt_filters; -module.exports = class extends Generator { +module.exports = class extends CLIGenerator { constructor(args, opts) { super(args, opts); } async initializing() { - this.blueprints = await utils.getBluprints(); - } - - prompting() { - this.log(alflogo( - 'ADF Angular app generator for Alfresco\n Version ' + this.rootGeneratorVersion() + '\n', - {'left-pad': ' '})); + this.state = {}; + this.blueprints = await utils.getBlueprints(); - return this.prompt([ + this.prompts = [ { type: 'input', name: 'name', message: 'Your project name', - default: this.appname // Default to current folder name + default: this.appname, // Default to current folder name + option: { + name: 'name', + config: { + name: 'name', + alias: 'n', + required: true, + type: String + } + }, + commonFilter: filters.requiredTextFilter }, { type: 'list', name: 'blueprint', message: 'Application blueprint', choices: this.blueprints.map(bp => { - return bp.displayName; - }) + return { + name: bp.displayName, + value: bp.name + }; + }), + option: { + name: 'blueprint', + config: { + alias: 'b', + required: true, + type: String + } + }, + commonFilter: filters.chooseOneFilterFactory(this.blueprints.map(bp => bp.name)) }, { type: 'confirm', - name: 'performInstall', - message: 'Would you like to install dependencies now?' - }]) - .then((answers) => { - if (answers.name !== this.appname) { - this.destinationRoot(this.destinationPath(answers.name)); - } - - this.targetBlueprint = this.blueprints.find(bp => bp.displayName === answers.blueprint); - this.performInstall = answers.performInstall; - }); + name: 'install', + message: 'Would you like to install dependencies now?', + option: { + name: 'install', + config: { + alias: 'i', + required: false, + type: Boolean, + default: false + } + }, + commonFilter: filters.booleanFilter + } + ]; + + this.setupArgumentsAndOptions(this.prompts); + } + + prompting() { + this.log(alflogo( + 'ADF Angular app generator for Alfresco\n Version ' + this.rootGeneratorVersion() + '\n', + {'left-pad': ' '})); + + return this.subgeneratorPrompt(this.prompts, '', props => { + this.state.name = props.name; + console.log(props.blueprint); + this.state.blueprint = this.blueprints.find(bp => bp.name === props.blueprint); + this.state.install = props.install; + + if (props.name !== this.appname) { + this.destinationRoot(this.destinationPath(props.name)); + } + }); } writing() { this.fs.copy( - this.targetBlueprint.path + '/**/*', + this.state.blueprint.path + '/**/*', this.destinationPath(), { globOptions: { dot: true } } ); } install() { - if (this.options.install || this.performInstall) { + if (this.options.install || this.state.install) { this.npmInstall(); } } diff --git a/app/templates/adf-cli-acs-aps-template/.travis.yml b/app/templates/adf-cli-acs-aps-template/.travis.yml index 959166f9..0ce2b8aa 100644 --- a/app/templates/adf-cli-acs-aps-template/.travis.yml +++ b/app/templates/adf-cli-acs-aps-template/.travis.yml @@ -17,3 +17,15 @@ script: - export CHROME_BIN=chromium-browser - xvfb-run -a npm run test -- --single-run --no-progress --browser=ChromeNoSandbox #- xvfb-run -a npm run e2e -- --no-progress --config=protractor-ci.conf.js + +after_success: + - bash <(curl -s https://codecov.io/bash) -X gcov +#Uncomment this part if you want publish your docker image +# - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) +# - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" +# - export TAG=`if [ "$BRANCH" == "master" ]; then echo "latest"; else echo $BRANCH ; fi` +# - docker build -t $DOCKER_REPO:$TAG . +# # Publish extra image based on Travis build number +# - docker tag $DOCKER_REPO:$TAG $DOCKER_REPO:travis-$TRAVIS_BUILD_NUMBER +# - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" +# - docker push $DOCKER_REPO diff --git a/app/templates/adf-cli-acs-aps-template/Dockerfile b/app/templates/adf-cli-acs-aps-template/Dockerfile new file mode 100644 index 00000000..ca467960 --- /dev/null +++ b/app/templates/adf-cli-acs-aps-template/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /usr/share/nginx/html +COPY dist/ . diff --git a/app/templates/adf-cli-acs-aps-template/README.md b/app/templates/adf-cli-acs-aps-template/README.md index f5d5b7d9..dd33efb9 100644 --- a/app/templates/adf-cli-acs-aps-template/README.md +++ b/app/templates/adf-cli-acs-aps-template/README.md @@ -54,3 +54,44 @@ Before running the tests make sure you are serving the app via `ng serve`. ## Further help To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). + +# Docker + +You can create a Docker image to run your generated app in the container. + +## Building from source code + +You need to run the following commands to build the project from the source code: + +```sh +npm run build +``` + +That produces a build in the "dist" folder that you can use with a Docker image. + +

+Also, you may need to update the `dist/app.config.json` file with the settings relevant to your scenario. +

+ +## Creating an image + +The generated app provides a "Dockerfile" file in the repository root. +You can build the image with the following command: + +```sh +docker image build -t YOUR_NAME_APP . +``` + +## Running image in a container + +To run the image locally, you can use the following command: + +```sh +docker container run -p 80:80 --rm YOUR_NAME_APP +``` + +Navigate to "http://localhost" to access the running application. + +

+(For more information about docker see also)[docker.md] +

diff --git a/app/templates/adf-cli-acs-aps-template/docker.md b/app/templates/adf-cli-acs-aps-template/docker.md new file mode 100644 index 00000000..d67236c1 --- /dev/null +++ b/app/templates/adf-cli-acs-aps-template/docker.md @@ -0,0 +1,62 @@ + +## Publishing to Docker Hub + +First of all, if you do not have a Docker Hub account, you can register here: https://hub.docker.com/, the registration is absolutely free. + +Next, it is recommended that you get a clean build of the application: + +```sh +npm install +npm run build +``` + +The commands above are going to produce a fresh build that is stored in the `dist` folder. +At this point, you can make modifications to the final code in the `dist` folder if needed. +For example you may want to change the `app.config.json` file content. + +Now you can build your first version of the image: + +```sh +docker image build -t myaccount/my_app_name:1.0 . +``` + +Where `myaccount` is usually your Docker Hub account name. + +

+Please note the ending "." symbol at the end of the command. It instructs the Docker to take current folder where the `Dockerfile` is located. +

+ +To publish the newly created image use the next command: + +```sh +docker push myaccount/my_app_name:1.0 +``` + +## Running from Docker Hub + +To quickly test the published image, or run it on another machine, use the following command: + +```sh +docker container run -p 80:80 --rm myaccount/my_app_name:1.0 +``` + +The `--rm` switch means the Docker will cleanup the container and image data once you stop the process. + +

+You may also want to remove your local image before trying out the Docker Hub:
+`docker image rm myaccount/my_app_name:1.0` +

+ +## Travis + +In order to let Travis publish the image to a registry for you uncomment the relative part in the `.travis.yml`. +The email, username, and password used for login should be stored in the repository settings environment variables, which may be set up through the web or locally via the Travis CLI, e.g.: + +``` +travis env set DOCKER_USERNAME myusername +travis env set DOCKER_PASSWORD secretsecr +``` + +For more information [see also Pushing a Docker Image to a Registry ](https://docs.travis-ci.com/user/docker/) + + diff --git a/app/templates/adf-cli-acs-aps-template/nginx.conf b/app/templates/adf-cli-acs-aps-template/nginx.conf new file mode 100644 index 00000000..ea9434b3 --- /dev/null +++ b/app/templates/adf-cli-acs-aps-template/nginx.conf @@ -0,0 +1,25 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + try_files $uri $uri/ /index.html; + } + } +} diff --git a/app/templates/adf-cli-acs-aps-template/package.json b/app/templates/adf-cli-acs-aps-template/package.json index 60b2b348..d7f51378 100644 --- a/app/templates/adf-cli-acs-aps-template/package.json +++ b/app/templates/adf-cli-acs-aps-template/package.json @@ -1,6 +1,6 @@ { "name": "adf-cli-acs-aps-template", - "version": "2.0.0", + "version": "2.1.0", "blueprint": "Process and Content Services", "description": "ACS APS ADF Application with Angular CLI", "license": "MIT", @@ -14,24 +14,26 @@ }, "private": true, "dependencies": { - "@angular/animations": "5.0.0", - "@angular/cdk": "5.0.0-rc0", - "@angular/common": "5.0.0", - "@angular/compiler": "5.0.0", - "@angular/core": "5.0.0", - "@angular/flex-layout": "2.0.0-beta.10", - "@angular/forms": "5.0.0", - "@angular/http": "5.0.0", - "@angular/material": "5.0.0-rc0", - "@angular/platform-browser": "5.0.0", - "@angular/platform-browser-dynamic": "5.0.0", - "@angular/router": "5.0.0", + "@alfresco/adf-content-services": "2.1.0", + "@alfresco/adf-core": "2.1.0", + "@alfresco/adf-insights": "2.1.0", + "@alfresco/adf-process-services": "2.1.0", + "@angular/animations": "5.1.1", + "@angular/cdk": "5.0.1", + "@angular/common": "5.1.1", + "@angular/compiler": "5.1.1", + "@angular/core": "5.1.1", + "@angular/flex-layout": "2.0.0-beta.12", + "@angular/forms": "5.1.1", + "@angular/http": "5.1.1", + "@angular/material": "5.0.1", + "@angular/platform-browser": "5.1.1", + "@angular/platform-browser-dynamic": "5.1.1", + "@angular/router": "5.1.1", + "@mat-datetimepicker/core": "^1.0.1", + "@mat-datetimepicker/moment": "^1.0.1", "@ngx-translate/core": "8.0.0", "alfresco-js-api": "2.0.0", - "@alfresco/adf-content-services": "2.0.0", - "@alfresco/adf-process-services": "2.0.0", - "@alfresco/adf-core": "2.0.0", - "@alfresco/adf-insights": "2.0.1", "chart.js": "2.5.0", "classlist.js": "1.1.20150312", "core-js": "2.4.1", @@ -39,8 +41,8 @@ "hammerjs": "2.0.8", "intl": "1.2.5", "minimatch": "3.0.4", - "moment-es6": "1.0.0", - "moment": "2.15.2", + "moment": "2.18.1", + "moment-es6": "^1.0.0", "ng2-charts": "1.6.0", "pdfjs-dist": "1.5.404", "raphael": "2.2.7", @@ -50,25 +52,25 @@ "zone.js": "0.8.14" }, "devDependencies": { - "@angular/cli": "1.5.0", - "@angular/compiler-cli": "5.0.0", - "@angular/language-service": "5.0.0", - "@types/jasmine": "~2.5.53", + "@angular-devkit/core": "0.0.28", + "@angular/cli": "1.6.5", + "@angular/compiler-cli": "^5.2.0", + "@angular/language-service": "^5.2.0", + "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", - "codelyzer": "~3.2.0", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.1", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.8.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~2.0.0", + "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", - "rimraf": "^2.6.2", - "ts-node": "~3.2.0", - "tslint": "~5.7.0", - "typescript": "~2.4.2" + "ts-node": "~4.1.0", + "tslint": "~5.9.1", + "typescript": "~2.5.3" } } diff --git a/app/templates/adf-cli-acs-aps-template/src/app/app.module.ts b/app/templates/adf-cli-acs-aps-template/src/app/app.module.ts index 6071b837..cbd97bba 100644 --- a/app/templates/adf-cli-acs-aps-template/src/app/app.module.ts +++ b/app/templates/adf-cli-acs-aps-template/src/app/app.module.ts @@ -4,8 +4,6 @@ import { RouterModule, Routes } from '@angular/router'; // ADF modules import { AdfModule } from './adf.module'; -import { AuthGuardBpm } from '@alfresco/adf-core'; -import { AuthGuardEcm } from '@alfresco/adf-core'; // Custom stencils import { StencilsModule } from './stencils.module'; @@ -19,42 +17,7 @@ import { TasksComponent } from './tasks/tasks.component'; import { TaskDetailsComponent } from './task-details/task-details.component'; import { DocumentlistComponent } from './documentlist/documentlist.component'; import { StartProcessComponent } from './start-process/start-process.component'; - -const appRoutes: Routes = [ - { - path: '', - component: HomeComponent - }, - { - path: 'login', - component: LoginComponent - }, - { - path: 'apps', - component: AppsComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/tasks', - component: TasksComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/tasks/:taskId', - component: TaskDetailsComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/start-process', - component: StartProcessComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'documentlist', - component: DocumentlistComponent, - canActivate: [ AuthGuardEcm ] - } -]; +import { appRoutes } from './app.routes'; @NgModule({ imports: [ diff --git a/app/templates/adf-cli-acs-aps-template/src/app/app.routes.ts b/app/templates/adf-cli-acs-aps-template/src/app/app.routes.ts new file mode 100644 index 00000000..81ae49df --- /dev/null +++ b/app/templates/adf-cli-acs-aps-template/src/app/app.routes.ts @@ -0,0 +1,66 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ModuleWithProviders } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard, AuthGuardBpm, AuthGuardEcm } from '@alfresco/adf-core'; +import { AppComponent } from './app.component'; +import { HomeComponent } from './home/home.component'; +import { LoginComponent } from './login/login.component'; +import { AppsComponent } from './apps/apps.component'; +import { TasksComponent } from './tasks/tasks.component'; +import { TaskDetailsComponent } from './task-details/task-details.component'; +import { DocumentlistComponent } from './documentlist/documentlist.component'; +import { StartProcessComponent } from './start-process/start-process.component'; + +export const appRoutes: Routes = [ + { + path: '', + component: HomeComponent + }, + { + path: 'login', + component: LoginComponent + }, + { + path: 'apps', + component: AppsComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/tasks', + component: TasksComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/tasks/:taskId', + component: TaskDetailsComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/start-process', + component: StartProcessComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'documentlist', + component: DocumentlistComponent, + canActivate: [ AuthGuardEcm ] + } +]; + +export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes); diff --git a/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.html b/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.html index 91cbf237..c310d803 100644 --- a/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.html +++ b/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.html @@ -18,13 +18,13 @@ diff --git a/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.ts b/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.ts index 34295235..3c6ec03f 100644 --- a/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.ts +++ b/app/templates/adf-cli-acs-aps-template/src/app/documentlist/documentlist.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, ViewChild, Input } from '@angular/core'; import { NotificationService } from '@alfresco/adf-core'; import { DocumentListComponent } from '@alfresco/adf-content-services'; @@ -7,19 +7,18 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; templateUrl: './documentlist.component.html', styleUrls: ['./documentlist.component.css'] }) -export class DocumentlistComponent implements OnInit { +export class DocumentlistComponent { - showViewer: Boolean = false; - nodeId: String = null; + @Input() + showViewer: boolean = false; + + nodeId: string = null; @ViewChild(DocumentListComponent) documentList: DocumentListComponent; constructor(private notificationService: NotificationService) { } - ngOnInit() { - } - uploadSuccess(event: any) { this.notificationService.openSnackMessage('File uploaded'); this.documentList.reload(); diff --git a/app/templates/adf-cli-acs-aps-template/src/custom-style.scss b/app/templates/adf-cli-acs-aps-template/src/custom-style.scss index 7443c523..cb12fced 100644 --- a/app/templates/adf-cli-acs-aps-template/src/custom-style.scss +++ b/app/templates/adf-cli-acs-aps-template/src/custom-style.scss @@ -1,6 +1,3 @@ -@import '~@alfresco/adf-core/prebuilt-themes/adf-blue-orange.css'; - - @import '~@alfresco/adf-content-services/theming'; @import '~@alfresco/adf-process-services/theming'; @import '~@alfresco/adf-core/theming'; @@ -19,10 +16,13 @@ $theme: mat-light-theme($primary, $accent, $warn); @include adf-process-services-theme($theme); @include adf-core-theme($theme); +$background: map-get($theme, background); + body, html { margin: 0; height: 100%; overflow: hidden; + background: mat-color($background, 'card'); font-size: mat-font-size($alfresco-typography, body-1); font-family: mat-font-family($alfresco-typography); line-height: mat-line-height($alfresco-typography, body-1); diff --git a/app/templates/adf-cli-acs-aps-template/src/main.ts b/app/templates/adf-cli-acs-aps-template/src/main.ts index 520bafd8..82374e56 100644 --- a/app/templates/adf-cli-acs-aps-template/src/main.ts +++ b/app/templates/adf-cli-acs-aps-template/src/main.ts @@ -6,7 +6,7 @@ import { environment } from './environments/environment'; import 'hammerjs'; -import pdfjsLib from 'pdfjs-dist'; +import * as pdfjsLib from 'pdfjs-dist'; pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js'; if (environment.production) { diff --git a/app/templates/adf-cli-acs-aps-template/src/polyfills.ts b/app/templates/adf-cli-acs-aps-template/src/polyfills.ts index 7831e97b..0ad0aeec 100644 --- a/app/templates/adf-cli-acs-aps-template/src/polyfills.ts +++ b/app/templates/adf-cli-acs-aps-template/src/polyfills.ts @@ -19,23 +19,23 @@ */ /** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; +import 'core-js/es6/symbol'; +import 'core-js/es6/object'; +import 'core-js/es6/function'; +import 'core-js/es6/parse-int'; +import 'core-js/es6/parse-float'; +import 'core-js/es6/number'; +import 'core-js/es6/math'; +import 'core-js/es6/string'; +import 'core-js/es6/date'; +import 'core-js/es6/array'; +import 'core-js/es6/regexp'; +import 'core-js/es6/map'; +import 'core-js/es6/weak-map'; +import 'core-js/es6/set'; /** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. +import 'classlist.js'; // Run `npm install --save classlist.js`. /** Evergreen browsers require these. **/ import 'core-js/es6/reflect'; @@ -46,7 +46,7 @@ import 'core-js/es7/reflect'; * Required to support Web Animations `@angular/animation`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. +import 'web-animations-js'; // Run `npm install --save web-animations-js`. @@ -65,8 +65,15 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. * Date, currency, decimal and percent pipes. * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 */ -// import 'intl'; // Run `npm install --save intl`. +import 'intl'; // Run `npm install --save intl`. /** * Need to import at least one locale-data with intl. */ -// import 'intl/locale-data/jsonp/en'; +import 'intl/locale-data/jsonp/en'; + +/** + * Support custom event in IE11 + * + * */ +import 'custom-event-polyfill/custom-event-polyfill' // Run `npm install --save custom-event-polyfill`. + diff --git a/app/templates/adf-cli-acs-aps-template/tslint.json b/app/templates/adf-cli-acs-aps-template/tslint.json index 0db5751c..9963d6c3 100644 --- a/app/templates/adf-cli-acs-aps-template/tslint.json +++ b/app/templates/adf-cli-acs-aps-template/tslint.json @@ -11,11 +11,15 @@ "check-space" ], "curly": true, + "deprecation": { + "severity": "warn" + }, "eofline": true, "forin": true, "import-blacklist": [ true, - "rxjs" + "rxjs", + "rxjs/Rx" ], "import-spacing": true, "indent": [ @@ -103,7 +107,6 @@ "variable-declaration": "nospace" } ], - "typeof-compare": true, "unified-signatures": true, "variable-name": false, "whitespace": [ @@ -126,6 +129,7 @@ "app", "kebab-case" ], + "no-output-on-prefix": true, "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -134,9 +138,6 @@ "use-life-cycle-interface": true, "use-pipe-transform-interface": true, "component-class-suffix": true, - "directive-class-suffix": true, - "no-access-missing-member": true, - "templates-use-public": true, - "invoke-injectable": true + "directive-class-suffix": true } } diff --git a/app/templates/adf-cli-acs-template/.travis.yml b/app/templates/adf-cli-acs-template/.travis.yml index 959166f9..0ce2b8aa 100644 --- a/app/templates/adf-cli-acs-template/.travis.yml +++ b/app/templates/adf-cli-acs-template/.travis.yml @@ -17,3 +17,15 @@ script: - export CHROME_BIN=chromium-browser - xvfb-run -a npm run test -- --single-run --no-progress --browser=ChromeNoSandbox #- xvfb-run -a npm run e2e -- --no-progress --config=protractor-ci.conf.js + +after_success: + - bash <(curl -s https://codecov.io/bash) -X gcov +#Uncomment this part if you want publish your docker image +# - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) +# - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" +# - export TAG=`if [ "$BRANCH" == "master" ]; then echo "latest"; else echo $BRANCH ; fi` +# - docker build -t $DOCKER_REPO:$TAG . +# # Publish extra image based on Travis build number +# - docker tag $DOCKER_REPO:$TAG $DOCKER_REPO:travis-$TRAVIS_BUILD_NUMBER +# - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" +# - docker push $DOCKER_REPO diff --git a/app/templates/adf-cli-acs-template/Dockerfile b/app/templates/adf-cli-acs-template/Dockerfile new file mode 100644 index 00000000..ca467960 --- /dev/null +++ b/app/templates/adf-cli-acs-template/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /usr/share/nginx/html +COPY dist/ . diff --git a/app/templates/adf-cli-acs-template/README.md b/app/templates/adf-cli-acs-template/README.md index 59dc1b25..937762ed 100644 --- a/app/templates/adf-cli-acs-template/README.md +++ b/app/templates/adf-cli-acs-template/README.md @@ -54,3 +54,44 @@ Before running the tests make sure you are serving the app via `ng serve`. ## Further help To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). + +# Docker + +You can create a Docker image to run your generated app in the container. + +## Building from source code + +You need to run the following commands to build the project from the source code: + +```sh +npm run build +``` + +That produces a build in the "dist" folder that you can use with a Docker image. + +

+Also, you may need to update the `dist/app.config.json` file with the settings relevant to your scenario. +

+ +## Creating an image + +The generated app provides a "Dockerfile" file in the repository root. +You can build the image with the following command: + +```sh +docker image build -t YOUR_NAME_APP . +``` + +## Running image in a container + +To run the image locally, you can use the following command: + +```sh +docker container run -p 80:80 --rm YOUR_NAME_APP +``` + +Navigate to "http://localhost" to access the running application. + +

+(For more information about docker see also)[docker.md] +

diff --git a/app/templates/adf-cli-acs-template/docker.md b/app/templates/adf-cli-acs-template/docker.md new file mode 100644 index 00000000..051ba167 --- /dev/null +++ b/app/templates/adf-cli-acs-template/docker.md @@ -0,0 +1,61 @@ + +## Publishing to Docker Hub + +First of all, if you do not have a Docker Hub account, you can register here: https://hub.docker.com/, the registration is absolutely free. + +Next, it is recommended that you get a clean build of the application: + +```sh +npm install +npm run build +``` + +The commands above are going to produce a fresh build that is stored in the `dist` folder. +At this point, you can make modifications to the final code in the `dist` folder if needed. +For example you may want to change the `app.config.json` file content. + +Now you can build your first version of the image: + +```sh +docker image build -t myaccount/my_app_name:1.0 . +``` + +Where `myaccount` is usually your Docker Hub account name. + +

+Please note the ending "." symbol at the end of the command. It instructs the Docker to take current folder where the `Dockerfile` is located. +

+ +To publish the newly created image use the next command: + +```sh +docker push myaccount/my_app_name:1.0 +``` + +## Running from Docker Hub + +To quickly test the published image, or run it on another machine, use the following command: + +```sh +docker container run -p 80:80 --rm myaccount/my_app_name:1.0 +``` + +The `--rm` switch means the Docker will cleanup the container and image data once you stop the process. + +

+You may also want to remove your local image before trying out the Docker Hub:
+`docker image rm myaccount/my_app_name:1.0` +

+ +## Travis + +In order to let Travis publish the image to a registry for you uncomment the relative part in the `.travis.yml`. +The email, username, and password used for login should be stored in the repository settings environment variables, which may be set up through the web or locally via the Travis CLI, e.g.: + +``` +travis env set DOCKER_USERNAME myusername +travis env set DOCKER_PASSWORD secretsecr +``` + +For more information [see also Pushing a Docker Image to a Registry ](https://docs.travis-ci.com/user/docker/) + diff --git a/app/templates/adf-cli-acs-template/nginx.conf b/app/templates/adf-cli-acs-template/nginx.conf new file mode 100644 index 00000000..ea9434b3 --- /dev/null +++ b/app/templates/adf-cli-acs-template/nginx.conf @@ -0,0 +1,25 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + try_files $uri $uri/ /index.html; + } + } +} diff --git a/app/templates/adf-cli-acs-template/package.json b/app/templates/adf-cli-acs-template/package.json index d0c354ce..1a6dfff8 100644 --- a/app/templates/adf-cli-acs-template/package.json +++ b/app/templates/adf-cli-acs-template/package.json @@ -1,6 +1,6 @@ { "name": "adf-cli-acs-template", - "version": "2.0.0", + "version": "2.1.0", "blueprint": "Content Services", "description": "ACS ADF Application with Angular CLI", "license": "MIT", @@ -14,22 +14,24 @@ }, "private": true, "dependencies": { - "@angular/animations": "5.0.0", - "@angular/cdk": "5.0.0-rc0", - "@angular/common": "5.0.0", - "@angular/compiler": "5.0.0", - "@angular/core": "5.0.0", - "@angular/flex-layout": "2.0.0-beta.10", - "@angular/forms": "5.0.0", - "@angular/http": "5.0.0", - "@angular/material": "5.0.0-rc0", - "@angular/platform-browser": "5.0.0", - "@angular/platform-browser-dynamic": "5.0.0", - "@angular/router": "5.0.0", + "@alfresco/adf-content-services": "2.1.0", + "@alfresco/adf-core": "2.1.0", + "@angular/animations": "5.1.1", + "@angular/cdk": "5.0.1", + "@angular/common": "5.1.1", + "@angular/compiler": "5.1.1", + "@angular/core": "5.1.1", + "@angular/flex-layout": "2.0.0-beta.12", + "@angular/forms": "5.1.1", + "@angular/http": "5.1.1", + "@angular/material": "5.0.1", + "@angular/platform-browser": "5.1.1", + "@angular/platform-browser-dynamic": "5.1.1", + "@angular/router": "5.1.1", + "@mat-datetimepicker/core": "^1.0.1", + "@mat-datetimepicker/moment": "^1.0.1", "@ngx-translate/core": "8.0.0", "alfresco-js-api": "2.0.0", - "@alfresco/adf-content-services": "2.0.0", - "@alfresco/adf-core": "2.0.0", "chart.js": "2.5.0", "classlist.js": "1.1.20150312", "core-js": "2.4.1", @@ -37,8 +39,8 @@ "hammerjs": "2.0.8", "intl": "1.2.5", "minimatch": "3.0.4", + "moment": "2.18.1", "moment-es6": "^1.0.0", - "moment": "2.15.2", "ng2-charts": "1.6.0", "pdfjs-dist": "1.5.404", "raphael": "2.2.7", @@ -48,25 +50,25 @@ "zone.js": "0.8.14" }, "devDependencies": { - "@angular/cli": "1.5.0", - "@angular/compiler-cli": "5.0.0", - "@angular/language-service": "5.0.0", - "@types/jasmine": "~2.5.53", + "@angular-devkit/core": "0.0.28", + "@angular/cli": "1.6.5", + "@angular/compiler-cli": "^5.2.0", + "@angular/language-service": "^5.2.0", + "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", - "codelyzer": "~3.2.0", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.1", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.8.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~2.0.0", + "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", - "rimraf": "^2.6.2", - "ts-node": "~3.2.0", - "tslint": "~5.7.0", - "typescript": "~2.4.2" + "ts-node": "~4.1.0", + "tslint": "~5.9.1", + "typescript": "~2.5.3" } } diff --git a/app/templates/adf-cli-acs-template/src/app/app.module.ts b/app/templates/adf-cli-acs-template/src/app/app.module.ts index b70d5f91..94385f28 100644 --- a/app/templates/adf-cli-acs-template/src/app/app.module.ts +++ b/app/templates/adf-cli-acs-template/src/app/app.module.ts @@ -1,11 +1,10 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { appRoutes } from './app.routes'; // ADF modules import { AdfModule } from './adf.module'; -import { AuthGuardBpm } from '@alfresco/adf-core'; -import { AuthGuardEcm } from '@alfresco/adf-core'; // App components @@ -14,21 +13,6 @@ import { HomeComponent } from './home/home.component'; import { LoginComponent } from './login/login.component'; import { DocumentlistComponent } from './documentlist/documentlist.component'; -const appRoutes: Routes = [ - { - path: '', - component: HomeComponent - }, - { - path: 'login', - component: LoginComponent - }, - { - path: 'documentlist', - component: DocumentlistComponent, - canActivate: [ AuthGuardEcm ] - } -]; @NgModule({ imports: [ diff --git a/app/templates/adf-cli-acs-template/src/app/app.routes.ts b/app/templates/adf-cli-acs-template/src/app/app.routes.ts new file mode 100644 index 00000000..bd2c34c4 --- /dev/null +++ b/app/templates/adf-cli-acs-template/src/app/app.routes.ts @@ -0,0 +1,42 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ModuleWithProviders } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard, AuthGuardBpm, AuthGuardEcm } from '@alfresco/adf-core'; +import { AppComponent } from './app.component'; +import { HomeComponent } from './home/home.component'; +import { LoginComponent } from './login/login.component'; +import { DocumentlistComponent } from './documentlist/documentlist.component'; + +export const appRoutes: Routes = [ + { + path: '', + component: HomeComponent + }, + { + path: 'login', + component: LoginComponent + }, + { + path: 'documentlist', + component: DocumentlistComponent, + canActivate: [ AuthGuardEcm ] + } +]; + +export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes); diff --git a/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.html b/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.html index 91cbf237..c310d803 100644 --- a/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.html +++ b/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.html @@ -18,13 +18,13 @@ diff --git a/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.ts b/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.ts index 34295235..071d1f46 100644 --- a/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.ts +++ b/app/templates/adf-cli-acs-template/src/app/documentlist/documentlist.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, ViewChild, Input } from '@angular/core'; import { NotificationService } from '@alfresco/adf-core'; import { DocumentListComponent } from '@alfresco/adf-content-services'; @@ -7,19 +7,17 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; templateUrl: './documentlist.component.html', styleUrls: ['./documentlist.component.css'] }) -export class DocumentlistComponent implements OnInit { +export class DocumentlistComponent { - showViewer: Boolean = false; - nodeId: String = null; + @Input() + showViewer: boolean = false; + nodeId: string = null; @ViewChild(DocumentListComponent) documentList: DocumentListComponent; constructor(private notificationService: NotificationService) { } - ngOnInit() { - } - uploadSuccess(event: any) { this.notificationService.openSnackMessage('File uploaded'); this.documentList.reload(); diff --git a/app/templates/adf-cli-acs-template/src/custom-style.scss b/app/templates/adf-cli-acs-template/src/custom-style.scss index 50a453bd..be9b3f9a 100644 --- a/app/templates/adf-cli-acs-template/src/custom-style.scss +++ b/app/templates/adf-cli-acs-template/src/custom-style.scss @@ -1,5 +1,3 @@ -@import '~@alfresco/adf-core/prebuilt-themes/adf-blue-orange.css'; - @import '~@alfresco/adf-content-services/theming'; @import '~@alfresco/adf-core/theming'; @@ -16,10 +14,13 @@ $theme: mat-light-theme($primary, $accent, $warn); @include adf-content-services-theme($theme); @include adf-core-theme($theme); +$background: map-get($theme, background); + body, html { margin: 0; height: 100%; overflow: hidden; + background: mat-color($background, 'card'); font-size: mat-font-size($alfresco-typography, body-1); font-family: mat-font-family($alfresco-typography); line-height: mat-line-height($alfresco-typography, body-1); diff --git a/app/templates/adf-cli-acs-template/src/main.ts b/app/templates/adf-cli-acs-template/src/main.ts index 520bafd8..82374e56 100644 --- a/app/templates/adf-cli-acs-template/src/main.ts +++ b/app/templates/adf-cli-acs-template/src/main.ts @@ -6,7 +6,7 @@ import { environment } from './environments/environment'; import 'hammerjs'; -import pdfjsLib from 'pdfjs-dist'; +import * as pdfjsLib from 'pdfjs-dist'; pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js'; if (environment.production) { diff --git a/app/templates/adf-cli-acs-template/src/polyfills.ts b/app/templates/adf-cli-acs-template/src/polyfills.ts index 7831e97b..d44a35e7 100644 --- a/app/templates/adf-cli-acs-template/src/polyfills.ts +++ b/app/templates/adf-cli-acs-template/src/polyfills.ts @@ -19,23 +19,23 @@ */ /** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; +import 'core-js/es6/symbol'; +import 'core-js/es6/object'; +import 'core-js/es6/function'; +import 'core-js/es6/parse-int'; +import 'core-js/es6/parse-float'; +import 'core-js/es6/number'; +import 'core-js/es6/math'; +import 'core-js/es6/string'; +import 'core-js/es6/date'; +import 'core-js/es6/array'; +import 'core-js/es6/regexp'; +import 'core-js/es6/map'; +import 'core-js/es6/weak-map'; +import 'core-js/es6/set'; /** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. +import 'classlist.js'; // Run `npm install --save classlist.js`. /** Evergreen browsers require these. **/ import 'core-js/es6/reflect'; @@ -46,7 +46,7 @@ import 'core-js/es7/reflect'; * Required to support Web Animations `@angular/animation`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. +import 'web-animations-js'; // Run `npm install --save web-animations-js`. @@ -65,8 +65,14 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. * Date, currency, decimal and percent pipes. * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 */ -// import 'intl'; // Run `npm install --save intl`. +import 'intl'; // Run `npm install --save intl`. /** * Need to import at least one locale-data with intl. */ -// import 'intl/locale-data/jsonp/en'; +import 'intl/locale-data/jsonp/en'; +/** + * Support custom event in IE11 + * + * */ +import 'custom-event-polyfill/custom-event-polyfill' // Run `npm install --save custom-event-polyfill`. + diff --git a/app/templates/adf-cli-acs-template/tslint.json b/app/templates/adf-cli-acs-template/tslint.json index 0db5751c..9963d6c3 100644 --- a/app/templates/adf-cli-acs-template/tslint.json +++ b/app/templates/adf-cli-acs-template/tslint.json @@ -11,11 +11,15 @@ "check-space" ], "curly": true, + "deprecation": { + "severity": "warn" + }, "eofline": true, "forin": true, "import-blacklist": [ true, - "rxjs" + "rxjs", + "rxjs/Rx" ], "import-spacing": true, "indent": [ @@ -103,7 +107,6 @@ "variable-declaration": "nospace" } ], - "typeof-compare": true, "unified-signatures": true, "variable-name": false, "whitespace": [ @@ -126,6 +129,7 @@ "app", "kebab-case" ], + "no-output-on-prefix": true, "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -134,9 +138,6 @@ "use-life-cycle-interface": true, "use-pipe-transform-interface": true, "component-class-suffix": true, - "directive-class-suffix": true, - "no-access-missing-member": true, - "templates-use-public": true, - "invoke-injectable": true + "directive-class-suffix": true } } diff --git a/app/templates/adf-cli-aps-template/.travis.yml b/app/templates/adf-cli-aps-template/.travis.yml index 959166f9..0ce2b8aa 100644 --- a/app/templates/adf-cli-aps-template/.travis.yml +++ b/app/templates/adf-cli-aps-template/.travis.yml @@ -17,3 +17,15 @@ script: - export CHROME_BIN=chromium-browser - xvfb-run -a npm run test -- --single-run --no-progress --browser=ChromeNoSandbox #- xvfb-run -a npm run e2e -- --no-progress --config=protractor-ci.conf.js + +after_success: + - bash <(curl -s https://codecov.io/bash) -X gcov +#Uncomment this part if you want publish your docker image +# - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) +# - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" +# - export TAG=`if [ "$BRANCH" == "master" ]; then echo "latest"; else echo $BRANCH ; fi` +# - docker build -t $DOCKER_REPO:$TAG . +# # Publish extra image based on Travis build number +# - docker tag $DOCKER_REPO:$TAG $DOCKER_REPO:travis-$TRAVIS_BUILD_NUMBER +# - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" +# - docker push $DOCKER_REPO diff --git a/app/templates/adf-cli-aps-template/Dockerfile b/app/templates/adf-cli-aps-template/Dockerfile new file mode 100644 index 00000000..ca467960 --- /dev/null +++ b/app/templates/adf-cli-aps-template/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /usr/share/nginx/html +COPY dist/ . diff --git a/app/templates/adf-cli-aps-template/README.md b/app/templates/adf-cli-aps-template/README.md index 5d8a1717..f7b91325 100644 --- a/app/templates/adf-cli-aps-template/README.md +++ b/app/templates/adf-cli-aps-template/README.md @@ -53,3 +53,44 @@ Before running the tests make sure you are serving the app via `ng serve`. ## Further help To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). + +# Docker + +You can create a Docker image to run your generated app in the container. + +## Building from source code + +You need to run the following commands to build the project from the source code: + +```sh +npm run build +``` + +That produces a build in the "dist" folder that you can use with a Docker image. + +

+Also, you may need to update the `dist/app.config.json` file with the settings relevant to your scenario. +

+ +## Creating an image + +The generated app provides a "Dockerfile" file in the repository root. +You can build the image with the following command: + +```sh +docker image build -t YOUR_NAME_APP . +``` + +## Running image in a container + +To run the image locally, you can use the following command: + +```sh +docker container run -p 80:80 --rm YOUR_NAME_APP +``` + +Navigate to "http://localhost" to access the running application. + +

+(For more information about docker see also)[docker.md] +

diff --git a/app/templates/adf-cli-aps-template/docker.md b/app/templates/adf-cli-aps-template/docker.md new file mode 100644 index 00000000..d67236c1 --- /dev/null +++ b/app/templates/adf-cli-aps-template/docker.md @@ -0,0 +1,62 @@ + +## Publishing to Docker Hub + +First of all, if you do not have a Docker Hub account, you can register here: https://hub.docker.com/, the registration is absolutely free. + +Next, it is recommended that you get a clean build of the application: + +```sh +npm install +npm run build +``` + +The commands above are going to produce a fresh build that is stored in the `dist` folder. +At this point, you can make modifications to the final code in the `dist` folder if needed. +For example you may want to change the `app.config.json` file content. + +Now you can build your first version of the image: + +```sh +docker image build -t myaccount/my_app_name:1.0 . +``` + +Where `myaccount` is usually your Docker Hub account name. + +

+Please note the ending "." symbol at the end of the command. It instructs the Docker to take current folder where the `Dockerfile` is located. +

+ +To publish the newly created image use the next command: + +```sh +docker push myaccount/my_app_name:1.0 +``` + +## Running from Docker Hub + +To quickly test the published image, or run it on another machine, use the following command: + +```sh +docker container run -p 80:80 --rm myaccount/my_app_name:1.0 +``` + +The `--rm` switch means the Docker will cleanup the container and image data once you stop the process. + +

+You may also want to remove your local image before trying out the Docker Hub:
+`docker image rm myaccount/my_app_name:1.0` +

+ +## Travis + +In order to let Travis publish the image to a registry for you uncomment the relative part in the `.travis.yml`. +The email, username, and password used for login should be stored in the repository settings environment variables, which may be set up through the web or locally via the Travis CLI, e.g.: + +``` +travis env set DOCKER_USERNAME myusername +travis env set DOCKER_PASSWORD secretsecr +``` + +For more information [see also Pushing a Docker Image to a Registry ](https://docs.travis-ci.com/user/docker/) + + diff --git a/app/templates/adf-cli-aps-template/nginx.conf b/app/templates/adf-cli-aps-template/nginx.conf new file mode 100644 index 00000000..ea9434b3 --- /dev/null +++ b/app/templates/adf-cli-aps-template/nginx.conf @@ -0,0 +1,25 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + try_files $uri $uri/ /index.html; + } + } +} diff --git a/app/templates/adf-cli-aps-template/package.json b/app/templates/adf-cli-aps-template/package.json index d6458a29..91f7ca57 100644 --- a/app/templates/adf-cli-aps-template/package.json +++ b/app/templates/adf-cli-aps-template/package.json @@ -1,6 +1,6 @@ { "name": "adf-cli-aps-template", - "version": "2.0.0", + "version": "2.1.0", "blueprint": "Process Services", "description": "APS ADF Application with Angular CLI", "license": "MIT", @@ -14,24 +14,26 @@ }, "private": true, "dependencies": { - "@angular/animations": "5.0.0", - "@angular/cdk": "5.0.0-rc0", - "@angular/common": "5.0.0", - "@angular/compiler": "5.0.0", - "@angular/core": "5.0.0", - "@angular/flex-layout": "2.0.0-beta.10", - "@angular/forms": "5.0.0", - "@angular/http": "5.0.0", - "@angular/material": "5.0.0-rc0", - "@angular/platform-browser": "5.0.0", - "@angular/platform-browser-dynamic": "5.0.0", - "@angular/router": "5.0.0", + "@alfresco/adf-content-services": "2.1.0", + "@alfresco/adf-core": "2.1.0", + "@alfresco/adf-insights": "2.1.0", + "@alfresco/adf-process-services": "2.1.0", + "@angular/animations": "5.1.1", + "@angular/cdk": "5.0.1", + "@angular/common": "5.1.1", + "@angular/compiler": "5.1.1", + "@angular/core": "5.1.1", + "@angular/flex-layout": "2.0.0-beta.12", + "@angular/forms": "5.1.1", + "@angular/http": "5.1.1", + "@angular/material": "5.0.1", + "@angular/platform-browser": "5.1.1", + "@angular/platform-browser-dynamic": "5.1.1", + "@angular/router": "5.1.1", + "@mat-datetimepicker/core": "^1.0.1", + "@mat-datetimepicker/moment": "^1.0.1", "@ngx-translate/core": "8.0.0", "alfresco-js-api": "2.0.0", - "@alfresco/adf-content-services": "2.0.0", - "@alfresco/adf-process-services": "2.0.0", - "@alfresco/adf-core": "2.0.0", - "@alfresco/adf-insights": "2.0.1", "chart.js": "2.5.0", "classlist.js": "1.1.20150312", "core-js": "2.4.1", @@ -39,8 +41,8 @@ "hammerjs": "2.0.8", "intl": "1.2.5", "minimatch": "3.0.4", - "moment-es6": "1.0.0", - "moment": "2.15.2", + "moment": "2.18.1", + "moment-es6": "^1.0.0", "ng2-charts": "1.6.0", "pdfjs-dist": "1.5.404", "raphael": "2.2.7", @@ -50,25 +52,25 @@ "zone.js": "0.8.14" }, "devDependencies": { - "@angular/cli": "1.5.0", - "@angular/compiler-cli": "5.0.0", - "@angular/language-service": "5.0.0", - "@types/jasmine": "~2.5.53", + "@angular-devkit/core": "0.0.28", + "@angular/cli": "1.6.5", + "@angular/compiler-cli": "^5.2.0", + "@angular/language-service": "^5.2.0", + "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", - "codelyzer": "~3.2.0", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.1", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.8.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~2.0.0", + "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", - "rimraf": "^2.6.2", - "ts-node": "~3.2.0", - "tslint": "~5.7.0", - "typescript": "~2.4.2" + "ts-node": "~4.1.0", + "tslint": "~5.9.1", + "typescript": "~2.5.3" } } diff --git a/app/templates/adf-cli-aps-template/src/app/app.module.ts b/app/templates/adf-cli-aps-template/src/app/app.module.ts index 9e15b404..323bce28 100644 --- a/app/templates/adf-cli-aps-template/src/app/app.module.ts +++ b/app/templates/adf-cli-aps-template/src/app/app.module.ts @@ -19,36 +19,7 @@ import { TasksComponent } from './tasks/tasks.component'; import { TaskDetailsComponent } from './task-details/task-details.component'; import { StartProcessComponent } from './start-process/start-process.component'; -const appRoutes: Routes = [ - { - path: '', - component: HomeComponent - }, - { - path: 'login', - component: LoginComponent - }, - { - path: 'apps', - component: AppsComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/tasks', - component: TasksComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/tasks/:taskId', - component: TaskDetailsComponent, - canActivate: [ AuthGuardBpm ] - }, - { - path: 'apps/:appId/start-process', - component: StartProcessComponent, - canActivate: [ AuthGuardBpm ] - } -]; +import { appRoutes } from './app.routes'; @NgModule({ imports: [ diff --git a/app/templates/adf-cli-aps-template/src/app/app.routes.ts b/app/templates/adf-cli-aps-template/src/app/app.routes.ts new file mode 100644 index 00000000..c70f3281 --- /dev/null +++ b/app/templates/adf-cli-aps-template/src/app/app.routes.ts @@ -0,0 +1,60 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ModuleWithProviders } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AuthGuard, AuthGuardBpm, AuthGuardEcm } from '@alfresco/adf-core'; +import { AppComponent } from './app.component'; +import { HomeComponent } from './home/home.component'; +import { LoginComponent } from './login/login.component'; +import { AppsComponent } from './apps/apps.component'; +import { TasksComponent } from './tasks/tasks.component'; +import { TaskDetailsComponent } from './task-details/task-details.component'; +import { StartProcessComponent } from './start-process/start-process.component'; + +export const appRoutes: Routes = [ + { + path: '', + component: HomeComponent + }, + { + path: 'login', + component: LoginComponent + }, + { + path: 'apps', + component: AppsComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/tasks', + component: TasksComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/tasks/:taskId', + component: TaskDetailsComponent, + canActivate: [ AuthGuardBpm ] + }, + { + path: 'apps/:appId/start-process', + component: StartProcessComponent, + canActivate: [ AuthGuardBpm ] + } +]; + +export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes); diff --git a/app/templates/adf-cli-aps-template/src/custom-style.scss b/app/templates/adf-cli-aps-template/src/custom-style.scss index 59cdf8a1..927c6aa9 100644 --- a/app/templates/adf-cli-aps-template/src/custom-style.scss +++ b/app/templates/adf-cli-aps-template/src/custom-style.scss @@ -1,6 +1,3 @@ -@import '~@alfresco/adf-core/prebuilt-themes/adf-blue-orange.css'; - - @import '~@alfresco/adf-content-services/theming'; @import '~@alfresco/adf-process-services/theming'; @import '~@alfresco/adf-insights/theming'; @@ -21,10 +18,13 @@ $theme: mat-light-theme($primary, $accent, $warn); @include adf-insights-theme($theme); @include adf-core-theme($theme); +$background: map-get($theme, background); + body, html { margin: 0; height: 100%; overflow: hidden; + background: mat-color($background, 'card'); font-size: mat-font-size($alfresco-typography, body-1); font-family: mat-font-family($alfresco-typography); line-height: mat-line-height($alfresco-typography, body-1); diff --git a/app/templates/adf-cli-aps-template/src/main.ts b/app/templates/adf-cli-aps-template/src/main.ts index 520bafd8..82374e56 100644 --- a/app/templates/adf-cli-aps-template/src/main.ts +++ b/app/templates/adf-cli-aps-template/src/main.ts @@ -6,7 +6,7 @@ import { environment } from './environments/environment'; import 'hammerjs'; -import pdfjsLib from 'pdfjs-dist'; +import * as pdfjsLib from 'pdfjs-dist'; pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js'; if (environment.production) { diff --git a/app/templates/adf-cli-aps-template/src/polyfills.ts b/app/templates/adf-cli-aps-template/src/polyfills.ts index 7831e97b..d44a35e7 100644 --- a/app/templates/adf-cli-aps-template/src/polyfills.ts +++ b/app/templates/adf-cli-aps-template/src/polyfills.ts @@ -19,23 +19,23 @@ */ /** IE9, IE10 and IE11 requires all of the following polyfills. **/ -// import 'core-js/es6/symbol'; -// import 'core-js/es6/object'; -// import 'core-js/es6/function'; -// import 'core-js/es6/parse-int'; -// import 'core-js/es6/parse-float'; -// import 'core-js/es6/number'; -// import 'core-js/es6/math'; -// import 'core-js/es6/string'; -// import 'core-js/es6/date'; -// import 'core-js/es6/array'; -// import 'core-js/es6/regexp'; -// import 'core-js/es6/map'; -// import 'core-js/es6/weak-map'; -// import 'core-js/es6/set'; +import 'core-js/es6/symbol'; +import 'core-js/es6/object'; +import 'core-js/es6/function'; +import 'core-js/es6/parse-int'; +import 'core-js/es6/parse-float'; +import 'core-js/es6/number'; +import 'core-js/es6/math'; +import 'core-js/es6/string'; +import 'core-js/es6/date'; +import 'core-js/es6/array'; +import 'core-js/es6/regexp'; +import 'core-js/es6/map'; +import 'core-js/es6/weak-map'; +import 'core-js/es6/set'; /** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. +import 'classlist.js'; // Run `npm install --save classlist.js`. /** Evergreen browsers require these. **/ import 'core-js/es6/reflect'; @@ -46,7 +46,7 @@ import 'core-js/es7/reflect'; * Required to support Web Animations `@angular/animation`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. +import 'web-animations-js'; // Run `npm install --save web-animations-js`. @@ -65,8 +65,14 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. * Date, currency, decimal and percent pipes. * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 */ -// import 'intl'; // Run `npm install --save intl`. +import 'intl'; // Run `npm install --save intl`. /** * Need to import at least one locale-data with intl. */ -// import 'intl/locale-data/jsonp/en'; +import 'intl/locale-data/jsonp/en'; +/** + * Support custom event in IE11 + * + * */ +import 'custom-event-polyfill/custom-event-polyfill' // Run `npm install --save custom-event-polyfill`. + diff --git a/app/templates/adf-cli-aps-template/tslint.json b/app/templates/adf-cli-aps-template/tslint.json index 0db5751c..9963d6c3 100644 --- a/app/templates/adf-cli-aps-template/tslint.json +++ b/app/templates/adf-cli-aps-template/tslint.json @@ -11,11 +11,15 @@ "check-space" ], "curly": true, + "deprecation": { + "severity": "warn" + }, "eofline": true, "forin": true, "import-blacklist": [ true, - "rxjs" + "rxjs", + "rxjs/Rx" ], "import-spacing": true, "indent": [ @@ -103,7 +107,6 @@ "variable-declaration": "nospace" } ], - "typeof-compare": true, "unified-signatures": true, "variable-name": false, "whitespace": [ @@ -126,6 +129,7 @@ "app", "kebab-case" ], + "no-output-on-prefix": true, "use-input-property-decorator": true, "use-output-property-decorator": true, "use-host-property-decorator": true, @@ -134,9 +138,6 @@ "use-life-cycle-interface": true, "use-pipe-transform-interface": true, "component-class-suffix": true, - "directive-class-suffix": true, - "no-access-missing-member": true, - "templates-use-public": true, - "invoke-injectable": true + "directive-class-suffix": true } } diff --git a/app/utils.js b/app/utils.js index c89c418f..b814dc89 100644 --- a/app/utils.js +++ b/app/utils.js @@ -23,7 +23,7 @@ class Utils { return json && json.name && json.version; } - async getBluprints() { + async getBlueprints() { const result = []; const dir = path.join(__dirname, 'templates'); diff --git a/docs/README.md b/docs/README.md index f701f203..8c4d9fcf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,10 +8,8 @@ See the following [page](https://github.com/Alfresco/alfresco-ng2-components/blo ## Prerequisites -

Before you start using this development framework and the generator, make sure you have installed all required software and done all the necessary configuration, see this [page](https://github.com/Alfresco/app-dev-framework/blob/master/PREREQUISITES.md). -

## Installing Yeoman and the App Generator @@ -24,7 +22,7 @@ npm install -g yo Then the Alfresco Application Generator: ```sh -npm install -g generator-ng2-alfresco-app +npm install -g generator-alfresco-adf-app ``` ## Generating a new application project @@ -32,7 +30,7 @@ npm install -g generator-ng2-alfresco-app First, move in the folder where you want create your project. ```sh -yo ng2-alfresco-app +yo alfresco-adf-app ``` You will need to run the following scripts in the generated folder: @@ -47,21 +45,21 @@ Commands above install all project dependencies, start the project and watch for Alternatively you can use generator with install switch to trigger automatic installation of dependencies via npm install script: ```sh -yo ng2-alfresco-app --install +yo alfresco-adf-app --install ``` ## Updating generator ```sh -npm update -g generator-ng2-alfresco-app +npm update -g generator-alfresco-adf-app ``` ## Getting current version -* Show current version generator-ng2-alfresco-app installed +* Show current version generator-alfresco-adf-app installed ```sh -yo ng2-alfresco-app --version +yo alfresco-adf-app --version ``` ## Contributing to the generator @@ -74,9 +72,7 @@ yo ng2-alfresco-app --version 6. Push to the branch: `git push origin my-new-feature` 7. Submit a pull request -

-To contribute to the existing code base Add test cases to cover the new behaviour, and make sure all the existing tests are still green. -

+To contribute to the existing code base, add test cases to cover the new behaviour, and make sure all the existing tests are still green. To test the generator: @@ -102,15 +98,13 @@ If you want to create a new blueprint based on the existing git repository follo ```sh # OS X / Linux -DEBUG=yeoman:generator yo ng2-alfresco-app +DEBUG=yeoman:generator yo alfresco-adf-app # Windows -set DEBUG=yeoman:generator & yo ng2-alfresco-app +set DEBUG=yeoman:generator & yo alfresco-adf-app ``` -

More on [debugging generators](http://yeoman.io/authoring/debugging.html). -

## History diff --git a/package.json b/package.json index 9ec6cba0..9761a779 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-alfresco-adf-app", - "version": "2.0.0", + "version": "2.1.0", "description": "ADF application generator for Yeoman", "author": "Alfresco Software, Ltd.", "main": "app/index.js", @@ -9,6 +9,7 @@ }, "dependencies": { "alfresco-logo": "1.0.1", + "generator-alfresco-common": "0.9.25", "yeoman-generator": "2.0.0" }, "devDependencies": {