Skip to content

Commit 9028614

Browse files
authored
Merge pull request #246 from hermanwenhe/master
cross-repo merge from Office-Addin-TaskPane-React-JS/master
2 parents 8e9892e + 92f5ff0 commit 9028614

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
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 & 3 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
{

convertToSingleHost.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function modifyProjectForSingleHost(host) {
3232
}
3333
await convertProjectToSingleHost(host);
3434
await updatePackageJsonForSingleHost(host);
35-
await updateLaunchJsonFile();
35+
await updateLaunchJsonFile(host);
3636
}
3737

3838
async function convertProjectToSingleHost(host) {
@@ -100,13 +100,34 @@ async function updatePackageJsonForSingleHost(host) {
100100
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
101101
}
102102

103-
async function updateLaunchJsonFile() {
103+
async function updateLaunchJsonFile(host) {
104104
// Remove 'Debug Tests' configuration from launch.json
105105
const launchJson = `.vscode/launch.json`;
106106
const launchJsonContent = await readFileAsync(launchJson, "utf8");
107-
const regex = /(.+{\r?\n.*"name": "Debug (?:UI|Unit) Tests",\r?\n(?:.*\r?\n)*?.*},.*\r?\n)/gm;
108-
const updatedContent = launchJsonContent.replace(regex, "");
109-
await writeFileAsync(launchJson, updatedContent);
107+
let content = JSON.parse(launchJsonContent);
108+
content.configurations = content.configurations.filter(function (config) {
109+
return config.name.startsWith(getHostName(host));
110+
});
111+
await writeFileAsync(launchJson, JSON.stringify(content, null, 2));
112+
}
113+
114+
function getHostName(host) {
115+
switch (host) {
116+
case "excel":
117+
return "Excel";
118+
case "onenote":
119+
return "OneNote";
120+
case "outlook":
121+
return "Outlook";
122+
case "powerpoint":
123+
return "PowerPoint";
124+
case "project":
125+
return "Project";
126+
case "word":
127+
return "Word";
128+
default:
129+
throw new Error(`'${host}' is not a supported host.`);
130+
}
110131
}
111132

112133
function deleteFolder(folder) {

0 commit comments

Comments
 (0)