-
-
Notifications
You must be signed in to change notification settings - Fork 240
chore: update to Angular 4.1 and TypeScript 2.3 #775
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 39 additions & 29 deletions
nativescript-angular/bin/update-app-ng-deps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,43 @@ | ||
| #!/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)); | ||
| const path = require("path"); | ||
| const fs = require("fs"); | ||
|
|
||
| const binPath = __dirname; | ||
| const pluginPath = path.dirname(binPath); | ||
| const pluginPackageJsonPath = path.join(pluginPath, "package.json"); | ||
| const pluginPackageJson = JSON.parse(fs.readFileSync(pluginPackageJsonPath, "utf8")); | ||
| const pluginPeerDeps = pluginPackageJson.peerDependencies; | ||
|
|
||
| const projectPath = path.dirname(path.dirname(pluginPath)); | ||
| const appPackageJsonPath = path.join(projectPath, "package.json"); | ||
| const appPackageJson = JSON.parse(fs.readFileSync(appPackageJsonPath, "utf8")); | ||
|
|
||
| const shouldUpdateDependency = name => name.startsWith("@angular") || | ||
| name === "rxjs" || | ||
| name === "zone.js"; | ||
|
|
||
| let updatedDependencies = appPackageJson.dependencies; | ||
|
|
||
| // set app dependencies to ones required from plugin (peer) | ||
| Object.keys(pluginPeerDeps) | ||
| .filter(shouldUpdateDependency) | ||
| .forEach(dependencyName => { | ||
| const version = pluginPackageJson.peerDependencies[dependencyName]; | ||
| updatedDependencies[dependencyName] = version; | ||
| console.log(`Updated dependency ${dependencyName} to version: ${version}.`); | ||
| }); | ||
|
|
||
| // remove platform-browser-dynamic if present | ||
| const browserDynamicDependency = "@angular/platform-browser-dynamic"; | ||
| if (updatedDependencies.hasOwnProperty(browserDynamicDependency)) { | ||
| delete updatedDependencies[browserDynamicDependency]; | ||
| console.log(`Removed ${browserDynamicDependency}`); | ||
| } | ||
|
|
||
| let updatedPackageJson = appPackageJson; | ||
| updatedPackageJson.dependencies = updatedDependencies; | ||
|
|
||
| fs.writeFileSync(appPackageJsonPath, JSON.stringify(updatedPackageJson, null, 2)); | ||
|
|
||
| console.log("\nAngular dependencies updated. Don't forget to run `npm install`."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.