From 6e3d754ff6c344c5406318f90268d454ac9da9ea Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 16 Apr 2021 09:34:43 -0500 Subject: [PATCH] Fix postinstall script, $(pwd) resolving incorrectly on AppVeyor --- scripts/postinstall.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 4f12d3cda5..eae2e8335f 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -101,7 +101,8 @@ function downloadMailsync() { // For speed, we cache app/node_modules. However, we need to // be sure to do a full rebuild of native node modules when the // Electron version changes. To do this we check a marker file. -const appModulesPath = path.resolve(__dirname, '..', 'app', 'node_modules'); +const appPath = path.resolve(__dirname, '..', 'app'); +const appModulesPath = path.resolve(appPath, 'node_modules'); const cacheVersionPath = path.join(appModulesPath, '.postinstall-target-version'); const cacheElectronTarget = fs.existsSync(cacheVersionPath) && fs.readFileSync(cacheVersionPath).toString(); @@ -139,11 +140,12 @@ async function run() { await npm(`ls`, { cwd: './app', env: 'electron' }); // rebuild sqlite3 using our custom amalgamation, which has USLEEP enabled - if (await sqliteMissingUsleep()) { + if (process.platform === 'win32' || (await sqliteMissingUsleep())) { rimraf.sync(path.join(appModulesPath, 'better-sqlite3')); + const amalgamationPath = path.join(appPath, 'build', 'sqlite-amalgamation'); await npm( `install better-sqlite3@${appDependencies['better-sqlite3']} ` + - `--no-save --no-audit --build-from-source --sqlite3="$(pwd)/build/sqlite-amalgamation"`, + `--no-save --no-audit --build-from-source --sqlite3="${amalgamationPath}"`, { cwd: './app', env: 'electron' } ); }