按照最佳做法升级Angular版本(现在:2.4.3或4.0.0-beta.3)吗? [英] Upgrade Angular version (now: 2.4.3 or 4.0.0-beta.3) following the best practice?

查看:104
本文介绍了按照最佳做法升级Angular版本(现在:2.4.3或4.0.0-beta.3)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在, Angular正在遵循语义版本控制,并且 Angular2 .4.3已发布,我在升级到现有项目的下一个Angular版本时的最佳做法感到有些困惑.

Now that Angular is following a Semantic Versioning, and Angular2.4.3 were released, I'm a little confused here on what is the best practice when I upgrade to the next Angular version in existing project.

我有一个使用@angular/core: 2.2.0的Angular-cli项目.这是我的package.json:

I've a project with Angular-cli, with @angular/core: 2.2.0. Here is my package.json:

"dependencies": {
    "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/router": "~3.2.0",
    "@types/jasmine": "^2.5.40",
    "angular2-click-outside": "^0.1.0",
    "angular2-modal": "^2.0.2",
    "bootstrap": "4.0.0-alpha.4",
    "bootstrap-loader": "^2.0.0-beta.15",
    "core-js": "^2.4.1",
    "karma-remap-istanbul": "^0.2.2",
    "material-design-icons": "^3.0.1",
    "ng2-bootstrap": "^1.1.16",
    "ng2-charts": "^1.4.4",
    "postcss-loader": "^1.1.1",
    "rxjs": "5.0.0-rc.4",
    "screenfull": "^3.0.2",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.19-3",
    "codelyzer": "1.0.0-beta.3",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "node-sass": "^3.13.0",
    "protractor": "4.0.11",
    "replace": "0.3.0",
    "ts-node": "1.7.0",
    "tslint": "3.15.1",
    "typescript": "~2.0.3",
    "webdriver-manager": "10.2.8"
  }

问题:如何按照最佳做法升级到下一个Angular版本(现在:2.4.3或4.0.0-beta.3)?使用npmyarn.

Question: How do I upgrade to the next Angular version(now: 2.4.3 or 4.0.0-beta.3) following the best practice? Using npm or yarn.

推荐答案

我已经将我的应用程序从Angular 2.4.0升级到了4.0.2,没有任何代码更改!请记住,尽管这取决于您使用的功能/类/方法.

I've upgraded my app from Angular 2.4.0 to 4.0.2 without any code changes! Bare in mind, though that it depends of which features/classes/methods you are using.

我跑了

npm i @angular/common@latest @angular/compiler@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest typescript@latest --S -E

然后

npm i @angular/compiler-cli@latest --D -E

注意:如果需要最新的稳定版本,请使用@latest.如果需要最新的出血边缘"版本,请使用@next.

NOTE: use @latest if you want the latest stable version. Use @next if you want the latest 'bleeding edge' version.

这篇关于按照最佳做法升级Angular版本(现在:2.4.3或4.0.0-beta.3)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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