Skip to content

feat(schematics): add v19 ng update migration#8911

Merged
Laffery merged 6 commits into
NG-ZORRO:masterfrom
Laffery:feat/ng-update-v19
Dec 6, 2024
Merged

feat(schematics): add v19 ng update migration#8911
Laffery merged 6 commits into
NG-ZORRO:masterfrom
Laffery:feat/ng-update-v19

Conversation

@Laffery

@Laffery Laffery commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

  • 支持在 ng update ng-zorro-antd 时迁移下列 Breaking changes API
  • 在 ng add 时
    • 添加 providers 时,使用 provideNzI18n 替代 NZ_I18N
    • 使用模板生成代码时
      • standalone 模式下移除 standalone: true
      • 非 standalone 模式下增加 standalone: false
  • 整理 ./schematics/ng-upgrade 下的代码组织结构 (参考 cdk)

本地验证

# build schematics
cd path/to/ng-zorro-antd
npx gulp build:schematics
cp ./components/package.json ./publish
sed -i "" -e 's/"version": "18.2.1"/"version": "19.0.0"/' ./publish/package.json

# symlink
npm ln

# ng update
cd path/to/project
npm ln ng-zorro-antd
ng update ng-zorro-antd --migrate-only --to 19.0.0 --from 18.2.1

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@zorro-bot

zorro-bot Bot commented Dec 5, 2024

Copy link
Copy Markdown

This preview will be available after the AzureCI is passed.

@Laffery Laffery requested a review from HyperLife1119 December 5, 2024 09:05
@Laffery Laffery added this to the v19 milestone Dec 5, 2024
@codecov

codecov Bot commented Dec 5, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.92%. Comparing base (a65a32f) to head (8ce4a32).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8911      +/-   ##
==========================================
- Coverage   91.92%   91.92%   -0.01%     
==========================================
  Files         554      554              
  Lines       19684    19682       -2     
  Branches     2936     2936              
==========================================
- Hits        18095    18093       -2     
  Misses       1264     1264              
  Partials      325      325              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Laffery

Laffery commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator Author

晚点我加下 #8741 的迁移

@Laffery

Laffery commented Dec 5, 2024

Copy link
Copy Markdown
Collaborator Author

ready to review
image

selector: '<%= selector %>',<% if(standalone) {%>
standalone: true,
imports: [],<%}%><% if(inlineTemplate) { %>
selector: '<%= selector %>',<% if(standalone) { %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standalone 模式下只有 imports: [],非 standalone 模式只有 standalone: false


private visitImportDeclaration(node: ts.ImportDeclaration): void {
if (isNgZorroImportDeclaration(node)) {
return this._createFailureWithReplacement(node);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是 ng-zorro-antd 的 import 语句,在 upgradeData 中找到匹配的变更项,编辑并应用

@Laffery Laffery requested review from a team and wenqi73 as code owners December 6, 2024 00:29
@Laffery

Laffery commented Dec 6, 2024

Copy link
Copy Markdown
Collaborator Author

reviewed

@Laffery Laffery merged commit 1a20de2 into NG-ZORRO:master Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant