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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1861 additions and 50 deletions

View file

@ -191,7 +191,7 @@ jobs:
- run: - run:
name: Install nodejs-lts name: Install nodejs-lts
command: nvm off; choco install nodejs-lts -y command: nvm off; choco install nodejs-lts -y
- run: npm i -g node-gyp; node-gyp install - run: 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"
- run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci - run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci
- build: - build:
os: windows os: windows
@ -269,7 +269,7 @@ jobs:
- run: - run:
name: Install nodejs-lts name: Install nodejs-lts
command: nvm off; choco install nodejs-lts -y command: nvm off; choco install nodejs-lts -y
- run: npm i -g node-gyp; node-gyp install - run: 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"
- run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci - run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci
- build: - build:
os: windows os: windows

View file

@ -32,7 +32,6 @@
] ]
} }
], ],
"beforePack": "scripts/beforepack.js",
"afterPack": "scripts/afterpack.js", "afterPack": "scripts/afterpack.js",
"afterSign": "scripts/notarize.js", "afterSign": "scripts/notarize.js",
"afterAllArtifactBuild": "scripts/afterbuild.js", "afterAllArtifactBuild": "scripts/afterbuild.js",

1851
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@
"build": "npm-run-all build:*", "build": "npm-run-all build:*",
"build:main": "webpack-cli --config webpack.config.main.js", "build:main": "webpack-cli --config webpack.config.main.js",
"build:renderer": "webpack-cli --config webpack.config.renderer.js", "build:renderer": "webpack-cli --config webpack.config.renderer.js",
"build-robotjs": "cross-env CL='/std:c++17' electron-rebuild -v 21.1.0 -m ./node_modules/robotjs", "build-robotjs": "cross-env CL='/std:c++17' electron-rebuild -m ./node_modules/robotjs",
"start": "electron dist/ --disable-dev-mode", "start": "electron dist/ --disable-dev-mode",
"restart": "npm run build && npm run start", "restart": "npm run build && npm run start",
"storybook": "start-storybook -p 9001 -c src/.storybook", "storybook": "start-storybook -p 9001 -c src/.storybook",
@ -69,7 +69,7 @@
"prune": "ts-prune", "prune": "ts-prune",
"mmjstool": "mmjstool", "mmjstool": "mmjstool",
"i18n-extract": "npm run mmjstool -- i18n extract-desktop", "i18n-extract": "npm run mmjstool -- i18n extract-desktop",
"postinstall": "electron-rebuild" "postinstall": "node scripts/patch_macos_notification_state.js && electron-builder install-app-deps"
}, },
"jest": { "jest": {
"clearMocks": true, "clearMocks": true,
@ -176,6 +176,7 @@
"mochawesome": "7.1.3", "mochawesome": "7.1.3",
"nan": "2.17.0", "nan": "2.17.0",
"node-abi": "3.26.0", "node-abi": "3.26.0",
"node-jq": "2.3.4",
"node-loader": "2.0.0", "node-loader": "2.0.0",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"playwright": "1.23.4", "playwright": "1.23.4",

View file

@ -515,6 +515,7 @@ function Run-BuildElectron {
Print-Info "Installing nodejs/electron dependencies (running npm ci)..." Print-Info "Installing nodejs/electron dependencies (running npm ci)..."
npm i -g node-gyp npm i -g node-gyp
node-gyp install 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 ci
#npm install --prefix="$(Get-RootDir)" "$(Get-RootDir)" #npm install --prefix="$(Get-RootDir)" "$(Get-RootDir)"
Print-Info "Building nodejs/electron code (running npm run build)..." 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,
);
});