0

我的项目目前是 5.2 版本,并且想升级到 Angular 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版本的角度我可能会改变什么,因为我认为这是不要过多破坏依赖关系的最佳时机

4

2 回答 2

1

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

看看ng update。但是,您的 package.json 中的一些 ng2-... 包仍然可能需要您注意,因为它们一两年都没有更新。希望他们会支持 Angular 7,但如果不支持,请准备好用其他软件包替换它们。

于 2019-10-08T01:06:00.677 回答
0

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

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

于 2019-10-08T00:42:37.847 回答