mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 10:41:02 -08:00
fix: use fs extra to copy so dugite works
This commit is contained in:
parent
d145f381a1
commit
6ac150e8a7
1 changed files with 5 additions and 6 deletions
|
|
@ -13,8 +13,7 @@
|
||||||
* Adapted for electron forge https://github.com/electron-userland/electron-forge/issues/2248
|
* Adapted for electron forge https://github.com/electron-userland/electron-forge/issues/2248
|
||||||
*/
|
*/
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs-extra');
|
||||||
const fsExtra = require('fs-extra');
|
|
||||||
const packageJSON = require('../package.json');
|
const packageJSON = require('../package.json');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,7 +39,7 @@ exports.default = async (
|
||||||
const projectRoot = path.resolve(__dirname, '..');
|
const projectRoot = path.resolve(__dirname, '..');
|
||||||
// const appParentPath = path.resolve(buildPath, '..', '..', '..', '..');
|
// const appParentPath = path.resolve(buildPath, '..', '..', '..', '..');
|
||||||
// const appPath = path.join(appParentPath, 'Electron.app');
|
// const appPath = path.join(appParentPath, 'Electron.app');
|
||||||
const shell = platform === 'darwin' ? '/bin/zsh' : undefined;
|
// const shell = platform === 'darwin' ? '/bin/zsh' : undefined;
|
||||||
// const winMacLinuxPlatformName = platform === 'darwin' ? 'mac' : (platform === 'win32' ? 'win' : 'linux');
|
// const winMacLinuxPlatformName = platform === 'darwin' ? 'mac' : (platform === 'win32' ? 'win' : 'linux');
|
||||||
/** delete useless lproj files to make it clean */
|
/** delete useless lproj files to make it clean */
|
||||||
// const lproj = glob.sync('*.lproj', { cwd });
|
// const lproj = glob.sync('*.lproj', { cwd });
|
||||||
|
|
@ -50,7 +49,7 @@ exports.default = async (
|
||||||
.map((dir) => path.join(cwd, dir));
|
.map((dir) => path.join(cwd, dir));
|
||||||
if (platform === 'darwin') {
|
if (platform === 'darwin') {
|
||||||
await Promise.all(pathsToRemove.map(async (dir) => {
|
await Promise.all(pathsToRemove.map(async (dir) => {
|
||||||
await fsExtra.remove(dir);
|
await fs.remove(dir);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
console.log(`copy npm packages with node-worker dependencies with binary (dugite) or __filename usages (tiddlywiki), which can't be prepare properly by webpack`);
|
console.log(`copy npm packages with node-worker dependencies with binary (dugite) or __filename usages (tiddlywiki), which can't be prepare properly by webpack`);
|
||||||
|
|
@ -98,7 +97,7 @@ exports.default = async (
|
||||||
for (const packagePathInNodeModules of packagePathsToCopyDereferenced) {
|
for (const packagePathInNodeModules of packagePathsToCopyDereferenced) {
|
||||||
// some binary may not exist in other platforms, so allow failing here.
|
// some binary may not exist in other platforms, so allow failing here.
|
||||||
try {
|
try {
|
||||||
fs.cpSync(
|
fs.copySync(
|
||||||
path.resolve(sourceNodeModulesFolder, ...packagePathInNodeModules),
|
path.resolve(sourceNodeModulesFolder, ...packagePathInNodeModules),
|
||||||
path.resolve(cwd, 'node_modules', ...packagePathInNodeModules),
|
path.resolve(cwd, 'node_modules', ...packagePathInNodeModules),
|
||||||
{ dereference: true, recursive: true },
|
{ dereference: true, recursive: true },
|
||||||
|
|
@ -117,7 +116,7 @@ exports.default = async (
|
||||||
console.log('Copy dugite');
|
console.log('Copy dugite');
|
||||||
// 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, recursive: true` here.
|
// 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, recursive: 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
|
// 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
|
||||||
fs.cpSync(
|
fs.copySync(
|
||||||
path.join(
|
path.join(
|
||||||
sourceNodeModulesFolder,
|
sourceNodeModulesFolder,
|
||||||
'.pnpm',
|
'.pnpm',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue