diff --git a/.gitignore b/.gitignore index 9da9dabe526..de00da88e0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,24 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist -/doc -/tmp -/out-tsc +dist/ +doc/ +tmp/ +out-tsc/ +publish/ +integration/**/lib/ +integration/**/*.ngfactory.ts +integration/**/*.ngsummary.json - -/src/release # dependencies -/node_modules +node_modules/ +package-lock.json +integration/**/package-lock.json +yarn.lock # IDEs and editors -/.idea +.idea/ .project .classpath .c9/ diff --git a/.travis.yml b/.travis.yml index 94f31783748..42e1657b9de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,5 @@ before_script: script: - npm run test +- npm run integration - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls diff --git a/build.sh b/build.sh index f02f706939a..794c2c57260 100755 --- a/build.sh +++ b/build.sh @@ -2,8 +2,32 @@ readonly currentDir=$(cd $(dirname $0); pwd) cd ${currentDir} -rm -rf src/release +rm -rf publish cp -r src/components src/__gen_components node ./less.convert.js -cd src/__gen_components && ../../node_modules/@angular/compiler-cli/src/main.js -cd .. && rm -rf __gen_components + +echo 'Generating entry file using Angular compiler' +$(npm bin)/ngc -p tsconfig-build.json +rm -rf src/__gen_components + +echo 'Bundling to es module' +export ROLLUP_FORMAT=es +$(npm bin)/rollup -c rollup.config.js +rm -rf publish/src/*.js +rm -rf publish/src/**/*.js +sed -e "s/from '.\//from '.\/src\//g" publish/src/index.d.ts > publish/index.d.ts +sed -e "s/\":\".\//\":\".\/src\//g" publish/src/index.metadata.json > publish/index.metadata.json +rm publish/src/index.d.ts publish/src/index.metadata.json + +echo 'Transpiling es module to es5' +$(npm bin)/tsc --allowJs --importHelpers --target es5 --module es2015 --outDir publish/esm5 publish/esm15/index.js + +echo 'Bundling to umd module' +export ROLLUP_FORMAT=umd +$(npm bin)/rollup -c rollup.config.js + +echo 'Minifying umd module' +$(npm bin)/uglifyjs publish/bundles/ng-zorro-antd.umd.js --output publish/bundles/ng-zorro-antd.umd.min.js + +echo 'Copying package.json' +cp package.json publish/package.json diff --git a/integration-test.sh b/integration-test.sh new file mode 100644 index 00000000000..8fcb7c9bd6c --- /dev/null +++ b/integration-test.sh @@ -0,0 +1,9 @@ +for dir in ./integration/*/ +do + dir=${dir%*/} + name=${dir##*/} + echo "Integration test for $name" + cd $dir + npm run integration + cd ../.. +done diff --git a/integration/angular-cli/.angular-cli.json b/integration/angular-cli/.angular-cli.json new file mode 100644 index 00000000000..096567e9757 --- /dev/null +++ b/integration/angular-cli/.angular-cli.json @@ -0,0 +1,82 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "project": { + "name": "integration-test" + }, + "apps": [ + { + "root": "src", + "outDir": "dist", + "assets": [ + "assets", + "favicon.ico" + ], + "index": "index.html", + "main": "main.ts", + "polyfills": "polyfills.ts", + "test": "test.ts", + "tsconfig": "tsconfig.app.json", + "testTsconfig": "tsconfig.spec.json", + "prefix": "app", + "styles": [ + "styles.css" + ], + "scripts": [], + "environmentSource": "environments/environment.ts", + "environments": { + "dev": "environments/environment.ts", + "prod": "environments/environment.prod.ts" + } + } + ], + "e2e": { + "protractor": { + "config": "./protractor.conf.js" + } + }, + "lint": [ + { + "project": "src/tsconfig.app.json", + "exclude": "**/node_modules/**" + }, + { + "project": "src/tsconfig.spec.json", + "exclude": "**/node_modules/**" + }, + { + "project": "e2e/tsconfig.e2e.json", + "exclude": "**/node_modules/**" + } + ], + "test": { + "karma": { + "config": "./karma.conf.js" + } + }, + "defaults": { + "styleExt": "css", + "component": { + "spec": false, + "inlineStyle": true, + "inlineTemplate": true + }, + "directive": { + "spec": false + }, + "class": { + "spec": false + }, + "guard": { + "spec": false + }, + "module": { + "spec": false + }, + "pipe": { + "spec": false + }, + "service": { + "spec": false + } + } +} diff --git a/integration/angular-cli/package.json b/integration/angular-cli/package.json new file mode 100644 index 00000000000..b509e27c7c5 --- /dev/null +++ b/integration/angular-cli/package.json @@ -0,0 +1,40 @@ +{ + "name": "integration-test", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "setup": "mkdir -p lib/ng-zorro-antd && rsync -av --exclude=\".*\" ../../publish/ lib/ng-zorro-antd", + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "test": "echo \"Error: no test... minimal project\" && exit 1", + "lint": "echo \"Error: no lint... minimal project\" && exit 1", + "e2e": "echo \"Error: no e2e... minimal project\" && exit 1", + "preintegration": "npm run setup && npm install", + "integration": "ng build --prod --build-optimizer" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.2.4", + "@angular/cdk": "2.0.0-beta.8", + "@angular/common": "^4.2.4", + "@angular/compiler": "^4.2.4", + "@angular/core": "^4.2.4", + "@angular/forms": "^4.2.4", + "@angular/http": "^4.2.4", + "@angular/platform-browser": "^4.2.4", + "@angular/platform-browser-dynamic": "^4.2.4", + "@angular/router": "^4.2.4", + "core-js": "^2.4.1", + "moment": "^2.18.1", + "ng-zorro-antd": "file:lib/ng-zorro-antd", + "rxjs": "^5.4.2", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "@angular/cli": "1.3.2", + "@angular/compiler-cli": "^4.2.4", + "@angular/language-service": "^4.2.4", + "typescript": "~2.3.3" + } +} diff --git a/integration/angular-cli/src/app/app.component.ts b/integration/angular-cli/src/app/app.component.ts new file mode 100644 index 00000000000..e38cfcf8427 --- /dev/null +++ b/integration/angular-cli/src/app/app.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + template: ` + + `, + styles: [] +}) +export class AppComponent { + title = 'app'; +} diff --git a/integration/angular-cli/src/app/app.module.ts b/integration/angular-cli/src/app/app.module.ts new file mode 100644 index 00000000000..c1b454f9b66 --- /dev/null +++ b/integration/angular-cli/src/app/app.module.ts @@ -0,0 +1,18 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { NgZorroAntdModule } from 'ng-zorro-antd'; + +import { AppComponent } from './app.component'; + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + NgZorroAntdModule.forRoot(), + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/integration/angular-cli/src/assets/.gitkeep b/integration/angular-cli/src/assets/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/integration/angular-cli/src/environments/environment.prod.ts b/integration/angular-cli/src/environments/environment.prod.ts new file mode 100644 index 00000000000..3612073bc31 --- /dev/null +++ b/integration/angular-cli/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/integration/angular-cli/src/environments/environment.ts b/integration/angular-cli/src/environments/environment.ts new file mode 100644 index 00000000000..b7f639aecac --- /dev/null +++ b/integration/angular-cli/src/environments/environment.ts @@ -0,0 +1,8 @@ +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/integration/angular-cli/src/index.html b/integration/angular-cli/src/index.html new file mode 100644 index 00000000000..0e26191568b --- /dev/null +++ b/integration/angular-cli/src/index.html @@ -0,0 +1,13 @@ + + + + + IntegrationTest + + + + + + + + diff --git a/integration/angular-cli/src/main.ts b/integration/angular-cli/src/main.ts new file mode 100644 index 00000000000..a9ca1caf8ce --- /dev/null +++ b/integration/angular-cli/src/main.ts @@ -0,0 +1,11 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/integration/angular-cli/src/polyfills.ts b/integration/angular-cli/src/polyfills.ts new file mode 100644 index 00000000000..7831e97b79a --- /dev/null +++ b/integration/angular-cli/src/polyfills.ts @@ -0,0 +1,72 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** 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'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +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`. + + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ +// import 'intl/locale-data/jsonp/en'; diff --git a/integration/angular-cli/src/styles.css b/integration/angular-cli/src/styles.css new file mode 100644 index 00000000000..90d4ee0072c --- /dev/null +++ b/integration/angular-cli/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/integration/angular-cli/src/tsconfig.app.json b/integration/angular-cli/src/tsconfig.app.json new file mode 100644 index 00000000000..39ba8dbacbb --- /dev/null +++ b/integration/angular-cli/src/tsconfig.app.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "baseUrl": "./", + "module": "es2015", + "types": [] + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/integration/angular-cli/src/typings.d.ts b/integration/angular-cli/src/typings.d.ts new file mode 100644 index 00000000000..ef5c7bd6205 --- /dev/null +++ b/integration/angular-cli/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/integration/angular-cli/tsconfig.json b/integration/angular-cli/tsconfig.json new file mode 100644 index 00000000000..a6c016bf38a --- /dev/null +++ b/integration/angular-cli/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ] + } +} diff --git a/integration/rollup/package.json b/integration/rollup/package.json new file mode 100644 index 00000000000..39f2685ac0f --- /dev/null +++ b/integration/rollup/package.json @@ -0,0 +1,52 @@ +{ + "name": "integration-test", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "setup": "mkdir -p lib/ng-zorro-antd && rsync -av --exclude=\".*\" ../../publish/ lib/ng-zorro-antd", + "clean": "rimraf out-tsc src/node_modules src/**/*.ngfactory.ts src/**/*.ngsummary.json", + "prestart": "npm run build", + "start": "http-server dist", + "prebuild": "npm run ngc", + "build": "rollup -c rollup.config.js", + "postbuild": "cp src/index.html dist/index.html && cp node_modules/core-js/client/shim.js dist/polyfills.js && cp node_modules/zone.js/dist/zone.js dist/zone.js", + "test": "echo \"Error: no test... minimal project\" && exit 1", + "lint": "echo \"Error: no lint... minimal project\" && exit 1", + "e2e": "echo \"Error: no e2e... minimal project\" && exit 1", + "prengc": "npm run clean", + "ngc": "ngc -p src/tsconfig.app.json", + "preintegration": "npm run setup && npm install", + "integration": "npm run build" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.2.4", + "@angular/cdk": "2.0.0-beta.8", + "@angular/common": "^4.2.4", + "@angular/compiler": "^4.2.4", + "@angular/core": "^4.2.4", + "@angular/forms": "^4.2.4", + "@angular/http": "^4.2.4", + "@angular/platform-browser": "^4.2.4", + "@angular/platform-browser-dynamic": "^4.2.4", + "@angular/router": "^4.2.4", + "core-js": "^2.4.1", + "moment": "^2.18.1", + "ng-zorro-antd": "file:lib/ng-zorro-antd", + "rxjs": "^5.4.2", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "@angular/cli": "1.3.2", + "@angular/compiler-cli": "^4.2.4", + "@angular/language-service": "^4.2.4", + "http-server": "^0.10.0", + "rimraf": "^2.6.1", + "rollup": "^0.49.2", + "rollup-plugin-angular-optimizer": "^0.1.0", + "rollup-plugin-commonjs": "^8.2.0", + "rollup-plugin-node-resolve": "^3.0.0", + "rollup-plugin-uglify": "^2.0.1", + "typescript": "~2.3.3" + } +} diff --git a/integration/rollup/rollup.config.js b/integration/rollup/rollup.config.js new file mode 100644 index 00000000000..195d9c0a75b --- /dev/null +++ b/integration/rollup/rollup.config.js @@ -0,0 +1,33 @@ +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' +import uglify from 'rollup-plugin-uglify' +import angularOptimizer from 'rollup-plugin-angular-optimizer' + +function enableProdMode() { + return { + name: 'enable-prod-mode', + transform(content, id) { + if (!id.includes('main.js')) { return } + + return content + .replace(/platformBrowserDynamic/g, `platformBrowser`) + .replace(/bootstrapModule/g, `bootstrapModuleFactory`) + .replace(/AppModule/g, `AppModuleNgFactory`) + .replace(`from '@angular/platform-browser-dynamic'`, `from '@angular/platform-browser'`) + .replace(`from './environments/environment'`, `from './environments/environment.prod'`) + .replace(`from './app/app.module'`, `from './app/app.module.ngfactory'`) + }, + } +} + + +export default { + input: './out-tsc/app/main.js', + output: { + file: './dist/main.bundle.js', + format: 'iife', + }, + globals: {}, + externals: [], + plugins: [enableProdMode(), resolve(), angularOptimizer(), commonjs(), uglify()], +} diff --git a/integration/rollup/src/app/app.component.ts b/integration/rollup/src/app/app.component.ts new file mode 100644 index 00000000000..e38cfcf8427 --- /dev/null +++ b/integration/rollup/src/app/app.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + template: ` + + `, + styles: [] +}) +export class AppComponent { + title = 'app'; +} diff --git a/integration/rollup/src/app/app.module.ts b/integration/rollup/src/app/app.module.ts new file mode 100644 index 00000000000..c1b454f9b66 --- /dev/null +++ b/integration/rollup/src/app/app.module.ts @@ -0,0 +1,18 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { NgZorroAntdModule } from 'ng-zorro-antd'; + +import { AppComponent } from './app.component'; + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + NgZorroAntdModule.forRoot(), + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/integration/rollup/src/assets/.gitkeep b/integration/rollup/src/assets/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/integration/rollup/src/environments/environment.prod.ts b/integration/rollup/src/environments/environment.prod.ts new file mode 100644 index 00000000000..3612073bc31 --- /dev/null +++ b/integration/rollup/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/integration/rollup/src/environments/environment.ts b/integration/rollup/src/environments/environment.ts new file mode 100644 index 00000000000..b7f639aecac --- /dev/null +++ b/integration/rollup/src/environments/environment.ts @@ -0,0 +1,8 @@ +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/integration/rollup/src/index.html b/integration/rollup/src/index.html new file mode 100644 index 00000000000..3e8d9a0b215 --- /dev/null +++ b/integration/rollup/src/index.html @@ -0,0 +1,16 @@ + + + + + IntegrationTest + + + + + + + + + + + diff --git a/integration/rollup/src/main.ts b/integration/rollup/src/main.ts new file mode 100644 index 00000000000..a9ca1caf8ce --- /dev/null +++ b/integration/rollup/src/main.ts @@ -0,0 +1,11 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/integration/rollup/src/polyfills.ts b/integration/rollup/src/polyfills.ts new file mode 100644 index 00000000000..7831e97b79a --- /dev/null +++ b/integration/rollup/src/polyfills.ts @@ -0,0 +1,72 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** 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'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +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`. + + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ +// import 'intl/locale-data/jsonp/en'; diff --git a/integration/rollup/src/styles.css b/integration/rollup/src/styles.css new file mode 100644 index 00000000000..90d4ee0072c --- /dev/null +++ b/integration/rollup/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/integration/rollup/src/tsconfig.app.json b/integration/rollup/src/tsconfig.app.json new file mode 100644 index 00000000000..286c4475eca --- /dev/null +++ b/integration/rollup/src/tsconfig.app.json @@ -0,0 +1,17 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "baseUrl": "./", + "module": "es2015", + "types": [] + }, + "angularCompilerOptions": { + "strictMetadataEmit": true, + "alwaysCompileGeneratedCode": true + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/integration/rollup/src/typings.d.ts b/integration/rollup/src/typings.d.ts new file mode 100644 index 00000000000..ef5c7bd6205 --- /dev/null +++ b/integration/rollup/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/integration/rollup/tsconfig.json b/integration/rollup/tsconfig.json new file mode 100644 index 00000000000..a6c016bf38a --- /dev/null +++ b/integration/rollup/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ] + } +} diff --git a/integration/webpack/package.json b/integration/webpack/package.json new file mode 100644 index 00000000000..503fc2b14e4 --- /dev/null +++ b/integration/webpack/package.json @@ -0,0 +1,45 @@ +{ + "name": "integration-test", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "setup": "mkdir -p lib/ng-zorro-antd && rsync -av --exclude=\".*\" ../../publish/ lib/ng-zorro-antd", + "start": "webpack-dev-server", + "build": "webpack", + "test": "echo \"Error: no test... minimal project\" && exit 1", + "lint": "echo \"Error: no lint... minimal project\" && exit 1", + "e2e": "echo \"Error: no e2e... minimal project\" && exit 1", + "preintegration": "npm run setup && npm install", + "integration": "npm run build" + }, + "private": true, + "dependencies": { + "@angular/animations": "^4.2.4", + "@angular/cdk": "2.0.0-beta.8", + "@angular/common": "^4.2.4", + "@angular/compiler": "^4.2.4", + "@angular/core": "^4.2.4", + "@angular/forms": "^4.2.4", + "@angular/http": "^4.2.4", + "@angular/platform-browser": "^4.2.4", + "@angular/platform-browser-dynamic": "^4.2.4", + "@angular/router": "^4.2.4", + "core-js": "^2.4.1", + "moment": "^2.18.1", + "ng-zorro-antd": "file:lib/ng-zorro-antd", + "rxjs": "^5.4.2", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "@angular-devkit/build-optimizer": "0.0.18", + "@angular/cli": "1.3.2", + "@angular/compiler-cli": "^4.2.4", + "@angular/language-service": "^4.2.4", + "@ngtools/webpack": "^1.6.2", + "html-webpack-plugin": "^2.30.1", + "typescript": "~2.3.3", + "uglifyjs-webpack-plugin": "^0.4.6", + "webpack": "^3.5.6", + "webpack-dev-server": "^2.7.1" + } +} diff --git a/integration/webpack/src/app/app.component.ts b/integration/webpack/src/app/app.component.ts new file mode 100644 index 00000000000..e38cfcf8427 --- /dev/null +++ b/integration/webpack/src/app/app.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + template: ` + + `, + styles: [] +}) +export class AppComponent { + title = 'app'; +} diff --git a/integration/webpack/src/app/app.module.ts b/integration/webpack/src/app/app.module.ts new file mode 100644 index 00000000000..c1b454f9b66 --- /dev/null +++ b/integration/webpack/src/app/app.module.ts @@ -0,0 +1,18 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { NgZorroAntdModule } from 'ng-zorro-antd'; + +import { AppComponent } from './app.component'; + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + NgZorroAntdModule.forRoot(), + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/integration/webpack/src/assets/.gitkeep b/integration/webpack/src/assets/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/integration/webpack/src/environments/environment.prod.ts b/integration/webpack/src/environments/environment.prod.ts new file mode 100644 index 00000000000..3612073bc31 --- /dev/null +++ b/integration/webpack/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/integration/webpack/src/environments/environment.ts b/integration/webpack/src/environments/environment.ts new file mode 100644 index 00000000000..b7f639aecac --- /dev/null +++ b/integration/webpack/src/environments/environment.ts @@ -0,0 +1,8 @@ +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/integration/webpack/src/index.html b/integration/webpack/src/index.html new file mode 100644 index 00000000000..0e26191568b --- /dev/null +++ b/integration/webpack/src/index.html @@ -0,0 +1,13 @@ + + + + + IntegrationTest + + + + + + + + diff --git a/integration/webpack/src/main.ts b/integration/webpack/src/main.ts new file mode 100644 index 00000000000..a9ca1caf8ce --- /dev/null +++ b/integration/webpack/src/main.ts @@ -0,0 +1,11 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/integration/webpack/src/polyfills.ts b/integration/webpack/src/polyfills.ts new file mode 100644 index 00000000000..7831e97b79a --- /dev/null +++ b/integration/webpack/src/polyfills.ts @@ -0,0 +1,72 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** 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'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +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`. + + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ +// import 'intl/locale-data/jsonp/en'; diff --git a/integration/webpack/src/styles.css b/integration/webpack/src/styles.css new file mode 100644 index 00000000000..90d4ee0072c --- /dev/null +++ b/integration/webpack/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/integration/webpack/src/tsconfig.app.json b/integration/webpack/src/tsconfig.app.json new file mode 100644 index 00000000000..286c4475eca --- /dev/null +++ b/integration/webpack/src/tsconfig.app.json @@ -0,0 +1,17 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "baseUrl": "./", + "module": "es2015", + "types": [] + }, + "angularCompilerOptions": { + "strictMetadataEmit": true, + "alwaysCompileGeneratedCode": true + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/integration/webpack/src/typings.d.ts b/integration/webpack/src/typings.d.ts new file mode 100644 index 00000000000..ef5c7bd6205 --- /dev/null +++ b/integration/webpack/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/integration/webpack/tsconfig.json b/integration/webpack/tsconfig.json new file mode 100644 index 00000000000..a6c016bf38a --- /dev/null +++ b/integration/webpack/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ] + } +} diff --git a/integration/webpack/webpack.config.js b/integration/webpack/webpack.config.js new file mode 100644 index 00000000000..d9eb9a07009 --- /dev/null +++ b/integration/webpack/webpack.config.js @@ -0,0 +1,63 @@ +const path = require('path') +const HtmlWebpackPlugin = require('html-webpack-plugin') +const UglifyJSPlugin = require('uglifyjs-webpack-plugin') +const { AotPlugin } = require('@ngtools/webpack') +const { PurifyPlugin } = require('@angular-devkit/build-optimizer') + +function packageSort(packages) { + return function sort(left, right) { + const leftIndex = packages.indexOf(left.names[0]) + const rightindex = packages.indexOf(right.names[0]) + + if (leftIndex < 0 || rightindex < 0) { + throw "unknown package" + } + + if (leftIndex > rightindex){ + return 1 + } + + return -1 + } +} + +module.exports = { + entry: { + main: './src/main.ts', + polyfills: './src/polyfills.ts', + }, + output: { + filename: '[name].bundle.js', + path: path.resolve(__dirname, 'dist') + }, + module: { + rules: [ + { + test: /\.ts$/, + loader: '@ngtools/webpack', + }, + { + test: /\.js$/, + loader: '@angular-devkit/build-optimizer/webpack-loader', + options: { + sourceMap: false + } + }, + ] + }, + resolve: { + extensions: ['.js', '.ts'], + }, + plugins: [ + new AotPlugin({ + tsConfigPath: path.resolve(__dirname, 'src/tsconfig.app.json'), + entryModule: path.resolve(__dirname, 'src/app/app.module#AppModule'), + }), + new PurifyPlugin(), + new UglifyJSPlugin(), + new HtmlWebpackPlugin({ + template: path.resolve(__dirname, 'src/index.html'), + chunksSortMode: packageSort(['polyfills', 'main']), + }), + ], +} diff --git a/package.json b/package.json index cd6cc756857..6f3066de1c0 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,16 @@ "start": "ng serve", "build": "ng build --prod", "doc": "ng build --prod", - "release": "./build.sh && ng build --prod", + "generate": "bash ./build.sh", + "release": "npm run generate && ng build --prod", "test": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng test --single-run --code-coverage", + "integration": "npm run generate && bash ./integration-test.sh", "lint": "ng lint", "e2e": "ng e2e" }, - "main": "./index.ts", + "main": "./bundles/ng-zorro-antd.umd.js", + "module": "./esm5/index.js", + "es2015": "./esm15/index.js", "keywords": [ "ant", "design", @@ -31,22 +35,21 @@ "url": "https://github.com/NG-ZORRO/ng-zorro-antd/issues" }, "dependencies": { + "@angular/cdk": "2.0.0-beta.8", "moment": "^2.18.1", - "@angular/cdk": "2.0.0-beta.8" + "tslib": "^1.7.1" }, "devDependencies": { - "@angular/common": "^4.0.0", "@angular/animations": "^4.0.0", - "@angular/core": "^4.0.0", - "@angular/forms": "^4.0.0", - "@angular/platform-browser": "^4.0.0", - "rxjs": "^5.0.1", - "zone.js": "^0.8.14", "@angular/cli": "1.3.0", + "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/compiler-cli": "^4.0.0", + "@angular/core": "^4.0.0", + "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/language-service": "^4.0.0", + "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "@types/jasmine": "~2.5.53", @@ -68,17 +71,22 @@ "karma-jasmine-html-reporter": "^0.2.2", "marked": "^0.3.6", "protractor": "~5.1.2", + "rollup": "^0.49.2", + "rollup-plugin-node-resolve": "^3.0.0", + "rxjs": "^5.0.1", "ts-node": "~3.2.0", "tslint": "~5.3.2", "typescript": "~2.3.3", - "web-animations-js": "^2.3.1" + "uglify-js": "^3.0.28", + "web-animations-js": "^2.3.1", + "zone.js": "^0.8.14" }, "peerDependencies": { - "moment": "^2.18.1", - "@angular/cdk": "^2.0.0-beta.8", "@angular/animations": "^4.0.0", - "@angular/core": "^4.0.0", + "@angular/cdk": "^2.0.0-beta.8", "@angular/common": "^4.0.0", - "@angular/forms": "^4.0.0" + "@angular/core": "^4.0.0", + "@angular/forms": "^4.0.0", + "moment": "^2.18.1" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000000..9a030640fe8 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,87 @@ +import resolve from 'rollup-plugin-node-resolve' + +const format = process.env.ROLLUP_FORMAT || 'es' + +let globals = { + '@angular/animations': 'ng.animations', + '@angular/cdk': 'ng.cdk', + '@angular/core': 'ng.core', + '@angular/common': 'ng.common', + '@angular/compiler': 'ng.compiler', + '@angular/forms': 'ng.forms', + '@angular/platform-browser': 'ng.platformBrowser', + 'moment': 'moment', + 'moment/locale/zh-cn': null, + 'rxjs/BehaviorSubject': 'Rx', + 'rxjs/Observable': 'Rx', + 'rxjs/Subject': 'Rx', + 'rxjs/Subscription': 'Rx', + 'rxjs/observable/fromPromise': 'Rx.Observable', + 'rxjs/observable/forkJoin': 'Rx.Observable', + 'rxjs/observable/fromEvent': 'Rx.Observable', + 'rxjs/observable/merge': 'Rx.Observable', + 'rxjs/observable/of': 'Rx.Observable', + 'rxjs/operator/auditTime': 'Rx.Observable.prototype', + 'rxjs/operator/catch': 'Rx.Observable.prototype', + 'rxjs/operator/debounceTime': 'Rx.Observable.prototype', + 'rxjs/operator/distinctUntilChanged': 'Rx.Observable.prototype', + 'rxjs/operator/do': 'Rx.Observable.prototype', + 'rxjs/operator/filter': 'Rx.Observable.prototype', + 'rxjs/operator/finally': 'Rx.Observable.prototype', + 'rxjs/operator/first': 'Rx.Observable.prototype', + 'rxjs/operator/map': 'Rx.Observable.prototype', + 'rxjs/operator/pluck': 'Rx.Observable.prototype', + 'rxjs/operator/startWith': 'Rx.Observable.prototype', + 'rxjs/operator/switchMap': 'Rx.Observable.prototype', + 'rxjs/operator/takeUntil': 'Rx.Observable.prototype', + 'rxjs/operator/throttleTime': 'Rx.Observable.prototype', +} + +if (format === 'es') { + globals = Object.assign(globals, { + 'tslib': 'tslib', + }) +} + +function fixMoment() { + return { + name: 'fix-moment-import', + transform(content) { + if (!content.includes(`import * as moment from 'moment'`)) { return } + + return content.replace( + `import * as moment from 'moment'`, + `import moment from 'moment'` + ) + }, + } +} + +let input +let file + +switch (format) { + case 'es': + input = './publish/src/index.js' + file = './publish/esm15/index.js' + break + case 'umd': + input = './publish/esm5/index.js' + file = './publish/bundles/ng-zorro-antd.umd.js' + break + default: + throw new Error(`format ${format} is not supported`) +} + +export default { + input, + output: { + file, + format, + }, + exports: 'named', + name: 'ngZorro.antd', + plugins: [fixMoment(), resolve()], + external: Object.keys(globals), + globals, +} diff --git a/src/components/cascader/nz-cascader.component.ts b/src/components/cascader/nz-cascader.component.ts index 4ab1f907f3f..0108c00be98 100644 --- a/src/components/cascader/nz-cascader.component.ts +++ b/src/components/cascader/nz-cascader.component.ts @@ -31,7 +31,7 @@ import { const ESC = 27; import { DropDownAnimation } from '../core/animation/dropdown-animations'; -import { ConnectionPositionPair } from '../core/overlay'; +import { ConnectionPositionPair } from '../core/overlay/index'; function noop(): void { } diff --git a/src/components/cascader/nz-cascader.module.ts b/src/components/cascader/nz-cascader.module.ts index 36d7b364512..75ab659793b 100644 --- a/src/components/cascader/nz-cascader.module.ts +++ b/src/components/cascader/nz-cascader.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { NzCascaderComponent } from './nz-cascader.component'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; import { NzInputModule } from '../input/nz-input.module'; @NgModule({ diff --git a/src/components/core/floater/floater-props.ts b/src/components/core/floater/floater-props.ts index 6f320461f25..1ea786f8070 100644 --- a/src/components/core/floater/floater-props.ts +++ b/src/components/core/floater/floater-props.ts @@ -14,7 +14,7 @@ import { PositionStrategy, ConnectedOverlayPositionChange, ScrollStrategy -} from '../overlay'; +} from '../overlay/index'; import { ComponentType, Directionality } from '@angular/cdk'; import { Subscription } from 'rxjs/Subscription'; diff --git a/src/components/core/floater/floater.service.ts b/src/components/core/floater/floater.service.ts index d4c74c43e68..6bcbe135d34 100644 --- a/src/components/core/floater/floater.service.ts +++ b/src/components/core/floater/floater.service.ts @@ -20,7 +20,7 @@ import { PositionStrategyOptions, PositionStrategyType, } from './floater-props'; -import { Overlay } from '../overlay'; +import { Overlay } from '../overlay/index'; Injectable() diff --git a/src/components/core/floater/floater.ts b/src/components/core/floater/floater.ts index 46111f8f914..281eada711e 100644 --- a/src/components/core/floater/floater.ts +++ b/src/components/core/floater/floater.ts @@ -6,7 +6,7 @@ import { OverlayOrigin, ConnectedPositionStrategy, PositionStrategy -} from '../overlay'; +} from '../overlay/index'; import { TemplatePortal, ComponentPortal, diff --git a/src/components/core/floater/index.ts b/src/components/core/floater/index.ts index e77c9381b43..97c37d26da7 100644 --- a/src/components/core/floater/index.ts +++ b/src/components/core/floater/index.ts @@ -1,5 +1,5 @@ import { NgModule, Provider } from '@angular/core'; -import { OverlayModule } from '../overlay'; +import { OverlayModule } from '../overlay/index'; import { FLOATER_SERVICE_PROVIDER } from './floater.service'; const providers: Provider[] = [ diff --git a/src/components/datepicker/nz-datepicker.component.ts b/src/components/datepicker/nz-datepicker.component.ts index ae02bb5afeb..093eb8d5ed2 100644 --- a/src/components/datepicker/nz-datepicker.component.ts +++ b/src/components/datepicker/nz-datepicker.component.ts @@ -13,7 +13,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { DropDownAnimation } from '../core/animation/dropdown-animations'; import { NzTimePickerInnerComponent } from '../time-picker/nz-timepicker-inner.component'; import { DEFAULT_DATEPICKER_POSITIONS } from '../core/overlay/overlay-position-map'; -import { ConnectionPositionPair } from '../core/overlay'; +import { ConnectionPositionPair } from '../core/overlay/index'; @Component({ selector : 'nz-datepicker', diff --git a/src/components/datepicker/nz-datepicker.module.ts b/src/components/datepicker/nz-datepicker.module.ts index 71204e33dd6..c9bc29ec791 100644 --- a/src/components/datepicker/nz-datepicker.module.ts +++ b/src/components/datepicker/nz-datepicker.module.ts @@ -6,7 +6,7 @@ import { NzTimePickerModule } from '../time-picker/nz-timepicker.module'; import { NzUtilModule } from '../util/nz-util.module'; import { NzCalendarModule } from '../calendar/nz-calendar.module'; import { FormsModule } from '@angular/forms'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; @NgModule({ imports : [ CommonModule, NzTimePickerModule, NzUtilModule, NzInputModule, NzCalendarModule, FormsModule, OverlayModule ], diff --git a/src/components/dropdown/nz-dropdown.component.ts b/src/components/dropdown/nz-dropdown.component.ts index 3345d07db23..00d6f659af2 100644 --- a/src/components/dropdown/nz-dropdown.component.ts +++ b/src/components/dropdown/nz-dropdown.component.ts @@ -21,7 +21,7 @@ import { NzMenuComponent } from '../menu/nz-menu.component'; import { DropDownAnimation } from '../core/animation/dropdown-animations'; import { NzDropDownDirective } from './nz-dropdown.directive'; import { POSITION_MAP, DEFAULT_DROPDOWN_POSITIONS } from '../core/overlay/overlay-position-map'; -import { ConnectionPositionPair } from '../core/overlay'; +import { ConnectionPositionPair } from '../core/overlay/index'; export type NzPlacement = 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'; diff --git a/src/components/dropdown/nz-dropdown.module.ts b/src/components/dropdown/nz-dropdown.module.ts index 0293edd1589..e975a629cad 100644 --- a/src/components/dropdown/nz-dropdown.module.ts +++ b/src/components/dropdown/nz-dropdown.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; import { NzButtonModule } from '../button/nz-button.module'; import { NzDropDownComponent } from './nz-dropdown.component'; diff --git a/src/components/message/nz-message.module.ts b/src/components/message/nz-message.module.ts index 7c57169f77f..7fcc18d8281 100644 --- a/src/components/message/nz-message.module.ts +++ b/src/components/message/nz-message.module.ts @@ -3,7 +3,7 @@ import { NZ_MESSAGE_DEFAULT_CONFIG_PROVIDER } from './nz-message-config'; import { NzMessageContainerComponent } from './nz-message-container.component'; import { NzMessageComponent } from './nz-message.component'; import { CommonModule } from '@angular/common'; -import { FloaterModule } from '../core/floater'; +import { FloaterModule } from '../core/floater/index'; const providers = [ NZ_MESSAGE_DEFAULT_CONFIG_PROVIDER diff --git a/src/components/message/nz-message.service.ts b/src/components/message/nz-message.service.ts index 1501f9470fe..46c2323b054 100644 --- a/src/components/message/nz-message.service.ts +++ b/src/components/message/nz-message.service.ts @@ -1,5 +1,5 @@ import { Injectable, ComponentRef, Type } from '@angular/core'; -import { FloaterService } from '../core/floater'; +import { FloaterService } from '../core/floater/index'; import { NzMessageConfig } from './nz-message-config'; import { NzMessageData, NzMessageDataFilled, NzMessageDataOptions } from './nz-message.definitions'; import { NzMessageContainerComponent } from './nz-message-container.component'; diff --git a/src/components/notification/nz-notification.module.ts b/src/components/notification/nz-notification.module.ts index 032ca214b00..4b6e6883b1b 100644 --- a/src/components/notification/nz-notification.module.ts +++ b/src/components/notification/nz-notification.module.ts @@ -3,7 +3,7 @@ import { NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER } from './nz-notification-confi import { NzNotificationContainerComponent } from './nz-notification-container.component'; import { NzNotificationComponent } from './nz-notification.component'; import { CommonModule } from '@angular/common'; -import { FloaterModule } from '../core/floater'; +import { FloaterModule } from '../core/floater/index'; const providers = [ NZ_NOTIFICATION_DEFAULT_CONFIG_PROVIDER diff --git a/src/components/notification/nz-notification.service.ts b/src/components/notification/nz-notification.service.ts index 422a90e059f..8df04200d0e 100644 --- a/src/components/notification/nz-notification.service.ts +++ b/src/components/notification/nz-notification.service.ts @@ -1,5 +1,5 @@ import { Injectable, EventEmitter } from '@angular/core'; -import { FloaterService } from '../core/floater'; +import { FloaterService } from '../core/floater/index'; import { NzNotificationData, NzNotificationDataFilled } from './nz-notification.definitions'; import { NzMessageBaseService } from '../message/nz-message.service'; import { NzMessageDataOptions } from '../message/nz-message.definitions'; diff --git a/src/components/popconfirm/nz-popconfirm.module.ts b/src/components/popconfirm/nz-popconfirm.module.ts index f5ee782e05e..7a522a60c69 100644 --- a/src/components/popconfirm/nz-popconfirm.module.ts +++ b/src/components/popconfirm/nz-popconfirm.module.ts @@ -3,7 +3,7 @@ import { NzPopconfirmComponent } from './nz-popconfirm.component'; import { NzPopconfirmDirective } from './nz-popconfirm.directive'; import { CommonModule } from '@angular/common'; import { NzButtonModule } from '../button/nz-button.module'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; @NgModule({ diff --git a/src/components/popover/nz-popover.module.ts b/src/components/popover/nz-popover.module.ts index 9b870fe3142..77c70a5edc0 100644 --- a/src/components/popover/nz-popover.module.ts +++ b/src/components/popover/nz-popover.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { NzPopoverDirective } from './nz-popover.directive'; import { NzPopoverComponent } from './nz-popover.component'; import { CommonModule } from '@angular/common'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; @NgModule({ entryComponents: [ NzPopoverComponent ], diff --git a/src/components/select/nz-select.module.ts b/src/components/select/nz-select.module.ts index 1e0006286b1..75ac936cceb 100644 --- a/src/components/select/nz-select.module.ts +++ b/src/components/select/nz-select.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; import { NzSelectComponent } from './nz-select.component'; import { NzOptionComponent } from './nz-option.component'; import { NzOptionPipe } from './nz-option.pipe'; diff --git a/src/components/time-picker/nz-timepicker.component.ts b/src/components/time-picker/nz-timepicker.component.ts index df09a8df981..4f415a96468 100644 --- a/src/components/time-picker/nz-timepicker.component.ts +++ b/src/components/time-picker/nz-timepicker.component.ts @@ -10,7 +10,7 @@ import * as moment from 'moment'; import { DropDownAnimation } from '../core/animation/dropdown-animations'; import { NzTimePickerInnerComponent } from './nz-timepicker-inner.component'; import { DEFAULT_DATEPICKER_POSITIONS } from '../core/overlay/overlay-position-map'; -import { ConnectionPositionPair } from '../core/overlay'; +import { ConnectionPositionPair } from '../core/overlay/index'; @Component({ selector : 'nz-timepicker', diff --git a/src/components/time-picker/nz-timepicker.module.ts b/src/components/time-picker/nz-timepicker.module.ts index 09ec0f4e107..472cc1a7088 100644 --- a/src/components/time-picker/nz-timepicker.module.ts +++ b/src/components/time-picker/nz-timepicker.module.ts @@ -3,7 +3,7 @@ import { NzTimePickerComponent } from './nz-timepicker.component'; import { NzTimePickerInnerComponent } from './nz-timepicker-inner.component'; import { CommonModule } from '@angular/common'; import { NzUtilModule } from '../util/nz-util.module'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; @NgModule({ imports : [ CommonModule, NzUtilModule, OverlayModule ], diff --git a/src/components/tooltip/nz-tooltip.component.ts b/src/components/tooltip/nz-tooltip.component.ts index e039a718504..0f1e7dfa89c 100644 --- a/src/components/tooltip/nz-tooltip.component.ts +++ b/src/components/tooltip/nz-tooltip.component.ts @@ -21,7 +21,7 @@ import { FadeAnimation } from '../core/animation/fade-animations'; import { ConnectionPositionPair, ConnectedOverlayDirective -} from '../core/overlay'; +} from '../core/overlay/index'; import { POSITION_MAP, DEFAULT_4_POSITIONS } from '../core/overlay/overlay-position-map'; @Component({ diff --git a/src/components/tooltip/nz-tooltip.module.ts b/src/components/tooltip/nz-tooltip.module.ts index 7256f84bc6c..7a177aa6221 100644 --- a/src/components/tooltip/nz-tooltip.module.ts +++ b/src/components/tooltip/nz-tooltip.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { NzToolTipComponent } from './nz-tooltip.component'; import { NzTooltipDirective } from './nz-tooltip.directive'; import { CommonModule } from '@angular/common'; -import { OverlayModule } from '../core/overlay'; +import { OverlayModule } from '../core/overlay/index'; @NgModule({ declarations : [ NzToolTipComponent, NzTooltipDirective ], exports : [ NzToolTipComponent, NzTooltipDirective ], diff --git a/tsconfig-build.json b/tsconfig-build.json new file mode 100644 index 00000000000..d830dbd8b9b --- /dev/null +++ b/tsconfig-build.json @@ -0,0 +1,25 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./publish/src", + "baseUrl": "./", + "declaration": true, + "importHelpers": true, + "module": "es2015", + "sourceMap": false, + "target": "es2015", + "types": [ + "node" + ] + }, + "files": [ + "./src/__gen_components/ng-zorro-antd.module.ts" + ], + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "strictMetadataEmit": true, + "flatModuleOutFile": "index.js", + "flatModuleId": "ng-zorro-antd", + "skipTemplateCodegen": true + } +}