Fix macos-notification-state build issue (#2310)
* Fix macos-notification-state build issue * Fix windows build, a bit of cleanup
This commit is contained in:
@@ -515,6 +515,7 @@ function Run-BuildElectron {
|
||||
Print-Info "Installing nodejs/electron dependencies (running npm ci)..."
|
||||
npm i -g node-gyp
|
||||
node-gyp install
|
||||
node-gyp install --devdir="$env:USERPROFILE\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
|
||||
npm ci
|
||||
#npm install --prefix="$(Get-RootDir)" "$(Get-RootDir)"
|
||||
Print-Info "Building nodejs/electron code (running npm run build)..."
|
||||
|
@@ -1,34 +0,0 @@
|
||||
// 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 '';
|
||||
}
|
||||
}
|
15
scripts/patch_macos_notification_state.js
Normal file
15
scripts/patch_macos_notification_state.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const jq = require('node-jq');
|
||||
const fs = require('fs');
|
||||
|
||||
jq.run(
|
||||
'.scripts.install = "node-gyp rebuild"',
|
||||
'./node_modules/macos-notification-state/package.json',
|
||||
).then((result) => {
|
||||
fs.writeFileSync(
|
||||
'./node_modules/macos-notification-state/package.json',
|
||||
result,
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user