Skip to content

feat(dependencies): Upgrade Angular dependencies. #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions nativescript-angular/bin/update-app-ng-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node

var path = require("path");
var fs = require("fs");

var binPath = __dirname;
var pluginPath = path.dirname(binPath);
var pluginPackageJsonPath = path.join(pluginPath, "package.json");
var projectPath = path.dirname(path.dirname(pluginPath));
var appPackageJsonPath = path.join(projectPath, "package.json");

var appPackageJson = JSON.parse(fs.readFileSync(appPackageJsonPath, "utf8"));
var pluginPackageJson = JSON.parse(fs.readFileSync(pluginPackageJsonPath, "utf8"));

Object.keys(pluginPackageJson.dependencies).forEach(function(dependencyName) {
var version = pluginPackageJson.dependencies[dependencyName];
if (dependencyName.startsWith("@angular") || dependencyName === "rxjs") {
appPackageJson.dependencies[dependencyName] = version;
console.log("Updated dependency '" + dependencyName + "' to version: " + version + ".");
}
});

Object.keys(pluginPackageJson.devDependencies).forEach(function(dependencyName) {
var version = pluginPackageJson.devDependencies[dependencyName];
if (dependencyName.startsWith("@angular") || dependencyName === "zone.js") {
appPackageJson.devDependencies[dependencyName] = version;
console.log("Updated dev dependency '" + dependencyName + "' to version: " + version + ".");
}
});

fs.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2));

console.log("\nAngular dependencies updated. Don't forget to run `npm install`.");
1 change: 1 addition & 0 deletions nativescript-angular/bin/update-app-ng-deps.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@node %~dp0\update-app-angular-deps %*
3 changes: 3 additions & 0 deletions nativescript-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"tsc": "tsc -p tsconfig.json",
"prepublish": "npm run tsc && npm run ngc"
},
"bin": {
"update-app-ng-deps": "./bin/update-app-ng-deps"
},
"dependencies": {
"nativescript-intl": "~0.0.8",
"@angular/core": "~2.4.3",
Expand Down