Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug 27332508: disable auto install dependencies for manifest-only office add-in #11234

Merged
merged 13 commits into from
May 23, 2024
11 changes: 9 additions & 2 deletions packages/vscode-extension/src/officeDevHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,14 @@ export async function autoOpenOfficeDevProjectHandler(): Promise<void> {
await globalStateUpdate(GlobalKey.OpenSampleReadMe, false);
}
if (autoInstallDependency) {
void popupOfficeAddInDependenciesMessage();
if (!isManifestOnlyAddin(globalVariables.workspaceUri?.fsPath ?? ""))
void popupOfficeAddInDependenciesMessage();
await globalStateUpdate(GlobalKey.AutoInstallDependency, false);
}
if (
globalVariables.isOfficeAddInProject &&
!checkOfficeAddInInstalled(globalVariables.workspaceUri?.fsPath ?? "")
!checkOfficeAddInInstalled(globalVariables.workspaceUri?.fsPath ?? "") &&
!isManifestOnlyAddin(globalVariables.workspaceUri?.fsPath ?? "")
) {
void popupOfficeAddInDependenciesMessage();
}
Expand All @@ -251,3 +253,8 @@ export function checkOfficeAddInInstalled(directory: string): boolean {
const nodeModulesExists = fs.existsSync(path.join(directory, "node_modules"));
return nodeModulesExists;
}

export function isManifestOnlyAddin(directory: string): boolean {
const srcPath = path.join(directory, "src");
richard6094 marked this conversation as resolved.
Show resolved Hide resolved
return !fs.existsSync(srcPath);
}