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

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

问题描述

当ng cli 1.5和angular 5像现在这样的ng cli和angular更改版本时,如何更新应用程序?

How to update an app when ng cli and angular change version like now with ng cli 1.5 and angular 5 ?

我的目标是拥有一个现有的项目,例如,角度为4和ng cli 1.4,更新为角度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)

一种替代方法应该是使用融合.

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 use 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版本
  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天全站免登陆