按照最佳实践升级 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?
现在 Angular is following a Semantic Versioning, and Angular2.4.3 were released,我对在现有项目中升级到下一个 Angular 版本时的最佳实践感到有点困惑。
我有一个使用 Angular-cli 和 @angular/core: 2.2.0
的项目。这是我的 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)?使用 npm
或 yarn
.
我建议你安装 npm-check-updates 库。这将使您找到您使用的最新版本的依赖项。
按照以下步骤操作:
安装
npm i -g npm-check-updates
要更新您的package.json:
npm-check-updates -u
要安装最新版本的依赖项
npm 安装
我已将我的应用程序从 Angular 2.4.0
升级到 4.0.2
,而没有更改任何代码!请记住,尽管这取决于您使用的 features/classes/methods。
我运行
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
。如果您想要最新的 'bleeding edge' 版本,请使用 @next
。
对于Windows你可以使用下面的命令
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@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 @angular/animations@latest typescript@latest --save
现在 Angular is following a Semantic Versioning, and Angular2.4.3 were released,我对在现有项目中升级到下一个 Angular 版本时的最佳实践感到有点困惑。
我有一个使用 Angular-cli 和 @angular/core: 2.2.0
的项目。这是我的 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)?使用 npm
或 yarn
.
我建议你安装 npm-check-updates 库。这将使您找到您使用的最新版本的依赖项。
按照以下步骤操作:
安装
npm i -g npm-check-updates
要更新您的package.json:
npm-check-updates -u
要安装最新版本的依赖项
npm 安装
我已将我的应用程序从 Angular 2.4.0
升级到 4.0.2
,而没有更改任何代码!请记住,尽管这取决于您使用的 features/classes/methods。
我运行
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
。如果您想要最新的 'bleeding edge' 版本,请使用 @next
。
对于Windows你可以使用下面的命令
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@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 @angular/animations@latest typescript@latest --save