Skip to content

Commit

Permalink
feat: support cli publish (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
nliu-ms committed Apr 12, 2021
1 parent e12f1b6 commit fd5d43d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export class Constants {
public static readonly MANIFEST_FILE = "manifest.json";
public static readonly PLUGIN_NAME = "AppStudioPlugin";
public static readonly PUBLISH_PATH_QUESTION = "manifest-folder";
public static readonly REMOTE_TEAMS_APP_ID = "teams-app-id";
}
11 changes: 10 additions & 1 deletion packages/fx-core/src/plugins/resource/appstudio/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { ConfigFolderName, FxError, NodeType, ok, Plugin, PluginContext, QTreeNode, Result, Stage } from "fx-api";
import { ConfigFolderName, FxError, NodeType, ok, Platform, Plugin, PluginContext, QTreeNode, Result, Stage } from "fx-api";
import { AppStudioPluginImpl } from "./plugin";
import { Constants } from "./constants";

Expand All @@ -24,6 +24,15 @@ export class AppStudioPlugin implements Plugin {
default: `${ctx.root}/.${ConfigFolderName}`
});
appStudioQuestions.addChild(appPath);

if (ctx.platform !== Platform.VSCode) {
const remoteTeamsAppId = new QTreeNode({
type: NodeType.text,
name: Constants.REMOTE_TEAMS_APP_ID,
title: "Please input the teams app id in App Studio"
});
appStudioQuestions.addChild(remoteTeamsAppId);
}
}

return ok(appStudioQuestions);
Expand Down
9 changes: 7 additions & 2 deletions packages/fx-core/src/plugins/resource/appstudio/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { PluginContext, TeamsAppManifest } from "fx-api";
import { PluginContext, TeamsAppManifest, Platform } from "fx-api";
import { AppStudioClient } from "./appStudio";
import { AppStudioError } from "./errors";
import { AppStudioResultFactory } from "./results";
Expand Down Expand Up @@ -73,7 +73,12 @@ export class AppStudioPluginImpl {
}

// Update App in App Studio
const remoteTeamsAppId = ctx.config.getString(REMOTE_TEAMS_APP_ID);
let remoteTeamsAppId: string | undefined = undefined;
if (ctx.platform === Platform.VSCode) {
remoteTeamsAppId = ctx.config.getString(REMOTE_TEAMS_APP_ID);
} else {
remoteTeamsAppId = ctx.answers?.getString(Constants.REMOTE_TEAMS_APP_ID);
}
await publishProgress?.next(`Updating app definition for app ${remoteTeamsAppId} in app studio`);
const manifest: TeamsAppManifest = await fs.readJSON(manifestFile);
const appDefinition = this.convertToAppDefinition(manifest);
Expand Down

0 comments on commit fd5d43d

Please sign in to comment.