Skip to content

Commit 5fa91a3

Browse files
committed
Merge branch 'master' into merge-master-to-shared
2 parents 6f35851 + 2468366 commit 5fa91a3

File tree

12 files changed

+10726
-20873
lines changed

12 files changed

+10726
-20873
lines changed

.github/fabricbot.json

Lines changed: 0 additions & 482 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
id:
2+
name: GitOps.PullRequestIssueManagement
3+
description: GitOps.PullRequestIssueManagement primitive
4+
owner:
5+
resource: repository
6+
disabled: false
7+
where:
8+
configuration:
9+
resourceManagementConfiguration:
10+
scheduledSearches:
11+
- description:
12+
frequencies:
13+
- hourly:
14+
hour: 3
15+
filters:
16+
- isIssue
17+
- isOpen
18+
- hasLabel:
19+
label: 'Needs: author feedback'
20+
- noActivitySince:
21+
days: 4
22+
- isNotLabeledWith:
23+
label: 'Status: no recent activity'
24+
actions:
25+
- addLabel:
26+
label: 'Status: no recent activity'
27+
- addReply:
28+
reply: This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**. Thank you for your interest in Office Add-ins!
29+
- description:
30+
frequencies:
31+
- hourly:
32+
hour: 3
33+
filters:
34+
- isIssue
35+
- isOpen
36+
- hasLabel:
37+
label: 'Needs: author feedback'
38+
- hasLabel:
39+
label: 'Status: no recent activity'
40+
- noActivitySince:
41+
days: 3
42+
actions:
43+
- addReply:
44+
reply: This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.
45+
- closeIssue
46+
eventResponderTasks:
47+
- if:
48+
- payloadType: Issues
49+
- isAction:
50+
action: Opened
51+
- not: isAssignedToSomeone
52+
then:
53+
- addLabel:
54+
label: 'Needs: triage :mag:'
55+
description:
56+
- if:
57+
- payloadType: Issues
58+
- not:
59+
isAction:
60+
action: Closed
61+
- hasLabel:
62+
label: 'Status: no recent activity'
63+
then:
64+
- removeLabel:
65+
label: 'Status: no recent activity'
66+
description:
67+
- if:
68+
- payloadType: Issue_Comment
69+
- hasLabel:
70+
label: 'Status: no recent activity'
71+
then:
72+
- removeLabel:
73+
label: 'Status: no recent activity'
74+
description:
75+
- if:
76+
- payloadType: Issue_Comment
77+
- isAction:
78+
action: Created
79+
- isActivitySender:
80+
issueAuthor: True
81+
- hasLabel:
82+
label: 'Needs: author feedback'
83+
then:
84+
- addLabel:
85+
label: 'Needs: attention :wave:'
86+
- removeLabel:
87+
label: 'Needs: author feedback'
88+
description:
89+
onFailure:
90+
onSuccess:

.vscode/tasks.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
// See https://go.microsoft.com/fwlink/?LinkId=733558
3-
// for the documentation about the tasks.json format
42
"version": "2.0.0",
53
"tasks": [
64
{
@@ -34,7 +32,7 @@
3432
"script": "start:desktop -- --app excel",
3533
"presentation": {
3634
"clear": true,
37-
"panel": "dedicated",
35+
"panel": "dedicated"
3836
},
3937
"problemMatcher": []
4038
},
@@ -95,6 +93,6 @@
9593
"panel": "dedicated"
9694
},
9795
"problemMatcher": []
98-
},
96+
}
9997
]
10098
}

assets/color.png

1.04 KB
Loading

assets/outline.png

249 Bytes
Loading

convertToSingleHost.js

Lines changed: 138 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
const fs = require("fs");
44
const path = require("path");
55
const util = require("util");
6+
const childProcess = require("child_process");
7+
8+
const manifestType = process.argv[2];
9+
const projectName = process.argv[3];
10+
let appId = process.argv[4];
611
const testPackages = [
712
"@types/mocha",
813
"@types/node",
@@ -18,12 +23,13 @@ const unlinkFileAsync = util.promisify(fs.unlink);
1823
const writeFileAsync = util.promisify(fs.writeFile);
1924

2025
async function removeTestInfraStructure() {
26+
// Delete test folder
2127
deleteFolder(path.resolve(`./test`));
2228

23-
// delete the .github folder
29+
// Delete the .github folder
2430
deleteFolder(path.resolve(`./.github`));
2531

26-
// delete CI/CD pipeline files
32+
// Delete CI/CD pipeline files
2733
deleteFolder(path.resolve(`./.azure-devops`));
2834

2935
await updatePackageJsonFile();
@@ -45,19 +51,19 @@ async function updatePackageJsonFile() {
4551
}
4652
});
4753

48-
// remove test-related packages
54+
// Remove test-related packages
4955
Object.keys(content.devDependencies).forEach(function (key) {
5056
if (testPackages.includes(key)) {
5157
delete content.devDependencies[key];
5258
}
5359
});
5460

55-
// write updated json to file
61+
// Write updated JSON to file
5662
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
5763
}
5864

