Skip to content

Commit

Permalink
release(8.0.0-rc.0): release 8.0.0-rc.0 (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Jun 23, 2019
1 parent 0bf3415 commit 2a28df1
Show file tree
Hide file tree
Showing 8 changed files with 319 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ stages:
- name: test
if: branch = master

# matrix:
# allow_failures:
# - env: "TASK=build_artifacts"

install:
- chmod +x -R scripts
- yarn
Expand Down
12 changes: 12 additions & 0 deletions docs/deploy.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ npm run build

NG-ALAIN itself is an Angular CLI project, so you can also complete more complex build requirements with [Build](https://angular.io/cli/build). After the package is successfully packaged, the `dist` folder will be generated in the root directory, which is to build the packaged file, including several static files such as `*.js`, `*.css`, `index.html`.

### JavaScript heap out of memory

Avoid executing `ng build` when throw error **JavaScript heap out of memory**:

```json
{
"scripts": {
"build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod"
}
}
```

### Environmental variable

When you need to distinguish between development and deployment and test environment, you can configure the corresponding parameters according to different environments through the `src/environments` folder. The configuration items can also be called directly in the application. At the same time, you need to configure the configuration items in `angular.json`. Finally, you can change the environment configuration through commands.
Expand Down
12 changes: 12 additions & 0 deletions docs/deploy.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ npm run build

NG-ALAIN 本身是一个 Angular CLI 项目,因此也可以参照 [Build](https://angular.io/cli/build) 完成更复杂的构建需求。构建打包成功之后,会在根目录生成 `dist` 文件夹,里面就是构建打包好的文件,包含若干 `*.js``*.css``index.html` 等静态文件。

### JavaScript heap out of memory

避免执行 `ng build` 时抛出 **JavaScript heap out of memory**

```json
{
"scripts": {
"build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod"
}
}
```

### 环境变量

当你需要区别开发和部署以及测试环境的时候,可以通过 `src/environments` 文件夹根据不同环境配置相应的参数,配置项同时也可以在应用当中直接调用它们。同时,还需要配置 `angular.json` 内的配置项,最后你可以透过命令改变环境配置。
Expand Down
145 changes: 145 additions & 0 deletions docs/upgrade-v8.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
order: 11
type: Basic
title: Upgrade to V8
hot: true
---

NG-ALAIN 8.0 changes of three parts:

| Library | Support Cli Upgrade | Description |
| --- | ---------- | ---- |
| Angular | Yes | - |
| NG-ZORRO | No | Maybe the official version will provide partial support |
| Delon | No | Only one ACL class library reference |

# Requirements

Remove unused class libraries:

- `tslint-language-service`
- `core-js` Support differential loading after Angular auto management polyfills

# Upgrade

## 1.Angular

Angular upgrades can be check each step according to [update.angular.io](https://update.angular.io/#7.0:8.0), and the following commands can almost seamlessly upgrade breaking changes:

```bash
ng update @angular/cli @angular/core
```

Some changes to the details:

1. Update the `package.json` dependency package version information, but not latest version number, you can use [#diff-10](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-10) learn the details
2. **Adjust to support differential loading** Update `tsconfig.json` with `module` for [esnext](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-e5e546dd2eb0351f813d63d1b39dbc48R8), and remove all related introductions of `core-js` under `polyfills.ts`
3. Auto handle breaking changes: `ViewChild` or `ContentChild`. For details please refer to [Static Query Migration Guide](https://angular.io/guide/static-query-migration)
4. Auto handle breaking changes: route lazy loading module. For details please refer to [loadChildren string syntax](https://angular.io/guide/deprecations#loadchildren-string-syntax)

## 2.NG-ZORRO

Contains two breaking changes: `nz-dropdown` and `form`, still keeping the old API to the `9.x` version, and there will be a warning in the development environment.

NG-ZORRO **don't** provide Cli tool upgrades. For more details, please refer to [8.x Documentation](https://ng-zorro-master.netlify.com/docs/introduce/zh). The following are examples before and after the change:

### nz-dropdown

```html
<nz-dropdown nzPlacement="bottomRight">
<div nz-dropdown>Button</div>
<ul nz-menu>
<li nz-menu-item>Item 1</li>
<li nz-menu-item>Item 2</li>
</ul>
</nz-dropdown>
```

After:

```html
<div nz-dropdown nzPlacement="bottomRight" [nzDropdownMenu]="menuTpl">Button</div>
<nz-dropdown-menu #menuTpl="nzDropdownMenu">
<ul nz-menu>
<li nz-menu-item>Item 1</li>
<li nz-menu-item>Item 2</li>
</ul>
</nz-dropdown-menu>
```

### form

```html
<form nz-form [nzLayout]="'inline'" [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group [nzPrefix]="prefixUser">
<input formControlName="userName" nz-input placeholder="Username" />
</nz-input-group>
<nz-form-explain *ngIf="validateForm.get('userName')?.dirty && validateForm.get('userName')?.errors"
>Please input your username!</nz-form-explain
>
</nz-form-control>
</nz-form-item>
</form>
```

After:

```html
<form nz-form [nzLayout]="'inline'" [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control nzErrorTip="Please input your username!">
<nz-input-group nzPrefixIcon="user">
<input formControlName="userName" nz-input placeholder="Username" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
```

## 3、Delon

Muse manually modify the `@delon/*` and `ng-alain` dependencies in `package.json` to be the version number: `^8.0.0-rc.0`:

```bash
yarn
```

### ACL

`DelonACLModule` requires `forRoot()`, see [delon.module.ts](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-19).

# Optional Upgrade

## tsconfig.json

NG-ALAIN is always based on the infrastructure generated by Angular Cli, so there are some minor changes to the file structure, but it does not affect the existing structure:

1. The original `src/tsconfig.app.json`, `src/tsconfig.spec.json`, `karma.conf.js` are moved to the root directory, and the corresponding path of `angular.json` needs to be modified synchronously.
2. `tsconfig.app.json` and `tsconfig.spec.json` do not need to set the `paths` attributes.
```diff
- "paths": {
- "@shared": [ "app/shared/index" ],
- "@shared/*": [ "app/shared/*" ],
- "@core": [ "app/core/index" ],
- "@core/*": [ "app/core/*" ],
- "@env/*": [ "environments/*" ]
- }
```
3. Fix the corresponding path of the `lint:ts` command line
```diff
- "lint:ts": "tslint -p src/tsconfig.app.json -c tslint.json \"src/**/*.ts\" --fix",
+ "lint:ts": "tslint -p tsconfig.app.json -c tslint.json \"src/**/*.ts\" --fix",
```

## Command Line

Avoid executing `ng build` when throw error **JavaScript heap out of memory**:

```diff
- "build": "npm run color-less && ng build --prod --build-optimizer",
+ "build": "npm run color-less && node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod",
- "analyze": "ng build --prod --build-optimizer --stats-json",
+ "analyze": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod --stats-json",
```
145 changes: 145 additions & 0 deletions docs/upgrade-v8.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
order: 11
type: Basic
title: 升级到 8.0 版本
hot: true
---

NG-ALAIN 8.0 变更分为三大部分:

| 类库 | 支持Cli升级 | 描述 |
| --- | ---------- | ---- |
| Angular | Yes | - |
| NG-ZORRO | No | 可能正式版会提供部分支持 |
| Delon | No | 只涉及一处 ACL 类库引用 |

# 前置条件

移除未使用类库:

- `tslint-language-service`
- `core-js` 支持差异加载后 Angular 自动管理 Polyfills

# 升级

## 1、Angular

Angular 升级可以根据 [update.angular.io](https://update.angular.io/#7.0:8.0) 来检查每个步骤,执行下述命令几乎可以无缝升级破坏性变更:

```bash
ng update @angular/cli @angular/core
```

一些值得注意的变更细节:

1. 更新 `package.json` 的依赖包版本信息,但不是完全最新的,可以通过 [#diff-10](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-10) 了解调整细节
2. **调整为支持差异加载** 更新 `tsconfig.json``module`[esnext](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-e5e546dd2eb0351f813d63d1b39dbc48R8),并移除 `polyfills.ts` 下所有 `core-js` 的相关引入
3. 自动处理 `ViewChild``ContentChild` 的破坏性变更,有关变更后使用细节请参考[Static Query Migration Guide](https://angular.io/guide/static-query-migration)
4. 自动处理路由延迟加载模块,有关变更后使用细节请参考[loadChildren string syntax](https://angular.io/guide/deprecations#loadchildren-string-syntax)

## 2、NG-ZORRO

包含 `nz-dropdown``form` 两处破坏性变更,依然保持旧API至 `9.x` 版本,同时在开发环境下会有 warning。

NG-ZORRO 暂时没有提供 Cli 工具升级,更多细节请参考 [8.x文档站](https://ng-zorro-master.netlify.com/docs/introduce/zh),以下是变更前后的示例:

### nz-dropdown

```html
<nz-dropdown nzPlacement="bottomRight">
<div nz-dropdown>Button</div>
<ul nz-menu>
<li nz-menu-item>Item 1</li>
<li nz-menu-item>Item 2</li>
</ul>
</nz-dropdown>
```

变更后:

```html
<div nz-dropdown nzPlacement="bottomRight" [nzDropdownMenu]="menuTpl">Button</div>
<nz-dropdown-menu #menuTpl="nzDropdownMenu">
<ul nz-menu>
<li nz-menu-item>Item 1</li>
<li nz-menu-item>Item 2</li>
</ul>
</nz-dropdown-menu>
```

### form

```html
<form nz-form [nzLayout]="'inline'" [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group [nzPrefix]="prefixUser">
<input formControlName="userName" nz-input placeholder="Username" />
</nz-input-group>
<nz-form-explain *ngIf="validateForm.get('userName')?.dirty && validateForm.get('userName')?.errors"
>Please input your username!</nz-form-explain
>
</nz-form-control>
</nz-form-item>
</form>
```

变更后:

```html
<form nz-form [nzLayout]="'inline'" [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control nzErrorTip="Please input your username!">
<nz-input-group nzPrefixIcon="user">
<input formControlName="userName" nz-input placeholder="Username" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
```

## 3、Delon

手动修改 `package.json` 里的 `@delon/*``ng-alain` 依赖包版本号为:`^8.0.0-rc.0`,并执行:

```bash
yarn
```

### ACL

`DelonACLModule` 需要 `forRoot()` 才会生效 [delon.module.ts](https://github.com/ng-alain/ng-alain/pull/1165/files#diff-19)

# 可选升级

## tsconfig.json

NG-ALAIN 始终以 Angular Cli 产生的基础结构为基准,因此对于文件结构有些小变化 ,但不影响现有结构:

1.`src/tsconfig.app.json``src/tsconfig.spec.json``karma.conf.js` 转移至根目录,需要同步修改 `angular.json` 相对应路径
2. `tsconfig.app.json``tsconfig.spec.json` 无须再单独设定 `paths` 属性
```diff
- "paths": {
- "@shared": [ "app/shared/index" ],
- "@shared/*": [ "app/shared/*" ],
- "@core": [ "app/core/index" ],
- "@core/*": [ "app/core/*" ],
- "@env/*": [ "environments/*" ]
- }
```
3. 修复 `lint:ts` 命令行相应路径
```diff
- "lint:ts": "tslint -p src/tsconfig.app.json -c tslint.json \"src/**/*.ts\" --fix",
+ "lint:ts": "tslint -p tsconfig.app.json -c tslint.json \"src/**/*.ts\" --fix",
```

## 命令行

避免执行 `ng build` 时抛出 **JavaScript heap out of memory**

```diff
- "build": "npm run color-less && ng build --prod --build-optimizer",
+ "build": "npm run color-less && node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod",
- "analyze": "ng build --prod --build-optimizer --stats-json",
+ "analyze": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build --prod --stats-json",
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "delon",
"version": "7.7.1",
"version": "8.0.0-rc.0",
"typings": "index.d.ts",
"description": "Delon is a set of essential modules for NG-ALAIN.",
"keywords": [
Expand Down
8 changes: 4 additions & 4 deletions packages/theme/styles/app/ng/_router.less
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// router ant
@router-animation-name: antFadeIn;
@router-animation-name: antFadeIn;
@router-animation-duration: 1s;

// https://github.com/angular/angular/issues/9845
// 一种路由切换动画的简单实现
// A simple implementation of a route switching animation
// ISSUES: https://github.com/angular/angular/issues/9845
app-layout router-outlet + * {
display: block;
// animation-fill-mode: both;
animation-name: @router-animation-name; // fadeIn;
animation-name: @router-animation-name; // fadeIn;
animation-duration: @router-animation-duration;
}
8 changes: 0 additions & 8 deletions packages/theme/styles/app/widgets/_form.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
.search__form-mixin(@enabled) when(@enabled = true) {
.search {
&__form {
// FIXED-CHECK
// // BUG: https://github.com/NG-ZORRO/ng-zorro-antd/issues/1202
// &.@{ant-prefix}-form-inline {
// .@{ant-prefix}-form-item-label,
// .@{ant-prefix}-form-item-control-wrapper {
// padding: 0 !important;
// }
// }
.@{ant-prefix}-form-item {
display: flex;
margin-right: 0;
Expand Down

0 comments on commit 2a28df1

Please sign in to comment.