Skip to content

Commit 9a3ca73

Browse files
authored
Merge pull request #410 from OfficeDev/master
Merge master to yo-office
2 parents 6b05fac + 0e4673e commit 9a3ca73

16 files changed

+2010
-4409
lines changed

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// List of extensions which should be recommended for users of this workspace.
66
"recommendations": [
77
"ms-edgedevtools.vscode-edge-devtools",
8-
"msoffice.microsoft-office-add-in-debugger",
98
"dbaeumer.vscode-eslint",
109
"esbenp.prettier-vscode"
1110
],

.vscode/launch.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
74
{
@@ -42,16 +39,6 @@
4239
"internalConsoleOptions": "openOnSessionStart",
4340
"runtimeArgs": ["--preserve-symlinks"]
4441
},
45-
{
46-
"name": "Excel Desktop (Custom Functions)",
47-
"type": "node",
48-
"request": "attach",
49-
"port": 9223,
50-
"timeout": 600000,
51-
"preLaunchTask": "Debug: Excel Desktop",
52-
"postDebugTask": "Stop Debug",
53-
"resolveSourceMapLocations": null
54-
},
5542
{
5643
"name": "Excel Desktop (Edge Chromium)",
5744
"type": "msedge",
@@ -72,8 +59,6 @@
7259
"webRoot": "${workspaceRoot}",
7360
"preLaunchTask": "Debug: Excel Desktop",
7461
"postDebugTask": "Stop Debug"
75-
},
76-
{
7762
}
7863
]
7964
}

