Skip to content

Commit

Permalink
Merge pull request #1698 from Icenium/kerezov/fix-export-diff
Browse files Browse the repository at this point in the history
Fix export when different solution name from project name
  • Loading branch information
Mitko-Kerezov authored Nov 29, 2017
2 parents 6f5cc8c + 1fa6039 commit adfb774
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ The AppBuilder CLI lets you build, test, deploy, and publish cross-platform hybr
Installation
===

Latest version: AppBuilder 3.7.7
<br/>Release date: Nov 10, 2017
Latest version: AppBuilder 3.7.8
<br/>Release date: Nov 30, 2017

> AppBuilder 3.7.7 is an update release. For a complete list of the improvements and updates available in this release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7-5" target="_blank">AppBuilder 3.7.7 Release Notes</a>.<br/>For a complete list of the improvements and updates available in the earlier major release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7" target="_blank">AppBuilder 3.7 Release Notes</a>.
> AppBuilder 3.7.8 is an update release. For a complete list of the improvements and updates available in this release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7-5" target="_blank">AppBuilder 3.7.8 Release Notes</a>.<br/>For a complete list of the improvements and updates available in the earlier major release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7" target="_blank">AppBuilder 3.7 Release Notes</a>.
### System Requirements

Expand Down Expand Up @@ -374,10 +374,10 @@ If addressing the configuration issues does not resolve your problem, you can [r
Features
===

Latest version: AppBuilder 3.7.6
<br/>Release date: Oct 02, 2017
Latest version: AppBuilder 3.7.8
<br/>Release date: Nov 30, 2017

> AppBuilder 3.7.6 is an update release. For a complete list of the improvements and updates available in this release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7-5" target="_blank">AppBuilder 3.7.6 Release Notes</a>.<br/>For a complete list of the improvements and updates available in the earlier major release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7" target="_blank">AppBuilder 3.7 Release Notes</a>.
> AppBuilder 3.7.8 is an update release. For a complete list of the improvements and updates available in this release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7-5" target="_blank">AppBuilder 3.7.8 Release Notes</a>.<br/>For a complete list of the improvements and updates available in the earlier major release, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v3-7" target="_blank">AppBuilder 3.7 Release Notes</a>.
#### What you can do with this version of the AppBuilder CLI

Expand Down
2 changes: 1 addition & 1 deletion docs/man_pages/project/creation/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export

Usage | Synopsis
------|-------
Export selected project from solution so that it can be used with Cordova CLI | `$ appbuilder cloud export [<Solution Name or Index> [<Project Name or Index> [--path <Directory or File>]]]`
Export selected project from solution so that it can be used with Cordova CLI | `$ appbuilder export [<Solution Name or Index> [<Project Name or Index> [--path <Directory or File>]]]`

Exports a cloud-based project from a selected solution to facilitate the migration to a different framework. NativeScript projects can be developed with the NativeScript CLI, whereas Hybrid projects can be developed with the Cordova CLI.

Expand Down
4 changes: 2 additions & 2 deletions lib/commands/cloud-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class SolutionIdCommandParameter implements ICommandParameter {

public async validate(validationValue?: string): Promise<boolean> {
if (validationValue) {
let app = await this.$remoteProjectService.getSolutionData(validationValue);
return !!app;
const { solutionData } = await this.$remoteProjectService.getSolutionData(validationValue);
return !!solutionData;
}

return false;
Expand Down
7 changes: 6 additions & 1 deletion lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ interface ILoginManager {
telerikLogin(user: string, password: string): Promise<void>;
}

interface SolutionFullInfo {
solutionData: Server.SolutionData;
solutionName: string;
}

declare module Server.Contract {
interface IParameter {
name: string;
Expand Down Expand Up @@ -902,7 +907,7 @@ interface IRemoteProjectService {
exportProject(remoteSolutionName: string, remoteProjectName: string): Promise<void>;
exportSolution(remoteSolutionName: string): Promise<void>;
getAvailableAppsAndSolutions(): Promise<ITapAppData[]>;
getSolutionData(propertyValue: string): Promise<Server.SolutionData>;
getSolutionData(propertyValue: string): Promise<SolutionFullInfo>;
}

interface IProjectSimulatorService {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/cloud-projects-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CloudProjectsService implements ICloudProjectsService {
opts.solutionName = await this.$prompter.promptForChoice("Select solution to export", solutionNames);
}

const solutionData = await this.$remoteProjectService.getSolutionData(opts.solutionName);
const { solutionData, solutionName } = await this.$remoteProjectService.getSolutionData(opts.solutionName);
if (!solutionData.Items || !solutionData.Items.length) {
this.$errors.failWithoutHelp(`Solution ${solutionData.Name} does not contain any projects.`);
}
Expand All @@ -37,7 +37,7 @@ export class CloudProjectsService implements ICloudProjectsService {
opts.projectName = await this.$remoteProjectService.getProjectName(opts.solutionName, opts.projectName);
const solution = solutionData.Items[0];
framework = solution.Framework.toLowerCase() === "nativescript" ? "tns" : solution.Framework;
const app = apps.find(sln => sln.colorizedDisplayName === solution.Name);
const app = apps.find(sln => sln.colorizedDisplayName === solutionName);
id = app && app.id;
}

Expand Down
12 changes: 8 additions & 4 deletions lib/services/remote-projects-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class RemoteProjectService implements IRemoteProjectService {
let app = await this.getApp(appId);

if (!(this.clientProjectsPerSolution[app.id] && this.clientProjectsPerSolution[app.id].length > 0)) {
this.clientProjectsPerSolution[app.id] = _.sortBy((await this.getSolutionDataCore(app)).Items, project => project.Name);
this.clientProjectsPerSolution[app.id] = _.sortBy((await this.getSolutionDataCore(app)).solutionData.Items, project => project.Name);
}

return this.clientProjectsPerSolution[app.id];
Expand All @@ -76,7 +76,7 @@ export class RemoteProjectService implements IRemoteProjectService {
this.$logger.info("%s has been successfully exported to %s", slnName, solutionDir);
}

public async getSolutionData(solutionIdentifier: string): Promise<Server.SolutionData> {
public async getSolutionData(solutionIdentifier: string): Promise<SolutionFullInfo> {
let app = await this.getApp(solutionIdentifier);
return await this.getSolutionDataCore(app);
}
Expand All @@ -89,9 +89,13 @@ export class RemoteProjectService implements IRemoteProjectService {
return this._isMigrationEnabledForUser;
}

private async getSolutionDataCore(app: ITapAppData): Promise<Server.SolutionData> {
private async getSolutionDataCore(app: ITapAppData): Promise<SolutionFullInfo> {
let name = app.isApp ? app.id : app.name;
return this.$serviceProxy.makeTapServiceCall(() => this.$server.apps.getApplication(name), { discardSolutionSpaceHeader: app.isApp });
const solutionData = await this.$serviceProxy.makeTapServiceCall(() => this.$server.apps.getApplication(name), { discardSolutionSpaceHeader: app.isApp });
return {
solutionData,
solutionName: app.colorizedDisplayName
};
}

private async getProjectData(solutionName: string, projectName: string): Promise<Server.IWorkspaceItemData> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "appbuilder",
"preferGlobal": true,
"version": "3.7.7",
"version": "3.7.8",
"author": "Telerik <[email protected]>",
"description": "command line interface to Telerik AppBuilder",
"bin": {
Expand Down

0 comments on commit adfb774

Please sign in to comment.