ng cli 和 angular 更改版本最佳实践时如何更新应用程序 [英] how to update an app when ng cli and angular change version best practice

查看:36
本文介绍了ng cli 和 angular 更改版本最佳实践时如何更新应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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

  1. 选择 cli fromto 版本 https://github.com/cexbrayat/angular-cli-diff/compare/1.4.0...1.5.0
  2. 点击文件更改标签
  3. 将更改应用于您当前的项目.
  4. npm install/yarn
  1. choose the cli from and to versions https://github.com/cexbrayat/angular-cli-diff/compare/1.4.0...1.5.0
  2. click on File changed tab
  3. Apply the changes to your current project.
  4. npm install / yarn

这篇关于ng cli 和 angular 更改版本最佳实践时如何更新应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