Skip to content

Commit

Permalink
revert: "build: use ng-packagr to generate library (NG-ZORRO#1747)" (N…
Browse files Browse the repository at this point in the history
…G-ZORRO#1865)

revert: "build: use ng-packagr to generate library (NG-ZORRO#1747)"
  • Loading branch information
vthinkxie authored and wenqi73 committed Aug 27, 2018
1 parent 6279f4d commit 0e1d921
Show file tree
Hide file tree
Showing 20 changed files with 122 additions and 126 deletions.
14 changes: 0 additions & 14 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,6 @@
"root": "",
"sourceRoot": "",
"projectType": "application"
},
"ng-zorro-antd-lib": {
"root": "components",
"projectType": "library",
"prefix": "nz",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "components/tsconfig.lib.json",
"project": "components/ng-package.json"
}
}
}
}
},
"defaultProject": "ng-zorro-antd-doc",
Expand Down
59 changes: 59 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

readonly currentDir=$(cd $(dirname $0); pwd)
cd ${currentDir}
rm -rf publish
rm -rf __gen_components
rm -rf publish-es2015
cp -r components __gen_components
node ./build_scripts/inline-template.js

echo 'Compiling to es2015 via Angular compiler'
$(npm bin)/ngc -p tsconfig-build.json -t es2015 --outDir publish-es2015/src

echo 'Bundling to es module of es2015'
export ROLLUP_TARGET=esm
$(npm bin)/rollup -c rollup.config.js -f es -i publish-es2015/src/index.js -o publish-es2015/esm2015/antd.js

echo 'Compiling to es5 via Angular compiler'
$(npm bin)/ngc -p tsconfig-build.json -t es5 --outDir publish-es5/src

echo 'Bundling to es module of es5'
export ROLLUP_TARGET=esm
$(npm bin)/rollup -c rollup.config.js -f es -i publish-es5/src/index.js -o publish-es5/esm5/antd.js

