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 30ef802
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 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,13 +140,19 @@ 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())) {
// remove the existing build so NPM can't see that it's already present
rimraf.sync(path.join(appModulesPath, 'better-sqlite3'));
// install the module pointing to our local sqlite source with custom #DEFINEs set
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' }
);
// remove the build symlinks so that we can build an installer for the app without
// symlinks out to the sqlite-amalgamation directory.
rimraf.sync(path.join(appModulesPath, 'better-sqlite3', 'build', 'Release', 'obj'));
}

// if SQlite was STILL not built with HAVE_USLEEP, do not ship this build! We need usleep
Expand Down

1 comment on commit 30ef802

@libertyballmarkers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PLEASE I WILL LIKE TO CONFIRM IF YOU CAN HELP BUILD AN OFFICE365 PAGE

Please sign in to comment.