Use 7zip to manipulate windows zip archives
This commit is contained in:
parent
3c63d98960
commit
e5c5ca9d9a
20
package.json
20
package.json
|
@ -24,13 +24,15 @@
|
|||
"watch": "gulp watch",
|
||||
"serve": "gulp watch",
|
||||
"test": "gulp build && mocha --reporter mocha-circleci-reporter --recursive test/specs && gulp prettify:verify",
|
||||
"package:all": "build -wml --x64 --ia32",
|
||||
"package:windows": "build --win --x64 --ia32",
|
||||
"package:all": "build -wml --x64 --ia32 && npm run manipulate-windows-zip",
|
||||
"package:windows": "build --win --x64 --ia32 && npm run manipulate-windows-zip",
|
||||
"package:mac": "build --mac --x64 --ia32",
|
||||
"package:linux": "build --linux --x64 --ia32",
|
||||
"manipulate-windows-zip": "node scripts/manipulate_windows_zip.js",
|
||||
"prettify": "gulp prettify"
|
||||
},
|
||||
"devDependencies": {
|
||||
"7zip-bin": "^2.0.1",
|
||||
"babel-core": "^6.7.5",
|
||||
"babel-loader": "^6.2.4",
|
||||
"babel-preset-react": "^6.5.0",
|
||||
|
@ -61,7 +63,10 @@
|
|||
"appId": "com.mattermost.desktop",
|
||||
"linux": {
|
||||
"category": "InstantMessaging",
|
||||
"target": ["deb", "tar.gz"],
|
||||
"target": [
|
||||
"deb",
|
||||
"tar.gz"
|
||||
],
|
||||
"synopsis": "Mattermost",
|
||||
"extraFiles": [{
|
||||
"from": "resources",
|
||||
|
@ -73,11 +78,16 @@
|
|||
},
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity",
|
||||
"target": ["tar.gz"]
|
||||
"target": [
|
||||
"tar.gz"
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"description": "Mattermost",
|
||||
"target": ["squirrel", "zip"],
|
||||
"target": [
|
||||
"squirrel",
|
||||
"zip"
|
||||
],
|
||||
"iconUrl": "https://raw.githubusercontent.com/mattermost/desktop/master/resources/icon.ico"
|
||||
}
|
||||
},
|
||||
|
|
20
scripts/manipulate_windows_zip.js
Normal file
20
scripts/manipulate_windows_zip.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const spawnSync = require('child_process').spawnSync;
|
||||
const path7za = require('7zip-bin').path7za;
|
||||
const appVersion = require('../package.json').version;
|
||||
|
||||
function renameInZip(zipPath, oldName, newName) {
|
||||
const result = spawnSync(path7za, ['rn', zipPath, oldName, newName]);
|
||||
return result.status === 0;
|
||||
}
|
||||
|
||||
console.log('Manipulating 64-bit zip...');
|
||||
if (!renameInZip(`release/Mattermost-${appVersion}-win.zip`, 'win-unpacked', `Mattermost-${appVersion}-win64`)) {
|
||||
throw new Error('7za returned non-zero exit code for 64-bit zip');
|
||||
}
|
||||
|
||||
console.log('Manipulating 32-bit zip...');
|
||||
if (!renameInZip(`release/Mattermost-${appVersion}-ia32-win.zip`, 'win-ia32-unpacked', `Mattermost-${appVersion}-win32`)) {
|
||||
throw new Error('7za returned non-zero exit code for 32-bit zip');
|
||||
}
|
Loading…
Reference in a new issue