Files
OpenNoodl/scripts/noodl-editor/git/clean-up.ts
Michael Cartner b9c60b07dc Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com>
Co-Authored-By: Johan  <4934465+joolsus@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
2024-01-26 11:52:55 +01:00

33 lines
1.0 KiB
TypeScript

import { unlinkSync } from 'fs-extra';
import path from 'path';
export function gitCleanUp(options: { gitDir: string; architecture: string }) {
if (process.platform === 'win32') {
console.log('Noodl Build: Cleaning unneeded Git components…');
const files = [
'Bitbucket.Authentication.dll',
'GitHub.Authentication.exe',
'Microsoft.Alm.Authentication.dll',
'Microsoft.Alm.Git.dll',
'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll',
'Microsoft.IdentityModel.Clients.ActiveDirectory.dll',
'Microsoft.Vsts.Authentication.dll',
'git-askpass.exe',
'git-credential-manager.exe',
'WebView2Loader.dll'
];
const mingwFolder = options.architecture === 'x64' ? 'mingw64' : 'mingw32';
const gitCoreDir = path.join(options.gitDir, mingwFolder, 'libexec', 'git-core');
for (const file of files) {
const filePath = path.join(gitCoreDir, file);
try {
unlinkSync(filePath);
} catch (err) {
// probably already cleaned up
}
}
}
}