mattermost-desktop/scripts/beforepack.js
Devin Binnie 1e35a97f33
[MM-36326][MM-45669] Added Native Node Module support - incl demo to fix DND issue (#2195)
* [MM-36326] Added Native Node Module support - incl demo to fix DND issue

* Fix OS per build

* Fix to include priority alarms on Windows

* Update node command

* Fixes for mac (only work on non-MAS build)

* Attempt to rebuild properly since electron-builder is having issues with a module

* Show me more logs maybe idk

* Try with ignore-scripts

* Force async to work asyncly

* PR feedback and ESLint fixes

* Add comment for node-gyp

* Revert me: test msi and mac installer

* Revert me too

* Try reverting back to the old system cause the new one miraculously broke...

* Add ignore scripts to makefile

* Ignore non-macho files :P

* Revert "Revert me too"

This reverts commit 074dc9551a2d8ce34a23a3abaeed937d957e8b76.

* Revert "Revert me: test msi and mac installer"

This reverts commit 0ac998c26a824e7136bdfdc825280a407bb1aa7f.
2022-08-02 11:33:48 -04:00

35 lines
776 B
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
const {exec} = require('child_process');
exports.default = async function beforePack(context) {
return new Promise((resolve, reject) => {
const arch = getArch(context.arch);
exec(`npm run postinstall -- --arch ${arch}`, (error) => {
if (error) {
reject(error);
} else {
resolve();
}
});
});
};
function getArch(arch) {
switch (arch) {
case 0:
return 'ia32';
case 1:
return 'x64';
case 2:
return 'armv7l';
case 3:
return 'arm64';
case 4:
return 'universal';
default:
return '';
}
}