Skip to content

Commit

Permalink
feat: update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentdchan committed Sep 12, 2022
1 parent f60fbca commit ee17511
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 16 deletions.
Binary file added icons/icon.ico
Binary file not shown.
Binary file added icons/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 26 additions & 7 deletions scripts/build_asar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@ async function build() {
});

console.log("run electron-packager")
child_process.execSync("npx electron-packager ./asar_build CubyText --overwrite", {
child_process.execSync("npx electron-packager ./asar_build CubyText --icon ../icons/icon.png --overwrite", {
cwd: "out/",
stdio: 'inherit'
});

const appPath = path.join("out", `CubyText-${process.platform}-${process.arch}/CubyText.app`);
if (process.platform === "darwin") {
const appPath = path.join("out", `CubyText-${process.platform}-${process.arch}/CubyText.app`);

const buildDir = path.join(appPath, "/Contents/Resources");
fs.cpSync("icons/icon.icns", path.join(buildDir, "electron.icns"));

await codeSign(appPath);
await buildDmg(appPath);
const buildDir = path.join(appPath, "/Contents/Resources");
fs.cpSync("icons/icon.icns", path.join(buildDir, "electron.icns"));

await codeSign(appPath);
await buildDmg(appPath);
} else if (process.platform === "linux") {
await buildDeb();
}
}

async function codeSign(appPath) {
Expand All @@ -62,5 +66,20 @@ async function buildDmg(appPath) {
});
}

async function buildDeb() {
const installer = require('electron-installer-debian');
const appPath = path.join("out", `CubyText-${process.platform}-${process.arch}`);
const options = {
src: appPath,
dest: 'out/installers/',
arch: 'amd64',
name: "CubyText",
bin: "CubyText",
icon: "icons/icons.png"
}

console.log('Creating package (this may take a while)');
await installer(options);
}

build();
Loading

0 comments on commit ee17511

Please sign in to comment.