From 2a28df1565d6e08802b735b433c9978699407804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Sun, 23 Jun 2019 22:03:09 +0800 Subject: [PATCH] release(8.0.0-rc.0): release 8.0.0-rc.0 (#627) --- .travis.yml | 4 - docs/deploy.en-US.md | 12 ++ docs/deploy.zh-CN.md | 12 ++ docs/upgrade-v8.en-US.md | 145 +++++++++++++++++++ docs/upgrade-v8.zh-CN.md | 145 +++++++++++++++++++ package.json | 2 +- packages/theme/styles/app/ng/_router.less | 8 +- packages/theme/styles/app/widgets/_form.less | 8 - 8 files changed, 319 insertions(+), 17 deletions(-) create mode 100644 docs/upgrade-v8.en-US.md create mode 100644 docs/upgrade-v8.zh-CN.md diff --git a/.travis.yml b/.travis.yml index 8d0df91df..96135ea54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,10 +48,6 @@ stages: - name: test if: branch = master -# matrix: -# allow_failures: -# - env: "TASK=build_artifacts" - install: - chmod +x -R scripts - yarn diff --git a/docs/deploy.en-US.md b/docs/deploy.en-US.md index 033098b37..5df118772 100644 --- a/docs/deploy.en-US.md +++ b/docs/deploy.en-US.md @@ -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. diff --git a/docs/deploy.zh-CN.md b/docs/deploy.zh-CN.md index 9fb9a1a89..ea5428a18 100644 --- a/docs/deploy.zh-CN.md +++ b/docs/deploy.zh-CN.md @@ -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` 内的配置项,最后你可以透过命令改变环境配置。 diff --git a/docs/upgrade-v8.en-US.md b/docs/upgrade-v8.en-US.md new file mode 100644 index 000000000..ca24161f0 --- /dev/null +++ b/docs/upgrade-v8.en-US.md @@ -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 + +
Button
+ +
+``` + +After: + +```html +
Button
+ + + +``` + +### form + +```html +
+ + + + + + Please input your username! + + +
+``` + +After: + +```html +
+ + + + + + + +
+``` + +## 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", +``` diff --git a/docs/upgrade-v8.zh-CN.md b/docs/upgrade-v8.zh-CN.md new file mode 100644 index 000000000..c4285f073 --- /dev/null +++ b/docs/upgrade-v8.zh-CN.md @@ -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 + +
Button
+ +
+``` + +变更后: + +```html +
Button
+ + + +``` + +### form + +```html +
+ + + + + + Please input your username! + + +
+``` + +变更后: + +```html +
+ + + + + + + +
+``` + +## 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", +``` \ No newline at end of file diff --git a/package.json b/package.json index 4a5deb347..0a06e6203 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/packages/theme/styles/app/ng/_router.less b/packages/theme/styles/app/ng/_router.less index ce4230b3d..73ac5250f 100644 --- a/packages/theme/styles/app/ng/_router.less +++ b/packages/theme/styles/app/ng/_router.less @@ -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; } diff --git a/packages/theme/styles/app/widgets/_form.less b/packages/theme/styles/app/widgets/_form.less index f3a37e719..7e54768fb 100644 --- a/packages/theme/styles/app/widgets/_form.less +++ b/packages/theme/styles/app/widgets/_form.less @@ -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;