Closed linonetwo closed 1 year ago
Anyway, manually pnpm run postinstall
in node_modules/.pnpm/dugite@2.5.1/node_modules/dugite/package.json
to redownload and extract git binary fixes this.
I'm copying dugite to electron bundled app's Resources/node_modules to fix module resolution in worker_thread. Maybe at sometime I break this by using dereference: true
?
exports.default = async (buildPath, electronVersion, platform, arch, callback) => {
const cwd = path.resolve(buildPath, '..');
const projectRoot = path.resolve(__dirname, '..');
// it has things like `git/bin/libexec/git-core/git-add` link to `git/bin/libexec/git-core/git`, to reduce size, so can't use `dereference: true` here.
// And pnpm will have node_modules/dugite to be a shortcut, can't just copy it with `dereference: false`, have to copy from .pnpm folder
await fs.copy(path.join(projectRoot, 'node_modules', '.pnpm', `dugite@${packageJSON.dependencies.dugite}`, 'node_modules', 'dugite'), path.join(cwd, 'node_modules', 'dugite'), { dereference: false });
I think these files used to be soft link, maybe pnpm break this? Or is this a breaking change in 2.5.1?
I try download from https://github.com/desktop/dugite-native/releases and it is really soft link
So when I pack dugite into electron, it takeup 500MB of size.
Is libexec really necessary? If I use
await GitProcess.exec(['fetch', remoteName, defaultBranchName], dir);
, will you callgit-fetch
in it? Or will you fallback tobin/git
if I delete the libexec folder?