From 7c30874f01bf795e2a3900df7037de307db22bca Mon Sep 17 00:00:00 2001 From: why520crazy Date: Tue, 10 Sep 2019 14:39:09 +0800 Subject: [PATCH 1/2] test(travis): add .travis.yml for test scriptt --- .travis.yml | 23 ++++++++++++++ packages/planet/karma.conf.js | 60 +++++++++++++++++++---------------- 2 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..29fd59c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +dist: trusty +sudo: false + +language: node_js +node_js: + - 10.16.0 + +addons: + apt: + sources: + - google-chrome + packages: + - google-chrome-stable + +cache: + directories: + - ./node_modules + +install: + - npm install + +script: + - npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI diff --git a/packages/planet/karma.conf.js b/packages/planet/karma.conf.js index 4c5f8d0..31d5b04 100644 --- a/packages/planet/karma.conf.js +++ b/packages/planet/karma.conf.js @@ -1,31 +1,37 @@ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); +module.exports = function(config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, '../../coverage'), + reports: ['html', 'lcovonly'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + customLaunchers: { + ChromeHeadlessCI: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'] + } + } + }); }; From 77f2418cec295cdc23ac5e0178cd0cd446bba50c Mon Sep 17 00:00:00 2001 From: why520crazy Date: Tue, 10 Sep 2019 14:42:05 +0800 Subject: [PATCH 2/2] docs(travis): add build status --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1efe3b2..98dfa06 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ -# ngx-planet +# ngx-planet [![Build Status](https://travis-ci.org/worktile/ngx-planet.svg?branch=master)](https://travis-ci.org/worktile/ngx-planet) + An Angular 7+ Micro Frontend library. ## Installation + ``` npm i @worktile/planet --save ``` @@ -13,6 +15,7 @@ npm i @worktile/planet --save ## Usage ### 1. Loading the module in the portal app module + ``` import { NgxPlanetModule } from '@worktile/planet'; @@ -24,7 +27,9 @@ import { NgxPlanetModule } from '@worktile/planet'; }) class AppModule {} ``` -### 2. Register Applications to planet use Planet Service in portal app + +### 2. Register Applications to planet use Planet Service in portal app + ``` @Component({ selector: 'app-portal-root', @@ -102,7 +107,9 @@ export class AppComponent implements OnInit { } } ``` + ### 3. Sub Apps define app to bootstrap app module + ``` defineApplication('app1', (portalApp: PlanetPortalApplication) => { return platformBrowserDynamic([ @@ -129,7 +136,7 @@ npm run serve:portal // 3000 npm run serve:app1 // 3001 npm run serve:app2 // 3002 -or +or npm start ```