5965
async function updateLaunchJsonFile() {
60-
// remove 'Debug Tests' configuration from launch.json
66+
// Remove 'Debug Tests' configuration from launch.json
6167
const launchJson = `.vscode/launch.json`;
6268
const launchJsonContent = await readFileAsync(launchJson, "utf8");
6369
const regex = /(.+{\r?\n.*"name": "Debug (?:UI|Unit) Tests",\r?\n(?:.*\r?\n)*?.*},.*\r?\n)/gm;
@@ -93,10 +99,137 @@ async function deleteSupportFiles() {
9399
await unlinkFileAsync("package-lock.json");
94100
}
95101

102+
async function deleteJSONManifestRelatedFiles() {
103+
await unlinkFileAsync("manifest.json");
104+
await unlinkFileAsync("assets/color.png");
105+
await unlinkFileAsync("assets/outline.png");
106+
}
107+
108+
async function deleteXMLManifestRelatedFiles() {
109+
await unlinkFileAsync("manifest.xml");
110+
}
111+
112+
async function updatePackageJsonForXMLManifest() {
113+
const packageJson = `./package.json`;
114+
const data = await readFileAsync(packageJson, "utf8");
115+
let content = JSON.parse(data);
116+
117+
// Remove scripts that are only used with JSON manifest
118+
delete content.scripts["signin"];
119+
delete content.scripts["signout"];
120+
121+
// Write updated JSON to file
122+
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
123+
}
124+
125+
async function updatePackageJsonForJSONManifest() {
126+
const packageJson = `./package.json`;
127+
const data = await readFileAsync(packageJson, "utf8");
128+
let content = JSON.parse(data);
129+
130+
// Remove special start scripts
131+
Object.keys(content.scripts).forEach(function (key) {
132+
if (key.includes("start:")) {
133+
delete content.scripts[key];
134+
}
135+
});
136+
137+
// Change manifest file name extension
138+
content.scripts.start = "office-addin-debugging start manifest.json";
139+
content.scripts.stop = "office-addin-debugging stop manifest.json";
140+
content.scripts.validate = "office-addin-manifest validate manifest.json";
141+
142+
// Write updated JSON to file
143+
await writeFileAsync(packageJson, JSON.stringify(content, null, 2));
144+
}
145+
146+
async function updateTasksJsonFileForJSONManifest() {
147+
const tasksJson = `.vscode/tasks.json`;
148+
const data = await readFileAsync(tasksJson, "utf8");
149+
let content = JSON.parse(data);
150+
151+
content.tasks.forEach(function (task) {
152+
if (task.label.startsWith("Build")) {
153+
task.dependsOn = ["Install"];
154+
}
155+
if (task.label === "Debug: Outlook Desktop") {
156+
task.script = "start";
157+
task.dependsOn = ["Check OS", "Install"];
158+
}
159+
});
160+
161+
const checkOSTask = {
162+
label: "Check OS",
163+
type: "shell",
164+
windows: {
165+
command: "echo 'Sideloading in Outlook on Windows is supported'",
166+
},
167+
linux: {
168+
command: "echo 'Sideloading on Linux is not supported' && exit 1",
169+
},
170+
osx: {
171+
command: "echo 'Sideloading in Outlook on Mac is not supported' && exit 1",
172+
},
173+
presentation: {
174+
clear: true,
175+
panel: "dedicated",
176+
},
177+
};
178+
179+
content.tasks.push(checkOSTask);
180+
await writeFileAsync(tasksJson, JSON.stringify(content, null, 2));
181+
}
182+
183+
async function updateWebpackConfigForJSONManifest() {
184+
const webPack = `webpack.config.js`;
185+
const webPackContent = await readFileAsync(webPack, "utf8");
186+
const updatedContent = webPackContent.replace(".xml", ".json");
187+
await writeFileAsync(webPack, updatedContent);
188+
}
189+
190+
async function modifyProjectForJSONManifest() {
191+
await updatePackageJsonForJSONManifest();
192+
await updateWebpackConfigForJSONManifest();
193+
await updateTasksJsonFileForJSONManifest();
194+
await deleteXMLManifestRelatedFiles();
195+
}
196+
197+
96198
/**
97199
* Remove test infrastructure and repo support files from project.
98200
*/
99201
removeTestInfraStructure().catch((err) => {
100202
console.error(`Error: ${err instanceof Error ? err.message : err}`);
101203
process.exitCode = 1;
102204
});
205+
206+
let manifestPath = "manifest.xml";
207+
208+
// Uncomment when template supports JSON manifest
209+
// if (host !== "outlook" || manifestType !== "json") {
210+
// Remove things that are only relevant to JSON manifest
211+
deleteJSONManifestRelatedFiles();
212+
updatePackageJsonForXMLManifest();
213+
// } else {
214+
// manifestPath = "manifest.json";
215+
// modifyProjectForJSONManifest().catch((err) => {
216+
// console.error(`Error modifying for JSON manifest: ${err instanceof Error ? err.message : err}`);
217+
// process.exitCode = 1;
218+
// });
219+
// }
220+
221+
if (projectName) {
222+
if (!appId) {
223+
appId = "random";
224+
}
225+
226+
// Modify the manifest to include the name and id of the project
227+
const cmdLine = `npx office-addin-manifest modify ${manifestPath} -g ${appId} -d ${projectName}`;
228+
childProcess.exec(cmdLine, (error, stdout) => {
229+
if (error) {
230+
Promise.reject(stdout);
231+
} else {
232+
Promise.resolve();
233+
}
234+
});
235+
}

0 commit comments

Comments
 (0)