mirror of
https://github.com/thomasnordquist/MQTT-Explorer.git
synced 2026-09-11 09:03:33 +00:00
Modify appx after it was packed
This commit is contained in:
+3
-2
@@ -48,14 +48,14 @@
|
||||
"buildResources": "res",
|
||||
"output": "build"
|
||||
},
|
||||
"afterAllArtifactBuild": "./dist/scripts/afterAllArtifactBuild.js",
|
||||
"afterPack": "./dist/scripts/afterPack.js"
|
||||
"afterAllArtifactBuild": "./dist/scripts/afterAllArtifactBuild.js"
|
||||
},
|
||||
"author": "Thomas Nordquist",
|
||||
"email": "xxnerowingerxx@gmail.com",
|
||||
"homepage": "https://github.com",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/adm-zip": "^0.4.32",
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/fs-extra": "^5.0.5",
|
||||
"@types/lowdb": "^1.0.6",
|
||||
@@ -65,6 +65,7 @@
|
||||
"@types/node": "^10.12.18",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/sha1": "^1.1.1",
|
||||
"adm-zip": "^0.4.13",
|
||||
"axios": "^0.18.0",
|
||||
"chai": "^4.2.0",
|
||||
"electron": "^4.0.6",
|
||||
|
||||
@@ -2,21 +2,29 @@ import * as fs from 'fs-extra'
|
||||
import * as path from 'path'
|
||||
import { chdir } from 'process'
|
||||
import { exec } from './util'
|
||||
import * as AdmZip from 'adm-zip'
|
||||
|
||||
export default async function (info: any) {
|
||||
for (const snapFile of info.artifactPaths) {
|
||||
if (/\.snap$/.test(snapFile)) {
|
||||
for (const artifact of info.artifactPaths) {
|
||||
if (/\.snap$/.test(artifact)) {
|
||||
const originalDir = __dirname
|
||||
const dirname = path.dirname(snapFile)
|
||||
const dirname = path.dirname(artifact)
|
||||
chdir(dirname)
|
||||
|
||||
await exec('sudo', ['unsquashfs', snapFile])
|
||||
await fs.remove(snapFile)
|
||||
await exec('sudo', ['unsquashfs', artifact])
|
||||
await fs.remove(artifact)
|
||||
await exec('sudo', ['chmod', '-R', 'g-s', 'squashfs-root'])
|
||||
await exec('sudo', ['snap', 'run', 'snapcraft', 'pack', 'squashfs-root', '--output', snapFile])
|
||||
await exec('sudo', ['snap', 'run', 'snapcraft', 'pack', 'squashfs-root', '--output', artifact])
|
||||
await fs.remove('squashfs-root')
|
||||
|
||||
chdir(originalDir)
|
||||
}
|
||||
|
||||
if (/\.appx$/.test(artifact)) {
|
||||
const zip = new AdmZip(artifact)
|
||||
const data = zip.readAsText('AppxManifest.xml')
|
||||
const newData = data.replace('uap:DefaultTile', 'uap:DefaultTile ShowName="allLogos"')
|
||||
zip.updateFile('AppxManifest.xml', Buffer.from(newData))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import * as fs from 'fs-extra'
|
||||
import * as path from 'path'
|
||||
import { chdir } from 'process'
|
||||
import { exec } from './util'
|
||||
|
||||
interface AfterPackContext {
|
||||
outDir: string
|
||||
appOutDir: string
|
||||
packager: any// PlatformPackager<any>
|
||||
electronPlatformName: string
|
||||
arch: any//Arch
|
||||
targets: any//Array<Target>
|
||||
}
|
||||
|
||||
export default async function (info: AfterPackContext) {
|
||||
console.log(info)
|
||||
console.log(info.targets)
|
||||
console.log(info.packager)
|
||||
console.log(info.arch)
|
||||
|
||||
addAppNameToTiles(info)
|
||||
}
|
||||
|
||||
export function addAppNameToTiles(info: AfterPackContext) {
|
||||
const manifestPath = path.join(info.appOutDir, 'AppxManifest.xml')
|
||||
const data = fs.readFileSync(manifestPath).toString()
|
||||
const newData = data.replace('uap:DefaultTile', 'uap:DefaultTile ShowName="allLogos"')
|
||||
fs.writeFileSync(manifestPath, newData)
|
||||
}
|
||||
@@ -114,6 +114,13 @@
|
||||
reflect-metadata "^0.1.12"
|
||||
tslib "^1.8.1"
|
||||
|
||||
"@types/adm-zip@^0.4.32":
|
||||
version "0.4.32"
|
||||
resolved "https://registry.yarnpkg.com/@types/adm-zip/-/adm-zip-0.4.32.tgz#6de01309af60677065d2e52b417a023303220931"
|
||||
integrity sha512-hv1O7ySn+XvP5OeDQcJFWwVb2v+GFGO1A9aMTQ5B/bzxb7WW21O8iRhVdsKKr8QwuiagzGmPP+gsUAYZ6bRddQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/chai@^4.1.7":
|
||||
version "4.1.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.7.tgz#1b8e33b61a8c09cbe1f85133071baa0dbf9fa71a"
|
||||
@@ -201,6 +208,11 @@ about-window@^1.12.1:
|
||||
resolved "https://registry.yarnpkg.com/about-window/-/about-window-1.12.1.tgz#b81c10f6de58d38bce2aa5f31f61a82e6c3d6c2b"
|
||||
integrity sha512-P/fJACq7RBFpv5Ql0kIqpOYgFqQ8WdoZoB7wrKmDvwTSKVOMbUZMYnQYtnOW6dHmMCYuNrmQFf+MxvuhE+KrzQ==
|
||||
|
||||
adm-zip@^0.4.13:
|
||||
version "0.4.13"
|
||||
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a"
|
||||
integrity sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==
|
||||
|
||||
ajv-keywords@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a"
|
||||
|
||||
Reference in New Issue
Block a user