Add extra app-updater-config.json into Windows zip
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
"test": "npm-run-all test:* lint:*",
|
||||
"test:app": "cross-env NODE_ENV=production npm run build && mocha -r babel-register --reporter mocha-circleci-reporter --recursive test/specs",
|
||||
"package:all": "cross-env NODE_ENV=production npm-run-all check-build-config package:windows package:mac package:linux",
|
||||
"package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --config.extraMetadata.name=mattermost --publish=never",
|
||||
"package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --config.extraMetadata.name=mattermost --publish=never && npm run manipulate-windows-zip",
|
||||
"package:mac": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --mac --publish=never",
|
||||
"package:linux": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --linux --x64 --ia32 --config.extraMetadata.name=mattermost-desktop --publish=never",
|
||||
"manipulate-windows-zip": "node scripts/manipulate_windows_zip.js",
|
||||
|
3
resources/windows/app-updater-config.json
Normal file
3
resources/windows/app-updater-config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"notifyOnly": true
|
||||
}
|
@@ -4,24 +4,33 @@
|
||||
'use strict';
|
||||
|
||||
const spawnSync = require('child_process').spawnSync;
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
const path = require('path');
|
||||
>>>>>>> 5611556... Add extra app-updater-config.json into Windows zip
|
||||
const path7za = require('7zip-bin').path7za;
|
||||
|
||||
const pkg = require('../src/package.json');
|
||||
const appVersion = pkg.version;
|
||||
const productName = pkg.productName;
|
||||
const name = pkg.name;
|
||||
|
||||
function renameInZip(zipPath, oldName, newName) {
|
||||
const result = spawnSync(path7za, ['rn', zipPath, oldName, newName]);
|
||||
return result.status === 0;
|
||||
function disableInstallUpdate(zipPath) {
|
||||
const zipFullPath = path.resolve(__dirname, '..', zipPath);
|
||||
const appUpdaterConfigFile = 'app-updater-config.json';
|
||||
|
||||
const addResult = spawnSync(path7za, ['a', zipFullPath, appUpdaterConfigFile], {cwd: 'resources/windows'});
|
||||
if (addResult.status !== 0) {
|
||||
throw new Error(`7za a returned non-zero exit code for ${zipPath}`);
|
||||
}
|
||||
|
||||
const renameResult = spawnSync(path7za, ['rn', zipFullPath, appUpdaterConfigFile, `resources/${appUpdaterConfigFile}`]);
|
||||
if (renameResult.status !== 0) {
|
||||
throw new Error(`7za rn returned non-zero exit code for ${zipPath}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Manipulating 64-bit zip...');
|
||||
if (!renameInZip(`release/${productName}-${appVersion}-win.zip`, 'win-unpacked', `${productName}-${appVersion}-win64`)) {
|
||||
throw new Error('7za returned non-zero exit code for 64-bit zip');
|
||||
}
|
||||
|
||||
disableInstallUpdate(`release/${name}-${appVersion}-win.zip`);
|
||||
console.log('Manipulating 32-bit zip...');
|
||||
if (!renameInZip(`release/${productName}-${appVersion}-ia32-win.zip`, 'win-ia32-unpacked', `${productName}-${appVersion}-win32`)) {
|
||||
throw new Error('7za returned non-zero exit code for 32-bit zip');
|
||||
}
|
||||
disableInstallUpdate(`release/${name}-${appVersion}-win-ia32.zip`);
|
||||
|
Reference in New Issue
Block a user