Skip to content

Commit

Permalink
Merge pull request #11714 from GavinGu07/user/gaingu/xml_create_migra…
Browse files Browse the repository at this point in the history
…tion

refactor: migrate office xml addin generator
  • Loading branch information
1openwindow authored Jun 21, 2024
2 parents 9347223 + 91c2e9e commit 685c77e
Show file tree
Hide file tree
Showing 24 changed files with 679 additions and 1,279 deletions.
34 changes: 0 additions & 34 deletions packages/fx-core/resource/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,40 +379,6 @@
"core.createProjectQuestion.apiSpec.multipleValidationErrors.message": "Incompatible OpenAPI description document. Check output panel for details.",
"core.createProjectQuestion.apiSpec.multipleValidationErrors.vscode.message": "Incompatible OpenAPI description document. Check [output panel](command:fx-extension.showOutputChannel) for details.",
"core.createProjectQuestion.meArchitecture.title": "Architecture of Search Based Message Extension",
"core.createProjectQuestion.officeXMLAddin.bar.title": "Office Add-in",
"core.createProjectQuestion.officeXMLAddin.bar.detail": "Creating Project.",
"core.createProjectQuestion.officeXMLAddin.mainEntry.title": "Office Add-in",
"core.createProjectQuestion.officeXMLAddin.mainEntry.detail": "Create integration with Outlook, Word, Excel, or PowerPoint",
"core.createProjectQuestion.officeXMLAddin.create.title": "Select to Create an Outlook, Word, Excel, or PowerPoint Add-in",
"core.createProjectQuestion.officeXMLAddin.word.title": "Word Add-in",
"core.createProjectQuestion.officeXMLAddin.word.detail": "Create an add-in that can run in Word across multiple platforms",
"core.createProjectQuestion.officeXMLAddin.word.sso.title": "Add-in with Single Sign On",
"core.createProjectQuestion.officeXMLAddin.word.sso.detail": "Create a Word add-in with Single Sign On capabilities",
"core.createProjectQuestion.officeXMLAddin.word.react.title": "Add-in with React Framework",
"core.createProjectQuestion.officeXMLAddin.word.react.detail": "Create a Word add-in with React framework",
"core.createProjectQuestion.officeXMLAddin.word.create.title": "Create a Word Add-in",
"core.createProjectQuestion.officeXMLAddin.excel.title": "Excel Add-in",
"core.createProjectQuestion.officeXMLAddin.excel.detail": "Extend Excel functionality and access Excel data on multiple platforms",
"core.createProjectQuestion.officeXMLAddin.excel.sso.title": "Add-in with Single Sign On",
"core.createProjectQuestion.officeXMLAddin.excel.sso.detail": "Create an Excel add-in with Single Sign On capabilities",
"core.createProjectQuestion.officeXMLAddin.excel.react.title": "Add-in with React Framework",
"core.createProjectQuestion.officeXMLAddin.excel.react.detail": "Create an Excel add-in with React framework",
"core.createProjectQuestion.officeXMLAddin.excel.cf.shared.title": "Excel Custom Functions Using Shared Runtime",
"core.createProjectQuestion.officeXMLAddin.excel.cf.shared.detail": "Create an Excel add-in leveraging Custom Functions using a Shared Runtime",
"core.createProjectQuestion.officeXMLAddin.excel.cf.js.title": "Excel Custom Functions Using JavaScript-only Runtime",
"core.createProjectQuestion.officeXMLAddin.excel.cf.js.detail": "Create an Excel add-in leveraging Custom Functions using a JavaScript-only Runtime",
"core.createProjectQuestion.officeXMLAddin.excel.create.title": "Create Excel Add-in",
"core.createProjectQuestion.officeXMLAddin.powerpoint.title": "PowerPoint Add-in",
"core.createProjectQuestion.officeXMLAddin.powerpoint.detail": "Build engaging solutions for presentations across platform",
"core.createProjectQuestion.officeXMLAddin.powerpoint.sso.title": "Add-in with Single Sign On",
"core.createProjectQuestion.officeXMLAddin.powerpoint.sso.detail": "PowerPoint add-in with Single Sign On capabilities",
"core.createProjectQuestion.officeXMLAddin.powerpoint.react.title": "Add-in with React Framework",
"core.createProjectQuestion.officeXMLAddin.powerpoint.react.detail": "Create a PowerPoint add-in with React framework",
"core.createProjectQuestion.officeXMLAddin.powerpoint.create.title": "Create a PowerPoint Add-in",
"core.createProjectQuestion.officeXMLAddin.taskpane.title": "Add-in with Basic Task Pane",
"core.createProjectQuestion.officeXMLAddin.taskpane.detail": "Customize the Ribbon with a button and create a dashboard in the Task Pane",
"core.createProjectQuestion.officeXMLAddin.manifestOnly.title": "Add-in Project With only Manifest File",
"core.createProjectQuestion.officeXMLAddin.manifestOnly.detail": "Create an add-in project that includes only the manifest file",
"core.aiAssistantBotOption.label": "AI Agent Bot",
"core.aiAssistantBotOption.detail": "A custom AI Agent bot in Teams using Teams AI library and OpenAI Assistants API",
"core.aiBotOption.label": "AI Chat Bot",
Expand Down
16 changes: 2 additions & 14 deletions packages/fx-core/src/component/coordinator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
CapabilityOptions,
CustomCopilotRagOptions,
MeArchitectureOptions,
OfficeAddinHostOptions,
ProjectTypeOptions,
QuestionNames,
ScratchOptions,
Expand All @@ -61,7 +60,6 @@ import { CopilotPluginGenerator } from "../generator/copilotPlugin/generator";
import { Generator } from "../generator/generator";
import { Generators } from "../generator/generatorProvider";
import { OfficeAddinGenerator } from "../generator/officeAddin/generator";
import { OfficeXMLAddinGenerator } from "../generator/officeXMLAddin/generator";
import { SPFxGenerator } from "../generator/spfx/spfxGenerator";
import { Feature2TemplateName } from "../generator/templates/templateNames";
import { convertToLangKey } from "../generator/utils";
Expand Down Expand Up @@ -191,18 +189,8 @@ class Coordinator {
const res = await SPFxGenerator.generate(context, inputs, projectPath);
if (res.isErr()) return err(res.error);
} else if (ProjectTypeOptions.officeAddinAllIds().includes(projectType)) {
const addinHost = inputs[QuestionNames.OfficeAddinHost];
if (
projectType === ProjectTypeOptions.officeXMLAddin().id &&
addinHost &&
addinHost !== OfficeAddinHostOptions.outlook().id
) {
const res = await OfficeXMLAddinGenerator.generate(context, inputs, projectPath);
if (res.isErr()) return err(res.error);
} else {
const res = await OfficeAddinGenerator.generate(context, inputs, projectPath);
if (res.isErr()) return err(res.error);
}
const res = await OfficeAddinGenerator.generate(context, inputs, projectPath);
if (res.isErr()) return err(res.error);
} else if (capability === CapabilityOptions.copilotPluginApiSpec().id) {
const res = await CopilotPluginGenerator.generatePluginFromApiSpec(
context,
Expand Down
2 changes: 0 additions & 2 deletions packages/fx-core/src/component/generator/generatorProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// Licensed under the MIT license.
import { CopilotGenerator } from "./copilotPlugin/generator";
import { OfficeAddinGeneratorNew } from "./officeAddin/generator";
import { OfficeXmlAddinGeneratorNew } from "./officeXMLAddin/generator";
import { SPFxGeneratorImport, SPFxGeneratorNew } from "./spfx/spfxGenerator";
import { SsrTabGenerator } from "./templates/ssrTabGenerator";
import { DefaultTemplateGenerator } from "./templates/templateGenerator";

// When multiple generators are activated, only the top one will be executed.
export const Generators = [
new OfficeAddinGeneratorNew(),
new OfficeXmlAddinGeneratorNew(),
new SsrTabGenerator(),
new DefaultTemplateGenerator(),
new SPFxGeneratorNew(),
Expand Down
12 changes: 2 additions & 10 deletions packages/fx-core/src/component/generator/officeAddin/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { getLocalizedString } from "../../../common/localizeUtils";
import { assembleError } from "../../../error";
import {
CapabilityOptions,
OfficeAddinHostOptions,
ProgrammingLanguage,
ProjectTypeOptions,
QuestionNames,
Expand Down Expand Up @@ -108,11 +107,7 @@ export class OfficeAddinGenerator {
const capability = inputs[QuestionNames.Capabilities];
const inputHost = inputs[QuestionNames.OfficeAddinHost];
let host: string = inputHost;
if (
projectType === ProjectTypeOptions.outlookAddin().id ||
(projectType === ProjectTypeOptions.officeXMLAddin().id &&
inputHost === OfficeAddinHostOptions.outlook().id)
) {
if (projectType === ProjectTypeOptions.outlookAddin().id) {
host = "outlook";
} else if (projectType === ProjectTypeOptions.officeAddin().id) {
if (capability === "json-taskpane") {
Expand All @@ -133,10 +128,7 @@ export class OfficeAddinGenerator {
if (!fromFolder) {
// from template
const framework = getOfficeAddinFramework(inputs);
const templateConfig = getOfficeAddinTemplateConfig(
projectType,
inputs[QuestionNames.OfficeAddinHost]
);
const templateConfig = getOfficeAddinTemplateConfig();
const projectLink = templateConfig[capability].framework[framework][language];

// Copy project template files from project repository
Expand Down
249 changes: 0 additions & 249 deletions packages/fx-core/src/component/generator/officeXMLAddin/generator.ts

This file was deleted.

Loading

0 comments on commit 685c77e

Please sign in to comment.