From fc93293f89d978888280b4e1ef2a18b83dbe8f7e Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Tue, 2 Feb 2021 04:01:24 +0700 Subject: [PATCH] Configure for new Windows Store listing (#281) --- dist.js | 49 +++++-------------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/dist.js b/dist.js index 813cf2a9..6c09703e 100644 --- a/dist.js +++ b/dist.js @@ -9,21 +9,10 @@ const builder = require('electron-builder'); const glob = require('glob'); const del = require('del'); const semver = require('semver'); -const { spawn } = require('child_process'); -const { getSignVendorPath } = require('app-builder-lib/out/codeSign/windowsCodeSign'); const packageJson = require('./package.json'); const displayLanguages = require('./main-src/libs/locales/languages'); -// https://stackoverflow.com/a/17466459 -const runCmd = (cmd, args, callBack) => { - const child = spawn(cmd, args); - let resp = ''; - - child.stdout.on('data', (buffer) => { resp += buffer.toString(); }); - child.stdout.on('end', () => { callBack(resp); }); -}; - const { Arch, Platform } = builder; console.log(`Machine: ${process.platform}`); @@ -71,9 +60,11 @@ const opts = { schemes: ['translatium'], }, appx: { - applicationId: 'translatium', - identityName: '55974nhutquang97.5translate', - publisher: 'CN=C635F506-DEEB-41A4-8CAA-16689F486ED2', + identityName: 'com.webcatalog.translatium', + publisher: 'CN=C2673AF2-2F8A-4FAF-AC59-112BBCFB3423', + backgroundColor: '#43a047', + languages: Object.keys(displayLanguages), + showNameOnTiles: true, }, mac: { darkModeSupport: true, @@ -104,36 +95,6 @@ const opts = { 'github', ], }, - afterAllArtifactBuild: () => { - if (process.platform !== 'win32') { - return []; - } - // Create .appxbundle for backward compability - // http://www.jonathanantoine.com/2016/04/12/windows-app-bundles-and-the-subsequent-submissions-must-continue-to-contain-a-windows-phone-8-1-appxbundle-error-message/ - // https://docs.microsoft.com/en-us/windows/msix/package/create-app-package-with-makeappx-tool - // https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/AppxTarget.ts - const appxBundlePath = path.join('dist', `Translatium ${appVersion}.appxbundle`); - const appxPath = path.join(__dirname, 'dist', `Translatium ${appVersion}.appx`); - const bundleDirPath = path.join(__dirname, 'dist', 'appx_bundle'); - const appxDestPath = path.join(bundleDirPath, 'Translatium.appx'); - return getSignVendorPath() - .then((vendorPath) => { - console.log(`Creating ${appxBundlePath}...`); - fs.ensureDirSync(bundleDirPath); - fs.copyFileSync(appxPath, appxDestPath); - return new Promise((resolve) => { - const makeAppxPath = path.join(vendorPath, 'windows-10', 'x64', 'makeappx.exe'); - runCmd(makeAppxPath, ['bundle', '/p', appxBundlePath, '/d', bundleDirPath, '/o'], (text) => { - console.log(text); - resolve(); - }); - }) - .then(() => { - console.log(`Created ${appxBundlePath} successfully`); - return [appxBundlePath]; - }); - }); - }, afterPack: ({ appOutDir }) => new Promise((resolve, reject) => { const languages = Object.keys(displayLanguages);