.vscode/tasks.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@
2828
},
2929
{
3030
"label": "Debug: Excel Desktop",
31-
"type": "npm",
32-
"script": "start:desktop -- --app excel",
31+
"type": "shell",
32+
"command": "npm",
33+
"args": [
34+
"run",
35+
"start:desktop",
36+
"--",
37+
"--app",
38+
"excel"
39+
],
3340
"presentation": {
3441
"clear": true,
3542
"panel": "dedicated"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You might also qualify for a free developer subscription that's renewable for 90
2626
- [Custom functions best practices](https://learn.microsoft.com/office/dev/add-ins/excel/custom-functions-best-practices)
2727
- [Custom functions runtime](https://learn.microsoft.com/office/dev/add-ins/excel/custom-functions-runtime)
2828
- [Office Add-ins documentation](https://learn.microsoft.com/office/dev/add-ins/overview/office-add-ins)
29-
- More Office Add-ins samples at [OfficeDev on Github](https://github.com/officedev)
29+
- [Office Add-ins samples](https://github.com/OfficeDev/Office-Add-in-samples)
3030

3131
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
3232

convertToSingleHost.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function removeTestInfraStructure() {
3333
deleteFolder(path.resolve(`./.azure-devops`));
3434

3535
await updatePackageJsonFile();
36-
await updateLaunchJsonFile();
36+
await updateLaunchJsonFile("excel");
3737
// delete this script
3838
await unlinkFileAsync("./convertToSingleHost.js");
3939
await deleteSupportFiles();
@@ -62,13 +62,34 @@ async function updatePackageJsonFile() {
6262
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
6363
}
6464

65-
async function updateLaunchJsonFile() {
65+
async function updateLaunchJsonFile(host) {
6666
// Remove 'Debug Tests' configuration from launch.json
6767
const launchJson = `.vscode/launch.json`;
6868
const launchJsonContent = await readFileAsync(launchJson, "utf8");
69-
const regex = /(.+{\r?\n.*"name": "Debug (?:UI|Unit) Tests",\r?\n(?:.*\r?\n)*?.*},.*\r?\n)/gm;
70-
const updatedContent = launchJsonContent.replace(regex, "");
71-
await writeFileAsync(launchJson, updatedContent);
69+
let content = JSON.parse(launchJsonContent);
70+
content.configurations = content.configurations.filter(function (config) {
71+
return config.name.startsWith(getHostName(host));
72+
});
73+
await writeFileAsync(launchJson, JSON.stringify(content, null, 2));
74+
}
75+
76+
function getHostName(host) {
77+
switch (host) {
78+
case "excel":
79+
return "Excel";
80+
case "onenote":
81+
return "OneNote";
82+
case "outlook":
83+
return "Outlook";
84+
case "powerpoint":
85+
return "PowerPoint";
86+
case "project":
87+
return "Project";
88+
case "word":
89+
return "Word";
90+
default:
91+
throw new Error(`'${host}' is not a supported host.`);
92+
}
7293
}
7394

7495
function deleteFolder(folder) {
@@ -114,10 +135,6 @@ async function updatePackageJsonForXMLManifest() {
114135
const data = await readFileAsync(packageJson, "utf8");
115136
let content = JSON.parse(data);
116137

117-
// Remove scripts that are only used with JSON manifest
118-
delete content.scripts["signin"];
119-
delete content.scripts["signout"];
120-
121138
// Write updated JSON to file
122139
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
123140
}
@@ -227,9 +244,10 @@ if (projectName) {
227244
const cmdLine = `npx office-addin-manifest modify ${manifestPath} -g ${appId} -d ${projectName}`;
228245
childProcess.exec(cmdLine, (error, stdout) => {
229246
if (error) {
230-
Promise.reject(stdout);
247+
console.error(`Error updating the manifest: ${error}`);
248+
process.exitCode = 1;
231249
} else {
232-
Promise.resolve();
250+
console.log(stdout);
233251
}
234252
});
235253
}

manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json",
2+
"$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json",
33
"id": "f2b103f1-1ab1-4e1b-8f0b-072aa3d4e19d",
44
"manifestVersion": "devPreview",
55
"version": "1.0.0",
@@ -97,19 +97,19 @@
9797
"id": "msgReadGroup",
9898
"label": "Contoso Add-in",
9999
"icons": [
100-
{ "size": 16, "file": "https://localhost:3000/assets/icon-16.png" },
101-
{ "size": 32, "file": "https://localhost:3000/assets/icon-32.png" },
102-
{ "size": 80, "file": "https://localhost:3000/assets/icon-80.png" }
100+
{ "size": 16, "url": "https://localhost:3000/assets/icon-16.png" },
101+
{ "size": 32, "url": "https://localhost:3000/assets/icon-32.png" },
102+
{ "size": 80, "url": "https://localhost:3000/assets/icon-80.png" }
103103
],
104104
"controls": [
105105
{
106106
"id": "msgReadOpenPaneButton",
107107
"type": "button",
108108
"label": "Show Taskpane",
109109
"icons": [
110-
{ "size": 16, "file": "https://localhost:3000/assets/icon-16.png" },
111-
{ "size": 32, "file": "https://localhost:3000/assets/icon-32.png" },
112-
{ "size": 80, "file": "https://localhost:3000/assets/icon-80.png" }
110+
{ "size": 16, "url": "https://localhost:3000/assets/icon-16.png" },
111+
{ "size": 32, "url": "https://localhost:3000/assets/icon-32.png" },
112+
{ "size": 80, "url": "https://localhost:3000/assets/icon-80.png" }
113113
],
114114
"supertip": {
115115
"title": "Show Taskpane",
@@ -122,9 +122,9 @@
122122
"type": "button",
123123
"label": "Perform an action",
124124
"icons": [
125-
{ "size": 16, "file": "https://localhost:3000/assets/icon-16.png" },
126-
{ "size": 32, "file": "https://localhost:3000/assets/icon-32.png" },
127-
{ "size": 80, "file": "https://localhost:3000/assets/icon-80.png" }
125+
{ "size": 16, "url": "https://localhost:3000/assets/icon-16.png" },
126+
{ "size": 32, "url": "https://localhost:3000/assets/icon-32.png" },
127+
{ "size": 80, "url": "https://localhost:3000/assets/icon-80.png" }
128128
],
129129
"supertip": {
130130
"title": "Perform an action",

manifest.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
55
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
6-
<Id>ca968be6-628b-4f14-ba3c-3e614effa9bd</Id>
6+
<Id>19791936-c8fa-48c9-a354-e347c71ae827</Id>
77
<Version>1.0.0.0</Version>
88
<ProviderName>Contoso</ProviderName>
99
<DefaultLocale>en-US</DefaultLocale>
10-
<DisplayName DefaultValue="Excel Custom Functions" />
10+
<DisplayName DefaultValue="Excel Custom Functions Shared Runtime" />
1111
<Description DefaultValue="Write your own Excel functions in TypeScript." />
1212
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
1313
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
@@ -19,9 +19,9 @@
1919
<Host Name="Workbook"/>
2020
</Hosts>
2121
<Requirements>
22-
<Sets DefaultMinVersion="1.1">
23-
<Set Name="CustomFunctionsRuntime" MinVersion="1.1"/>
24-
</Sets>
22+
<Sets DefaultMinVersion="1.1">
23+
<Set Name="SharedRuntime" MinVersion="1.1"/>
24+
</Sets>
2525
</Requirements>
2626
<DefaultSettings>
2727
<SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
@@ -30,13 +30,16 @@
3030
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
3131
<Hosts>
3232
<Host xsi:type="Workbook">
33+
<Runtimes>
34+
<Runtime resid="Taskpane.Url" lifetime="long" />
35+
</Runtimes>
3336
<AllFormFactors>
3437
<ExtensionPoint xsi:type="CustomFunctions">
3538
<Script>
3639
<SourceLocation resid="Functions.Script.Url" />
3740
</Script>
3841
<Page>
39-
<SourceLocation resid="Functions.Page.Url"/>
42+
<SourceLocation resid="Taskpane.Url"/>
4043
</Page>
4144
<Metadata>
4245
<SourceLocation resid="Functions.Metadata.Url" />
@@ -50,7 +53,7 @@
5053
<Description resid="GetStarted.Description"/>
5154
<LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
5255
</GetStarted>
53-
<FunctionFile resid="Commands.Url" />
56+
<FunctionFile resid="Taskpane.Url"/>
5457
<ExtensionPoint xsi:type="PrimaryCommandSurface">
5558
<OfficeTab id="TabHome">
5659
<Group id="CommandsGroup">
@@ -89,12 +92,10 @@
8992
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
9093
</bt:Images>
9194
<bt:Urls>
92-
<bt:Url id="Functions.Script.Url" DefaultValue="https://localhost:3000/public/functions.js" />
93-
<bt:Url id="Functions.Metadata.Url" DefaultValue="https://localhost:3000/public/functions.json" />
94-
<bt:Url id="Functions.Page.Url" DefaultValue="https://localhost:3000/public/functions.html" />
95+
<bt:Url id="Functions.Script.Url" DefaultValue="https://localhost:3000/functions.js" />
96+
<bt:Url id="Functions.Metadata.Url" DefaultValue="https://localhost:3000/functions.json" />
9597
<bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
96-
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html" />
97-
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html" />
98+
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
9899
</bt:Urls>
99100
<bt:ShortStrings>
100101
<bt:String id="Functions.Namespace" DefaultValue="CONTOSO" />
@@ -108,4 +109,4 @@
108109
</bt:LongStrings>
109110
</Resources>
110111
</VersionOverrides>
111-
</OfficeApp>
112+
</OfficeApp>

0 commit comments

Comments
 (0)