Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
Configure for new Windows Store listing (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanglam2807 authored Feb 1, 2021
1 parent 323d28a commit fc93293
Showing 1 changed file with 5 additions and 44 deletions.
49 changes: 5 additions & 44 deletions dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit fc93293

Please sign in to comment.