teamsfx-extension
Version:
Create, debug, and deploy Teams apps with Teams Toolkit
112 lines • 7.97 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.deactivate = exports.activate = void 0;
const vscode = require("vscode");
const extensionVariables_1 = require("./extensionVariables");
const handlers = require("./handlers");
const extTelemetry_1 = require("./telemetry/extTelemetry");
const teamsfxTaskHandler_1 = require("./debug/teamsfxTaskHandler");
const teamsfxTaskProvider_1 = require("./debug/teamsfxTaskProvider");
const teamsfxDebugProvider_1 = require("./debug/teamsfxDebugProvider");
const survey_1 = require("./utils/survey");
const log_1 = require("./commonlib/log");
const StringResources = require("./resources/Strings.json");
const openWelcomePage_1 = require("./controls/openWelcomePage");
function activate(context) {
return __awaiter(this, void 0, void 0, function* () {
log_1.default.info(StringResources.vsc.extension.activate);
// Init context
extensionVariables_1.initializeExtensionVariables(context);
context.subscriptions.push(new extTelemetry_1.ExtTelemetry.Reporter(context));
// 1.1 Register the creating command.
const createCmd = vscode.commands.registerCommand("fx-extension.create", handlers.createNewProjectHandler);
context.subscriptions.push(createCmd);
// 1.2 Register the creating command.
const updateCmd = vscode.commands.registerCommand("fx-extension.update", handlers.updateProjectHandler);
context.subscriptions.push(updateCmd);
// add capability
const addCapCmd = vscode.commands.registerCommand("fx-extension.addCapability", handlers.addCapabilityHandler);
context.subscriptions.push(addCapCmd);
// 1.3 Register the provision command.
const provisionCmd = vscode.commands.registerCommand("fx-extension.provision", handlers.provisionHandler);
context.subscriptions.push(provisionCmd);
// 1.5 Register the deploy command.
const deployCmd = vscode.commands.registerCommand("fx-extension.deploy", handlers.deployHandler);
context.subscriptions.push(deployCmd);
const validateManifestCmd = vscode.commands.registerCommand("fx-extension.validateManifest", handlers.validateManifestHandler);
context.subscriptions.push(validateManifestCmd);
const buildPackageCmd = vscode.commands.registerCommand("fx-extension.build", handlers.buildPackageHandler);
context.subscriptions.push(buildPackageCmd);
const publishCmd = vscode.commands.registerCommand("fx-extension.publish", handlers.publishHandler);
context.subscriptions.push(publishCmd);
// 1.6 update aad command
const updateAadCmd = vscode.commands.registerCommand("fx-extension.updateAad", handlers.updateAADHandler);
context.subscriptions.push(updateAadCmd);
// 1.7 validate dependencies command (hide from UI)
const validateDependenciesCmd = vscode.commands.registerCommand("fx-extension.validate-dependencies", handlers.validateDependenciesHandler);
context.subscriptions.push(validateDependenciesCmd);
const validateSpfxDependenciesCmd = vscode.commands.registerCommand("fx-extension.validate-spfx-dependencies", handlers.validateSpfxDependenciesHandler);
context.subscriptions.push(validateSpfxDependenciesCmd);
// 1.8 pre debug check command (hide from UI)
const preDebugCheckCmd = vscode.commands.registerCommand("fx-extension.pre-debug-check", handlers.preDebugCheckHandler);
context.subscriptions.push(preDebugCheckCmd);
// 1.9 Register backend extensions install command (hide from UI)
const backendExtensionsInstallCmd = vscode.commands.registerCommand("fx-extension.backend-extensions-install", handlers.backendExtensionsInstallHandler);
context.subscriptions.push(backendExtensionsInstallCmd);
// 1.10 Register teamsfx task provider
const taskProvider = new teamsfxTaskProvider_1.TeamsfxTaskProvider();
context.subscriptions.push(vscode.tasks.registerTaskProvider(teamsfxTaskProvider_1.TeamsfxTaskProvider.type, taskProvider));
const openWelcomeCmd = vscode.commands.registerCommand("fx-extension.openWelcome", handlers.openWelcomeHandler);
context.subscriptions.push(openWelcomeCmd);
const openSamplesCmd = vscode.commands.registerCommand("fx-extension.openSamples", handlers.openSamplesHandler);
context.subscriptions.push(openSamplesCmd);
const openDocumentCmd = vscode.commands.registerCommand("fx-extension.openDocument", handlers.openDocumentHandler);
context.subscriptions.push(openDocumentCmd);
const openManifestCmd = vscode.commands.registerCommand("fx-extension.openManifest", handlers.openManifestHandler);
context.subscriptions.push(openManifestCmd);
const openAppManagementCmd = vscode.commands.registerCommand("fx-extension.openAppManagement", handlers.openAppManagement);
context.subscriptions.push(openAppManagementCmd);
const openBotManagementCmd = vscode.commands.registerCommand("fx-extension.openBotManagement", handlers.openBotManagement);
context.subscriptions.push(openBotManagementCmd);
const openReportIssuesCmd = vscode.commands.registerCommand("fx-extension.openReportIssues", handlers.openReportIssues);
context.subscriptions.push(openReportIssuesCmd);
const m365AccountSettingsCmd = vscode.commands.registerCommand("fx-extension.m365AccountSettings", handlers.openM365AccountHandler);
context.subscriptions.push(m365AccountSettingsCmd);
const azureAccountSettingsCmd = vscode.commands.registerCommand("fx-extension.azureAccountSettings", handlers.openAzureAccountHandler);
context.subscriptions.push(azureAccountSettingsCmd);
const cmpAccountsCmd = vscode.commands.registerCommand("fx-extension.cmpAccounts", handlers.cmpAccountsHandler);
context.subscriptions.push(cmpAccountsCmd);
// Register debug configuration provider
const debugProvider = new teamsfxDebugProvider_1.TeamsfxDebugProvider();
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("pwa-chrome", debugProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("chrome", debugProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("pwa-msedge", debugProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider("msedge", debugProvider));
// Register task and debug event handlers, as well as sending telemetries
teamsfxTaskHandler_1.registerTeamsfxTaskAndDebugEvents();
yield handlers.cmdHdlLoadTreeView(context);
// 2. Call activate function of toolkit core.
yield handlers.activate();
const survey = new survey_1.ExtensionSurvey(context);
survey.activate();
openWelcomePage_1.openWelcomePageAfterExtensionInstallation();
});
}
exports.activate = activate;
// this method is called when your extension is deactivated
function deactivate() {
handlers.cmdHdlDisposeTreeView();
}
exports.deactivate = deactivate;
//# sourceMappingURL=extension.js.map