echo 'Bundling to umd module of es5'
export ROLLUP_TARGET=umd
$(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/antd.js -o publish-es5/bundles/antd.umd.js

echo 'Bundling to minified umd module of es5'
export ROLLUP_TARGET=mumd
$(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/antd.js -o publish-es5/bundles/antd.umd.min.js

echo 'Unifying publish folder'
mv publish-es5 publish
mv publish-es2015/esm2015 publish/esm2015
rm -rf publish-es2015

echo 'Cleaning up temporary files'
rm -rf __gen_components
rm -rf publish/src/*.js
rm -rf publish/src/**/*.js

echo 'Normalizing entry files'
sed -e "s/from '.\//from '.\/src\//g" publish/src/index.d.ts > publish/antd.d.ts
sed -e "s/\":\".\//\":\".\/src\//g" publish/src/index.metadata.json > publish/antd.metadata.json
rm publish/src/index.d.ts publish/src/index.metadata.json

echo 'Building schematics'
npm run schematic:demo
npm run schematic:build
rm -rf schematics/demo

echo 'Copying package.json'
cp package.json publish/package.json

echo 'Copying README.md'
cp README.md publish/README.md

node ./build_scripts/generate-less.js
2 changes: 1 addition & 1 deletion build_scripts/generate-less.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function compileLess(content, savePath, min) {
}

const sourcePath = path.resolve(__dirname, '../components');
const targetPath = path.resolve(__dirname, '../publish');
const targetPath = path.resolve(__dirname, '../publish/src');

const targetFolder = fs.readdirSync(targetPath);
let componentsLessContent = '';
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/nz-calendar-header.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import setMonth from 'date-fns/set_month';
import * as setMonth from 'date-fns/set_month';
import { NzI18nService as I18n } from '../i18n/nz-i18n.service';

@Component({
Expand Down
30 changes: 15 additions & 15 deletions components/calendar/nz-calendar.component.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { forwardRef, Component, ContentChild, EventEmitter, HostBinding, Input, OnInit, Output, TemplateRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import addDays from 'date-fns/add_days';
import differenceInCalendarDays from 'date-fns/difference_in_calendar_days';
import differenceInCalendarMonths from 'date-fns/difference_in_calendar_months';
import differenceInCalendarWeeks from 'date-fns/difference_in_calendar_weeks';
import endOfMonth from 'date-fns/end_of_month';
import isSameDay from 'date-fns/is_same_day';
import isSameMonth from 'date-fns/is_same_month';
import isSameYear from 'date-fns/is_same_year';
import isThisMonth from 'date-fns/is_this_month';
import isThisYear from 'date-fns/is_this_year';
import setMonth from 'date-fns/set_month';
import setYear from 'date-fns/set_year';
import startOfMonth from 'date-fns/start_of_month';
import startOfWeek from 'date-fns/start_of_week';
import startOfYear from 'date-fns/start_of_year';
import * as addDays from 'date-fns/add_days';
import * as differenceInCalendarDays from 'date-fns/difference_in_calendar_days';
import * as differenceInCalendarMonths from 'date-fns/difference_in_calendar_months';
import * as differenceInCalendarWeeks from 'date-fns/difference_in_calendar_weeks';
import * as endOfMonth from 'date-fns/end_of_month';
import * as isSameDay from 'date-fns/is_same_day';
import * as isSameMonth from 'date-fns/is_same_month';
import * as isSameYear from 'date-fns/is_same_year';
import * as isThisMonth from 'date-fns/is_this_month';
import * as isThisYear from 'date-fns/is_this_year';
import * as setMonth from 'date-fns/set_month';
import * as setYear from 'date-fns/set_year';
import * as startOfMonth from 'date-fns/start_of_month';
import * as startOfWeek from 'date-fns/start_of_week';
import * as startOfYear from 'date-fns/start_of_year';
import { NzI18nService as I18n } from '../i18n/nz-i18n.service';
import { NzDateCellDirective as DateCell, NzDateFullCellDirective as DateFullCell, NzMonthCellDirective as MonthCell, NzMonthFullCellDirective as MonthFullCell } from './nz-calendar-cells';

Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/date-picker.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fakeAsync, flush, inject, tick, ComponentFixture, TestBed } from '@angu
import { FormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import isSameDay from 'date-fns/is_same_day';
import * as isSameDay from 'date-fns/is_same_day';

import { dispatchKeyboardEvent, dispatchMouseEvent } from '../core/testing';
import en_US from '../i18n/languages/en_US';
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/demo/basic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import getISOWeek from 'date-fns/get_iso_week';
import * as getISOWeek from 'date-fns/get_iso_week';
import { en_US, zh_CN, NzI18nService } from 'ng-zorro-antd';

@Component({
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/demo/disabled-date.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import differenceInCalendarDays from 'date-fns/difference_in_calendar_days';
import setHours from 'date-fns/set_hours';
import * as differenceInCalendarDays from 'date-fns/difference_in_calendar_days';
import * as setHours from 'date-fns/set_hours';

@Component({
selector: 'nz-demo-date-picker-disabled-date',
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/demo/presetted-ranges.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import endOfMonth from 'date-fns/end_of_month';
import * as endOfMonth from 'date-fns/end_of_month';

@Component({
selector: 'nz-demo-date-picker-presetted-ranges',
Expand Down
10 changes: 5 additions & 5 deletions components/date-picker/lib/candy-date/candy-date.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import addMonths from 'date-fns/add_months';
import addYears from 'date-fns/add_years';
import endOfMonth from 'date-fns/end_of_month';
import setDay from 'date-fns/set_day';
// import setYear from 'date-fns/set_year';
import * as addMonths from 'date-fns/add_months';
import * as addYears from 'date-fns/add_years';
import * as endOfMonth from 'date-fns/end_of_month';
import * as setDay from 'date-fns/set_day';
// import * as setYear from 'date-fns/set_year';
import { firstDayOfWeek } from './util';

/**
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/month-picker.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

import isBefore from 'date-fns/is_before';
import * as isBefore from 'date-fns/is_before';
import { dispatchMouseEvent } from '../core/testing';
import { NzDatePickerModule } from './date-picker.module';
import { CandyDate } from './lib/candy-date';
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/range-picker.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { fakeAsync, inject, tick, ComponentFixture, TestBed } from '@angular/cor
import { FormsModule } from '@angular/forms';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import differenceInDays from 'date-fns/difference_in_days';
import isSameDay from 'date-fns/is_same_day';
import * as differenceInDays from 'date-fns/difference_in_days';
import * as isSameDay from 'date-fns/is_same_day';

import { dispatchMouseEvent } from '../core/testing';
import { NzDatePickerModule } from './date-picker.module';
Expand Down
2 changes: 1 addition & 1 deletion components/i18n/nz-i18n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BehaviorSubject, Observable } from 'rxjs';

import { LoggerService } from '../core/util/logger/logger.service';

import parse from 'date-fns/parse';
import * as parse from 'date-fns/parse';

import zh_CN from './languages/zh_CN';
import { NzI18nInterface } from './nz-i18n.interface';
Expand Down
13 changes: 0 additions & 13 deletions components/ng-package.json

This file was deleted.

34 changes: 0 additions & 34 deletions components/package.json

This file was deleted.

1 change: 1 addition & 0 deletions components/tree/nz-tree.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export class NzTreeService {

/**
* return half checked nodes
* @returns {NzTreeNode[]}
*/
getHalfCheckedNodeList(): NzTreeNode[] {
this.halfCheckedNodeList = [];
Expand Down
25 changes: 0 additions & 25 deletions components/tsconfig.lib.json

This file was deleted.

1 change: 0 additions & 1 deletion components/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"esModuleInterop": true,
"target": "es5",
"types": [
"jasmine",
Expand Down
38 changes: 31 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-zorro-antd-workspace",
"version": "0.0.0-NOT-USED",
"name": "ng-zorro-antd",
"version": "1.1.1",
"license": "MIT",
"description": "An enterprise-class UI components based on Ant Design and Angular",
"scripts": {
Expand All @@ -15,8 +15,7 @@
"build": "node site_scripts/generate-site init && ng build",
"doc": "npm run site:init && node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod --build-optimizer",
"helper": "bash ./release-helper.sh",
"generate": "ng build ng-zorro-antd-lib",
"postgenerate": "node ./build_scripts/generate-less.js && cp README.md publish/README.md",
"generate": "bash ./build.sh",
"pre-release": "npm run site:init && bash ./build_scripts/replace-publish.sh && npm run generate && node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod && npm run helper",
"test": "ng test --watch=false --code-coverage",
"integration": "npm run generate && bash ./integration-test.sh",
Expand All @@ -26,13 +25,33 @@
"lint": "tslint -c tslint.json 'components/*/*.ts'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && node site_scripts/replace-scope-prefix.js"
},
"main": "./bundles/antd.umd.js",
"module": "./esm5/antd.js",
"es2015": "./esm2015/antd.js",
"typings": "./antd.d.ts",
"schematics": "./schematics/collection.json",
"keywords": [
"ant",
"design",
"angular",
"ui",
"framework",
"frontend"
],
"homepage": "https://ng.ant.design",
"repository": {
"type": "git",
"url": "https://github.com/NG-ZORRO/ng-zorro-antd"
},
"bugs": {
"url": "https://github.com/NG-ZORRO/ng-zorro-antd/issues"
},
"dependencies": {
"@angular/cdk": "^6.0.0",
"date-fns": "^1.29.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular-devkit/build-ng-packagr": "^0.6.8",
"@angular-devkit/core": "^0.6.0",
"@angular-devkit/schematics": "^0.6.0",
"@angular/animations": "^6.0.0",
Expand Down Expand Up @@ -70,7 +89,6 @@
"less": "^2.7.3",
"less-plugin-clean-css": "^1.5.1",
"marked": "^0.3.6",
"ng-packagr": "^3.0.0-rc.2",
"ngx-color": "^1.5.2",
"ngx-infinite-scroll": "^6.0.0",
"node-prismjs": "^0.1.1",
Expand All @@ -85,12 +103,18 @@
"rollup-plugin-uglify": "^2.0.1",
"rxjs": "^6.0.0",
"ts-node": "~5.0.1",
"tsickle": "^0.30.0",
"tslib": "^1.9.0",
"tslint": "~5.9.1",
"typescript": "~2.7.2",
"wrench": "^1.5.9",
"yaml-front-matter": "^3.4.0",
"zone.js": "^0.8.26"
},
"peerDependencies": {
"@angular/animations": "^6.0.0",
"@angular/cdk": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0"
}
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
Expand Down

0 comments on commit 0e1d921

Please sign in to comment.