ng cli 和 angular 更改版本最佳实践时如何更新应用程序 [英] how to update an app when ng cli and angular change version best practice
问题描述
如何在 ng cli 和 angular 更改版本(如现在使用 ng cli 1.5 和 angular 5 )时更新应用程序?
How to update an app when ng cli and angular change version like now with ng cli 1.5 and angular 5 ?
我的目标是拥有一个现有项目,例如 angular 4 和 ng cli 1.4,更新为 angular 5 和一个由 ng cli 构建的脚手架.(我不知道在这种情况下,但脚手架有时也发生了变化,所以我想要全新的脚手架)
My goal is to have an existing project with for instance angular 4 and ng cli 1.4,updated to angular 5 and the one scaffold built by ng cli. (I don't know in this case but also the scaffold have sometime changed so I want the brand new scaffold)
另一种方法应该是使用 meld.
An alternative should be using meld.
我正在寻找最佳方法/实践,因为现在我正在遵循所有这些步骤.
I'm looking for a best way/practice because right now I'm following all of these steps.
现在我尽可能用 nvm 更新节点版本,例如
By now I update if possible the node version with nvm so for instance
nvm install v9.0.0
nvm 使用 v9.0.0
npm install -g @angular/cli
ng new myproject
覆盖 src 和 assets 文件夹
overwrite the src and assets folders
更新 package.json
复制.stylelintrc
删除package-lock.json
npm install
正如您所看到的,工作量很大,而且容易出错,所以我想知道是否有更聪明的方法来进行更新.
As you can see a lot of work and also error prone so I'm wondering if there is a smarter way to do the update.
真正的问题是外部库例如对于 OpaqueToken :(
The really problems are the external lib for instance for the OpaqueToken :(
推荐答案
2018 年 10 月 23 日更新:
UPDATE 23-Oct-2018:
如果您使用的是 Angular CLI 版本 6+,只需运行 ng update
然后按照命令行指令.另请查看本指南 更新您的角度项目
If you are on Angular CLI version 6+ just run
ng update
then follow the command line instructions. Also checkout this guide Updating your Angular projects
<小时>
将 Angular CLI 从 1.4 更新到 1.5 一点也不难.您需要做的就是使用 angular-cli-diff
- 选择 cli
from
和to
版本 https://github.com/cexbrayat/angular-cli-diff/compare/1.4.0...1.5.0 - 点击
文件更改
标签 - 将更改应用于您当前的项目.
npm install
/yarn
- choose the cli
from
andto
versions https://github.com/cexbrayat/angular-cli-diff/compare/1.4.0...1.5.0 - click on
File changed
tab - Apply the changes to your current project.
npm install
/yarn
这篇关于ng cli 和 angular 更改版本最佳实践时如何更新应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!