Skip to content

tns update should check for platforms installed in package.json but missing in platforms folder #2186

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
Nov 2, 2016
Merged
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
15 changes: 15 additions & 0 deletions lib/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export class UpdateCommand implements ICommand {
constructor(
private $projectData: IProjectData,
private $platformService: IPlatformService,
private $platformsData: IPlatformsData,
private $pluginsService: IPluginsService,
private $projectDataService: IProjectDataService,
private $logger: ILogger,
private $options: IOptions,
private $errors: IErrors) { }
Expand Down Expand Up @@ -51,6 +53,18 @@ export class UpdateCommand implements ICommand {

private executeCore(args: string[], folders: string[]) {
let platforms = this.$platformService.getInstalledPlatforms().wait();
let availablePlatforms = this.$platformService.getAvailablePlatforms().wait();
let packagePlatforms: string[] = [];

this.$projectDataService.initialize(this.$projectData.projectDir);
for (let platform of availablePlatforms) {
let platformData = this.$platformsData.getPlatformData(platform);
let platformVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait();
if (platformVersion) {
packagePlatforms.push(platform);
this.$projectDataService.removeProperty(platformData.frameworkPackageName).wait();
}
}

this.$platformService.removePlatforms(platforms).wait();
this.$pluginsService.remove("tns-core-modules").wait();
Expand All @@ -60,6 +74,7 @@ export class UpdateCommand implements ICommand {
shelljs.rm("-fr", folder);
}

platforms = platforms.concat(packagePlatforms);
if (args.length === 1) {
for (let platform of platforms) {
this.$platformService.addPlatforms([ platform+"@"+args[0] ]).wait();
Expand Down