如何为版本7更新角度项目版本5

时间:2019-10-07 23:53:15

标签: angular angular-upgrade

我的项目当前的版本是5.2,并且想升级到有角度的版本7.2.15,如何做到最简单,最快的方法,请遵循我的依赖项package.json

"dependencies": {
    "@agm/core": "^1.0.0-beta.3",
    "@angular/animations": "^5.2.9",
    "@angular/common": "^5.2.9",
    "@angular/compiler": "^5.2.9",
    "@angular/core": "^5.2.9",
    "@angular/forms": "^5.2.9",
    "@angular/http": "^5.2.9",
    "@angular/platform-browser": "^5.2.9",
    "@angular/platform-browser-dynamic": "^5.2.9",
    "@angular/platform-server": "^5.0.0",
    "@angular/router": "^5.2.9",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "@types/google-maps": "^3.2.0",
    "@types/icheck": "^0.8.29",
    "@types/jqueryui": "^1.11.35",
    "angular2-jwt": "^0.2.3",
    "animate.css": "^3.7.0",
    "bootstrap": "^3.3.7",
    "core-js": "^2.6.3",
    "font-awesome": "^4.7.0",
    "icheck": "^1.0.2",
    "install": "^0.10.1",
    "jquery": "^3.3.1",
    "jqueryui": "^1.11.1",
    "jspdf": "^1.4.1",
    "moment": "^2.24.0",
    "morgan": "^1.9.1",
    "multer": "^1.3.0",
    "ng2-currency-mask": "^4.4.1",
    "ng2-dragula": "^2.1.1",
    "ng2-file-upload": "^1.3.0",
    "ng2-google-charts": "^3.4.0",
    "ng2-lazy-trumbowyg": "^2.4.2",
    "ng2-pdf-viewer": "^4.0.0",
    "ng2-toasty": "^4.0.3",
    "ngx-captcha": "^5.0.4",
    "ngx-image-cropper": "^1.4.1",
    "ngx-mask": "^6.3.8",
    "ngx-pagination": "^3.1.1",
    "ngx-popover": "0.0.16",
    "ngx-progressbar": "^2.1.1",
    "ngx-uploader": "^7.1.0",
    "npm": "^6.10.2",
    "primeng": "^5.2.3",
    "quill": "^1.3.4",
    "rxjs": "^5.5.12",
    "trumbowyg": "^2.15.2",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.3",
    "@angular/cli": "^7.2.3",
    "@angular/compiler-cli": "^5.2.9",
    "@angular/language-service": "^5.2.11",
    "@types/googlemaps": "^3.30.10",
    "@types/jasmine": "~2.6.0",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^2.0.47",
    "@types/jspdf": "^1.2.1",
    "@types/morris.js": "^0.5.6",
    "@types/node": "~6.0.60",
    "codelyzer": "~4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.1",
    "ts-node": "~3.3.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }

您可以看到它与angular 5以及ng2有一些依赖关系-...但是我认为您可以悄悄地更新每个库的内容

我只想知道从升级到7.2.15版本可能要做些什么,因为我认为这是不破坏依赖关系的最佳时机

2 个答案:

答案 0 :(得分:1)

您将需要按照角度指南从5升级到7。不幸的是,没有一次简便的方法可以一次更新所有软件包。 在CLI中,您可以使用ng update --packages <list of packages separated by space>

看看ng update。但是,您package.json中的某些ng2 -...软件包仍可能需要引起您的注意,因为它们在一两年之内都没有更新。希望它们将支持angular 7,但如果没有,请准备将其替换为其他软件包。

答案 1 :(得分:0)

使用官方网站指南:https://update.angular.io/

提示:强烈建议您不要从5更新到6,然后再更新到7。强烈建议不要直接从5更新到7。