Skip to content

Commit ed3672a

Browse files
authored
Merge pull request #404 from OfficeDev/merge-shared-changes
Merge shared changes
2 parents 4ebbd72 + a1c27f9 commit ed3672a

File tree

7 files changed

+2013
-4306
lines changed

7 files changed

+2013
-4306
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 & 5 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
{
@@ -72,8 +69,6 @@
7269
"webRoot": "${workspaceRoot}",
7370
"preLaunchTask": "Debug: Excel Desktop",
7471
"postDebugTask": "Stop Debug"
75-
},
76-
{
7772
}
7873
]
7974
}

.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"

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",

0 commit comments

Comments
 (0)