Skip to content

Commit

Permalink
Fix postinstall script, $(pwd) resolving incorrectly on AppVeyor
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed Apr 16, 2021
1 parent c10b917 commit 6e3d754
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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' }
);
}
Expand Down

0 comments on commit 6e3d754

Please sign in to comment.