如何升级使用 Yeoman 搭建的现有项目 [英] How to upgrade existing project scaffolded with Yeoman

查看:19
本文介绍了如何升级使用 Yeoman 搭建的现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前我使用 generator-angular 来搭建一个项目,整个生态系统(karma、Node 版本、grunt 包)已经有了很大的发展.我一直在运行测试、构建东西等方面遇到问题.

I used generator-angular a few months ago to scaffold a project and the whole ecosystem (karma, Node versions, grunt packages) has moved on quite significantly. I keep running into problems running tests, building things, and so on.

我知道我可以使用 nvm 降级我的 Node 版本并安装较旧的软件包,但这很糟糕,尤其是当团队中有很多开发人员时.在过去的几个月里,我已经将这些生成器用于 10 多个项目,所以我对解决方案非常感兴趣.

I know I can use nvm to downgrade my Node version and install older packages, but that kind of sucks, especially when there are many developers on the team. I have used the generators for 10+ projects over the past few months so I'm very interested in a solution.

除了重新生成项目和复制文件之外,是否有推荐的生成器新版本发布时的升级路径?

Is there a recommended upgrade path for when new versions of generators are released, apart from just regenerating the project and copying files across?

(请注意:升级 Yeoman 0.9 项目不是问题.)

(Just to note: this isn't a problem with upgrading a Yeoman 0.9 project.)

推荐答案

首先确保您已经提交了所有内容或有备份,然后再次为项目搭建脚手架.yo 会询问您是否要覆盖每个文件.对于那些你没有编辑过的文件,直接说是.对于其他的,输入 d 作为 diff 并查看发生了什么变化.然后手动进行更改,并运行 npm install &bower install 以获取最新的依赖项.

First make sure you have committed everything or have a backup, then just scaffold out over the project again. yo will ask you for each file if you want to overwrite. For those files you haven't edited, just say yes. For the other ones, type d for diff and see what's changed. Then manually do the changes, and run npm install & bower install to get the latest dependencies.

正如 Markus Gattol 在评论中提到的:

As mentionned in comments by Markus Gattol :

yo 现在已经运行 bower install &npm install 即不需要再次显式运行它们 – Markus Gattol

yo <generator-name> now already run bower install & npm install i.e. no need to run them explicitly again – Markus Gattol

这篇关于如何升级使用 Yeoman 搭建的现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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