From c578529b158ddba028f482e569c4430596d7712d Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Tue, 20 Mar 2018 11:53:11 +0000 Subject: [PATCH] [ADF-2514][ADF-2517][ADF-2143] Fix build isssues (#3097) * fix remove angular folder problem * fix npm import cli * fix search module * fix comment * fix tsconfig output * es 20016 tsconfig * travis add demo shell dist * exclude datapicker process services * demo shell script fix * bundle check new build * add simulate publish * invert publish * test distribution * improve sh help * uncomment script * finally got the guilty piece of code * run e2e --- .travis.yml | 3 ++ demo-shell/package.json | 30 ++++++------- lib/content-services/search/search.module.ts | 4 +- lib/content-services/tsconfig.json | 4 +- lib/core/tsconfig.json | 4 +- lib/insights/tsconfig.json | 4 +- lib/package.json | 16 +++---- .../attach-file-widget.component.ts | 14 +++++- .../attach-folder-widget.component.ts | 13 +++++- lib/process-services/ng-package.json | 1 + .../process-instance-details.component.ts | 2 +- .../task-list/services/tasklist.service.ts | 1 + lib/process-services/tsconfig.json | 4 +- lib/tsconfig.json | 2 +- scripts/README.md | 24 ++++++++++ scripts/config/config-verdaccio.yaml | 26 +++++++++++ scripts/simulate-publish.sh | 23 ++++++++++ scripts/start.sh | 18 ++++---- scripts/test-dist.sh | 44 +++++++++++++++++++ 19 files changed, 188 insertions(+), 49 deletions(-) create mode 100644 scripts/config/config-verdaccio.yaml create mode 100755 scripts/simulate-publish.sh create mode 100755 scripts/test-dist.sh diff --git a/.travis.yml b/.travis.yml index 9a3e2ef94c..242df6c00a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,8 +58,11 @@ script: (./scripts/start.sh -dev -t -ss -vjsapi alpha || exit 1;); fi fi + jobs: include: + - stage: Check build demo shell in production mode AND e2e + script: ./scripts/test-dist.sh - stage: Check 2.0.0 Project Update script: ./scripts/test-e2e-bc.sh - stage: Check ADF exports diff --git a/demo-shell/package.json b/demo-shell/package.json index 25f8d606dc..adc6e77f79 100644 --- a/demo-shell/package.json +++ b/demo-shell/package.json @@ -6,22 +6,20 @@ "scripts": { "ng": "ng", "prestart": "npm run validate-config", - "start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --proxy-config proxy.conf.js --app dist --open --aot=false", - "start:dev": " npm run lint && npm run server-versions && rimraf dist && npm run clean-lib-angular && concurrently \"ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open\" \"npm run style:dev --watch\" \"npm run copy:dev\" ", - "start:dist": "npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng serve --prod --build-optimizer=false --aot=false --host 0.0.0.0 --disable-host-check --app dist", - "build": "npm run validate-config && npm run server-versions && rimraf dist && ng build --app dist", - "build:dev": "npm run validate-config && npm run lint && npm run style:dev && npm run server-versions && rimraf dist && ng build --app dev", - "build:dist": "npm run validate-config && npm run style:dev && npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng build --prod --build-optimizer=false --aot=false --app dist", + "start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --proxy-config proxy.conf.js --app dist --open", + "start:dev": " npm run lint && npm run server-versions && rimraf dist && concurrently \"ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open\" \"npm run style:dev --watch\" \"npm run copy:dev\" ", + "start:dist": "npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng serve --prod --host 0.0.0.0 --disable-host-check --app dist", + "build": "npm run validate-config && npm run server-versions && rimraf dist && ng build--app dist", + "build:dev": "npm run validate-config && npm run lint && npm run style:dev && npm run server-versions && rimraf dist && ng build --app dev", + "build:dist": "npm run validate-config && npm run server-versions && rimraf dist && ng build --prod --app dist", "style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail", "copy:dev": "node ./config/dev-copy-watch.js", - "test": " npm run clean-lib-angular && ng test --single-run", + "test": " ng test --single-run", "lint": "ng lint", "e2e": "ng e2e", "validate-config": "ajv validate -s ../lib/core/app-config/schema.json -d ./src/app.config.json --errors=text --verbose", "server-versions": "rimraf ./src/versions.json && npm list --depth=0 --json=true --prod=true > ./src/versions.json || exit 0", - "clean": "npm run clean-build && rimraf dist node_modules typings dist", - "clean-lib-angular": "rimraf ../lib/node_modules/@angular", - "clean-build": "rimraf 'app/{,**/}**.js' 'app/{,**/}**.js.map' 'app/{,**/}**.d.ts'", + "clean": "rimraf dist node_modules typings", "clean-lock": "rimraf package-lock.json", "webpack": "node node_modules/webpack/bin/webpack.js" }, @@ -63,10 +61,10 @@ ], "private": true, "dependencies": { - "@alfresco/adf-content-services": "2.2.0", - "@alfresco/adf-core": "2.2.0", - "@alfresco/adf-insights": "2.2.0", - "@alfresco/adf-process-services": "2.2.0", + "@alfresco/adf-content-services": "2.3.0-beta3", + "@alfresco/adf-core": "2.3.0-beta3", + "@alfresco/adf-insights": "2.3.0-beta3", + "@alfresco/adf-process-services": "2.3.0-beta3", "@angular/animations": "5.1.1", "@angular/cdk": "5.0.1", "@angular/common": "5.1.1", @@ -82,7 +80,7 @@ "@mat-datetimepicker/core": "^1.0.1", "@mat-datetimepicker/moment": "^1.0.1", "@ngx-translate/core": "9.1.1", - "alfresco-js-api": "2.2.0", + "alfresco-js-api": "^2.3.0-beta3", "chart.js": "2.5.0", "classlist.js": "1.1.20150312", "core-js": "2.4.1", @@ -102,7 +100,7 @@ }, "devDependencies": { "@angular-devkit/core": "0.0.28", - "@angular/cli": "1.6.5", + "@angular/cli": "1.7.3", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", diff --git a/lib/content-services/search/search.module.ts b/lib/content-services/search/search.module.ts index 5ab17f5b9e..7cb5b6faa6 100644 --- a/lib/content-services/search/search.module.ts +++ b/lib/content-services/search/search.module.ts @@ -29,14 +29,14 @@ import { SearchControlComponent } from './components/search-control.component'; import { SearchComponent } from './components/search.component'; import { EmptySearchResultComponent } from './components/empty-search-result.component'; -export const ALFRESCO_SEARCH_DIRECTIVES: [any] = [ +export const ALFRESCO_SEARCH_DIRECTIVES: any[] = [ SearchComponent, SearchControlComponent, SearchTriggerDirective, EmptySearchResultComponent ]; -export const ALFRESCO_SEARCH_PROVIDERS: [any] = [ +export const ALFRESCO_SEARCH_PROVIDERS: any[] = [ SearchService ]; diff --git a/lib/content-services/tsconfig.json b/lib/content-services/tsconfig.json index cc9a8a5936..63b3c819da 100644 --- a/lib/content-services/tsconfig.json +++ b/lib/content-services/tsconfig.json @@ -16,7 +16,7 @@ "noFallthroughCasesInSwitch": true, "removeComments": true, "declaration": true, - "outDir": "./", + "outDir": "../dist/content-services/", "baseUrl" : "./", "paths": { "@alfresco/adf-process-services": ["../process-services"], @@ -25,7 +25,7 @@ "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ - "es2015", + "es2016", "dom" ], "suppressImplicitAnyIndexErrors": true, diff --git a/lib/core/tsconfig.json b/lib/core/tsconfig.json index 166f5088e2..106b24d6e9 100644 --- a/lib/core/tsconfig.json +++ b/lib/core/tsconfig.json @@ -16,7 +16,7 @@ "noFallthroughCasesInSwitch": true, "removeComments": true, "declaration": true, - "outDir": "./", + "outDir": "../dist/core/", "baseUrl" : "./", "allowSyntheticDefaultImports": true, "paths": { @@ -26,7 +26,7 @@ "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ - "es2015", + "es2016", "dom" ], "suppressImplicitAnyIndexErrors": true, diff --git a/lib/insights/tsconfig.json b/lib/insights/tsconfig.json index 9f44b7fdd1..687e7d4ec7 100644 --- a/lib/insights/tsconfig.json +++ b/lib/insights/tsconfig.json @@ -16,7 +16,7 @@ "noFallthroughCasesInSwitch": true, "removeComments": true, "declaration": true, - "outDir": "./", + "outDir": "../dist/insights/", "baseUrl" : "./", "paths": { "@alfresco/adf-process-services": ["../process-services"], @@ -26,7 +26,7 @@ "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ - "es2015", + "es2016", "dom" ], "suppressImplicitAnyIndexErrors": true, diff --git a/lib/package.json b/lib/package.json index 2654f3fd8a..1241c636a3 100644 --- a/lib/package.json +++ b/lib/package.json @@ -7,7 +7,7 @@ "clean": "rimraf node_modules", "clean-lock": "rimraf package-lock.json", "rimraf": "rimraf", - "build": "npm run webpack -- --config config/webpack.build.js --progress --profile --bail && npm run build-style && npm run bundlesize-check", + "build": "npm run webpack -- --config config/webpack.build.js --progress --profile --bail && npm run build-style", "test": "node node_modules/karma/bin/karma start --reporters mocha,coverage --single-run --component .", "build-style": "npm run bundle-scss && npm run webpack -- --config config/webpack.style.js --progress --profile --bail", "build-style-new": "npm run bundle-scss-new && npm run webpack -- --config config/webpack.style.js --progress --profile --bail", @@ -24,7 +24,7 @@ "copy-i18n": "mkdir -p dist/core/bundles/assets/adf-core/i18n && cp -R core/i18n/* dist/core/bundles/assets/adf-core/i18n && mkdir -p dist/content-services/bundles/assets/adf-content-services/i18n && cp -R content-services/i18n/* dist/content-services/bundles/assets/adf-content-services/i18n && mkdir -p dist/process-services/bundles/assets/adf-process-services/i18n && cp -R process-services/i18n/* dist/process-services/bundles/assets/adf-process-services/i18n && mkdir -p dist/insights/bundles/assets/adf-insights/i18n && cp -R insights/i18n/* dist/insights/bundles/assets/adf-insights/i18n", "copy-assets": "cp -R core/assets/* dist/core/bundles/assets && cp -R content-services/assets/* dist/content-services/bundles/assets && cp -R process-services/assets/* dist/process-services/bundles/assets", "copy-app-schema": "cp core/app-config/schema.json dist/core/app.config.schema.json", - "new-build": "npm run build-bundles && npm run build-style-new && npm run copy-i18n && npm run copy-assets && npm run copy-app-schema", + "new-build": "rm -rf node_modules/@alfresco && npm run build-bundles && npm run build-style-new && npm run copy-i18n && npm run copy-assets && npm run copy-app-schema && npm run bundlesize-check", "build-bundles": "npm run build-core && npm run link-core && npm run build-content && npm run link-content && npm run build-process && npm run build-insights", "link-core": "mkdir -p ./node_modules/@alfresco/adf-core/ && cp -R ./dist/core/* ./node_modules/@alfresco/adf-core/", "link-content": "mkdir -p ./node_modules/@alfresco/adf-content-services/ && cp -R ./dist/content-services/* ./node_modules/@alfresco/adf-content-services/", @@ -161,19 +161,19 @@ "license": "Apache-2.0", "bundlesize": [ { - "path": "./content-services/bundles/adf-content-services.js", + "path": "./dist/content-services/bundles/adf-content-services.umd.js", "maxSize": "50 kb" }, { - "path": "./process-services/bundles/adf-process-services.js", - "maxSize": "60 kb" + "path": "./dist/process-services/bundles/adf-process-services.umd.js", + "maxSize": "50 kb" }, { - "path": "./insights/bundles/adf-insights.js", - "maxSize": "60 kb" + "path": "./dist/insights/bundles/adf-insights.umd.js", + "maxSize": "50 kb" }, { - "path": "./core/bundles/adf-core.js", + "path": "./dist/core/bundles/adf-core.umd.js", "maxSize": "150 kb" } ], diff --git a/lib/process-services/content-widget/attach-file-widget.component.ts b/lib/process-services/content-widget/attach-file-widget.component.ts index 610f4ca38f..adaf53f8dc 100644 --- a/lib/process-services/content-widget/attach-file-widget.component.ts +++ b/lib/process-services/content-widget/attach-file-widget.component.ts @@ -19,7 +19,6 @@ import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { - baseHost, UploadWidgetComponent, FormService, LogService, @@ -32,12 +31,23 @@ import { import { ContentNodeDialogService } from '@alfresco/adf-content-services'; import { MinimalNodeEntryEntity } from 'alfresco-js-api'; import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/observable/from'; @Component({ selector: 'attach-widget', templateUrl: './attach-file-widget.component.html', styleUrls: ['./attach-file-widget.component.scss'], - host: baseHost, + host: { + '(click)': 'event($event)', + '(blur)': 'event($event)', + '(change)': 'event($event)', + '(focus)': 'event($event)', + '(focusin)': 'event($event)', + '(focusout)': 'event($event)', + '(input)': 'event($event)', + '(invalid)': 'event($event)', + '(select)': 'event($event)' + }, encapsulation: ViewEncapsulation.None }) export class AttachFileWidgetComponent extends UploadWidgetComponent implements OnInit { diff --git a/lib/process-services/content-widget/attach-folder-widget.component.ts b/lib/process-services/content-widget/attach-folder-widget.component.ts index c8769f2f97..30c3646bf1 100644 --- a/lib/process-services/content-widget/attach-folder-widget.component.ts +++ b/lib/process-services/content-widget/attach-folder-widget.component.ts @@ -19,7 +19,6 @@ import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { - baseHost, WidgetComponent, FormService, NodesApiService @@ -31,7 +30,17 @@ import { MinimalNodeEntryEntity } from 'alfresco-js-api'; selector: 'attach-folder-widget', templateUrl: './attach-folder-widget.component.html', styleUrls: ['./attach-folder-widget.component.scss'], - host: baseHost, + host: { + '(click)': 'event($event)', + '(blur)': 'event($event)', + '(change)': 'event($event)', + '(focus)': 'event($event)', + '(focusin)': 'event($event)', + '(focusout)': 'event($event)', + '(input)': 'event($event)', + '(invalid)': 'event($event)', + '(select)': 'event($event)' + }, encapsulation: ViewEncapsulation.None }) export class AttachFolderWidgetComponent extends WidgetComponent implements OnInit { diff --git a/lib/process-services/ng-package.json b/lib/process-services/ng-package.json index c9aa1ebbd3..7e40f8b402 100644 --- a/lib/process-services/ng-package.json +++ b/lib/process-services/ng-package.json @@ -13,6 +13,7 @@ "minimatch": "minimatch", "@angular/platform-browser/animations": "@angular/platform-browser/animations", "@angular/material": "@angular/material", + "@mat-datetimepicker": "@mat-datetimepicker", "@angular/flex-layout": "@angular/flex-layout", "@alfresco/adf-core": "@alfresco/adf-core", "@alfresco/adf-content-services": "@alfresco/adf-content-services", diff --git a/lib/process-services/process-list/components/process-instance-details.component.ts b/lib/process-services/process-list/components/process-instance-details.component.ts index 04990f8e9a..feb4f1a8d6 100644 --- a/lib/process-services/process-list/components/process-instance-details.component.ts +++ b/lib/process-services/process-list/components/process-instance-details.component.ts @@ -90,7 +90,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges { } /** - * Reset the task detail to undefined + * Reset the task detail */ reset() { this.processInstanceDetails = null; diff --git a/lib/process-services/task-list/services/tasklist.service.ts b/lib/process-services/task-list/services/tasklist.service.ts index 2ab7c9d1bc..b978e435a1 100644 --- a/lib/process-services/task-list/services/tasklist.service.ts +++ b/lib/process-services/task-list/services/tasklist.service.ts @@ -27,6 +27,7 @@ import 'rxjs/add/observable/throw'; import 'rxjs/add/observable/forkJoin'; import 'rxjs/add/observable/fromPromise'; import 'rxjs/operator/switchMap'; +import 'rxjs/add/observable/from'; @Injectable() export class TaskListService { diff --git a/lib/process-services/tsconfig.json b/lib/process-services/tsconfig.json index 3916c636e5..f3e6ff9be6 100644 --- a/lib/process-services/tsconfig.json +++ b/lib/process-services/tsconfig.json @@ -16,7 +16,7 @@ "noFallthroughCasesInSwitch": true, "removeComments": true, "declaration": true, - "outDir": "./", + "outDir": "../dist/process-services/", "baseUrl" : "./", "paths": { "@alfresco/adf-process-services": ["../process-services"], @@ -26,7 +26,7 @@ "@angular/*": ["../node_modules/@angular/*"] }, "lib": [ - "es2015", + "es2016", "dom" ], "suppressImplicitAnyIndexErrors": true, diff --git a/lib/tsconfig.json b/lib/tsconfig.json index c375ff0340..b359892711 100644 --- a/lib/tsconfig.json +++ b/lib/tsconfig.json @@ -31,7 +31,7 @@ "rxjs/*": ["./node_modules/rxjs/*"] }, "lib": [ - "es2015", + "es2016", "dom" ], "suppressImplicitAnyIndexErrors": true, diff --git a/scripts/README.md b/scripts/README.md index c594cdbf4b..3c80f21afb 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -369,4 +369,28 @@ This script test that the update from 2.0.0 to 2.x.x is still smooth ```sh ./test-e2e-bc +``` + +# simulate-publish.sh + +***simulate-publish.sh*** + +This script run a verdaccio server and simulate a publish on it + +## Examples + +```sh +./simulate-publish +``` + +# test-dist.sh + +***test-dist.sh*** + +This script test the distribution of ADF against the demo shell + +## Examples + +```sh +./test-dist ``` \ No newline at end of file diff --git a/scripts/config/config-verdaccio.yaml b/scripts/config/config-verdaccio.yaml new file mode 100644 index 0000000000..77a72472dc --- /dev/null +++ b/scripts/config/config-verdaccio.yaml @@ -0,0 +1,26 @@ +storage: ./.verdaccio_test_env/test-storage + +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +auth: + auth-memory: + users: + test: + name: test + password: test + +logs: + - {type: stdout, format: pretty, level: trace} + +packages: + '@*/*': + # scoped packages + access: $all + publish: $anonymous + proxy: npmjs + '**': + access: $all + publish: $anonymous + proxy: npmjs diff --git a/scripts/simulate-publish.sh b/scripts/simulate-publish.sh new file mode 100755 index 0000000000..17409d33f6 --- /dev/null +++ b/scripts/simulate-publish.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +npm set registry https://registry.npmjs.org/ + +echo "====== Install verdaccio ===== " + +npm install -g verdaccio +npm install -g concurrently +npm install -g verdaccio-auth-memory + +echo "====== Update version ===== " + +$DIR/update-version.sh -nextalpha + +echo "====== Change registry ===== " + +npm set registry http://localhost:4873/ + +echo "====== Run verdaccio ===== " + +concurrently "verdaccio --listen 4873 --config $DIR/config/config-verdaccio.yaml" "$DIR/npm-publish.sh" diff --git a/scripts/start.sh b/scripts/start.sh index 16be00280e..f94a2f3a09 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -24,16 +24,16 @@ eval projects=( "@alfresco/core" show_help() { echo "Usage: start.sh" echo "" - echo "-ss or -skipstart build only the demo shell without start" - echo "-si or -skipinstall start the demo shell and skip the install the dependencies" - echo "-dev or -develop start the demo shell using the relative lib folder to link the components" - echo "-dist create the disbuild the demo shell in dist mode" - echo "-t or -test execute test" + echo "-ss or --skipstart build only the demo shell without start" + echo "-si or --skipinstall start the demo shell and skip the install the dependencies" + echo "-dev or --develop start the demo shell using the relative lib folder to link the components" + echo "-dist build or start the demo shell in dist mode" + echo "-t or --test execute test" echo "--e2e execute e2e test" - echo "-u or -update start the demo shell and update the dependencies" - echo "-c or -clean clean the demo shell and reinstall the dependencies" - echo "-r or -registry to download the packages from an alternative npm registry example -registry 'http://npm.local.me:8080/' " - echo "-v or -version install different version of ng2_components from npm defined in the package.json this option is not compatible with -d" + echo "-u or --update start the demo shell and update the dependencies" + echo "-c or --clean clean the demo shell and reinstall the dependencies" + echo "-r or --registry to download the packages from an alternative npm registry example -registry 'http://npm.local.me:8080/' " + echo "-v or --version install different version of ng2_components from npm defined in the package.json this option is not compatible with -d" echo "-gitjsapi to build all the components against a commit-ish version of the JS-API" echo "-vjsapi install different version from npm of JS-API defined in the package.json" } diff --git a/scripts/test-dist.sh b/scripts/test-dist.sh new file mode 100755 index 0000000000..c84a9b4e0b --- /dev/null +++ b/scripts/test-dist.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +echo "====== Install demo-shell ===== " + +cd $DIR/../demo-shell +npm install + +echo "====== Install lib ===== " + +cd $DIR/../lib +npm install + +echo "====== Install JS-API alpha ===== " + +npm install alfresco-js-api@alpha + +echo "====== Build ADF ===== " + +npm run new-build + +echo "====== COPY new build in demo shell node_modules ===== " + +rm -rf ../demo-shell/node_modules/@alfresco + +mkdir -p $DIR/../demo-shell/node_modules/@alfresco/adf-core +mkdir -p $DIR/../demo-shell/node_modules/@alfresco/adf-content-services +mkdir -p $DIR/../demo-shell/node_modules/@alfresco/adf-process-services +mkdir -p $DIR/../demo-shell/node_modules/@alfresco/adf-insights + +cp -R $DIR/../lib/dist/core/* $DIR/../demo-shell/node_modules/@alfresco/adf-core +cp -R $DIR/../lib/dist/content-services/* $DIR/../demo-shell/node_modules/@alfresco/adf-content-services +cp -R $DIR/../lib/dist/process-services/* $DIR/../demo-shell/node_modules/@alfresco/adf-process-services +cp -R $DIR/../lib/dist/insights/* $DIR/../demo-shell/node_modules/@alfresco/adf-insights + +echo "====== Build dist demo shell ===== " + +cd $DIR/../demo-shell +npm run build:dist + +echo "====== e2e test ===== " + +npm run e2e