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:
Devin Binnie
2022-10-24 10:43:45 -04:00
committed by GitHub
parent 33da0afce5
commit 83b6c64cf3
7 changed files with 1861 additions and 50 deletions

View File

@@ -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)..."

View File

@@ -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 '';
}
}

View 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,
);
});