Skip to content

Commit

Permalink
change platform and arch index
Browse files Browse the repository at this point in the history
  • Loading branch information
w-raken committed Nov 17, 2017
1 parent 5ee3b96 commit a961bdd
Show file tree
Hide file tree
Showing 3 changed files with 350 additions and 102 deletions.
20 changes: 10 additions & 10 deletions builder/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ const fs = require('fs');
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md
const spec = {
'platform': {
'1': 'win32',
'2': 'darwin',
'3': 'linux'
'win': 'win32',
'mac': 'darwin',
'linux': 'linux'
},
'arch': {
'1': 'ia32',
'2': 'x64',
'3': 'armv7l',
'4': 'arm64'
'32': 'ia32',
'64': 'x64',
'7l': 'armv7l',
'arm': 'arm64'
}
};

const linuxConfig = {
src: "./linux_packager/" + json.name + "-" + spec['platform']['3'] + "-" + spec['arch']['2'] + "/",
src: "./linux_packager/" + json.name + "-" + spec['platform']['linux'] + "-" + spec['arch']['64'] + "/",
arch: "amd64",
dest: "linux_installer",
categories: [
Expand All @@ -40,7 +40,7 @@ switch (process.env.NODE_OS) {
console.log('Successfully removed ./mac_installer/');
}
console.log('Creating mac installer...');
exec("mkdir mac_installer && electron-installer-dmg ./mac_packager/" + json.name + "-" + spec['platform']['2'] + "-" + spec['arch']['2'] + "/" + json.name + ".app " + json.name + " --out=mac_installer --overwrite && rm -rf mac_packager", (error) => {
exec("mkdir mac_installer && electron-installer-dmg ./mac_packager/" + json.name + "-" + spec['platform']['mac'] + "-" + spec['arch']['64'] + "/" + json.name + ".app " + json.name + " --out=mac_installer --overwrite && rm -rf mac_packager", (error) => {
if (!error) {
console.log('Removing mac_packager...');
console.log('Successfully created installer at ./mac_installer/');
Expand Down Expand Up @@ -74,7 +74,7 @@ switch (process.env.NODE_OS) {
const electronInstaller = require('electron-winstaller');

let settings = {
appDirectory: path.join(path.join((path.join('./'), 'win_packager'), json.name + "-" + spec['platform']['1'] + "-" + spec['arch']['2'] + '/')),
appDirectory: path.join(path.join((path.join('./'), 'win_packager'), json.name + "-" + spec['platform']['win'] + "-" + spec['arch']['64'] + '/')),
outputDirectory: path.join(path.join('./'), 'win_installer'),
authors: '',
exe: json.name + '.exe',
Expand Down
52 changes: 26 additions & 26 deletions builder/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ const fs = require('fs');
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md
const spec = {
'platform': {
'1': 'win32',
'2': 'darwin',
'3': 'linux'
'win': 'win32',
'mac': 'darwin',
'linux': 'linux'
},
'arch': {
'1': 'ia32',
'2': 'x64',
'3': 'armv7l',
'4': 'arm64'
'32': 'ia32',
'64': 'x64',
'7l': 'armv7l',
'arm': 'arm64'
}
};

switch (process.env.NODE_OS) {
case "mac":
if (fs.existsSync('./mac_packager')) {
console.log('Removing existing ./mac_packager...');
execSync("rm -rf mac_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./mac_packager/');
}
console.log('Creating mac packager...');
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['2'] + " --arch=" + spec['arch']['2'] + " --prune=true --out=mac_packager --icon=builder/icons/mac/icon.icns", (error) => {
console.log('Removing existing ./mac_packager...');
execSync("rm -rf mac_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./mac_packager/');
}
console.log('Creating mac packager...');
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['mac'] + " --arch=" + spec['arch']['64'] + " --prune=true --out=mac_packager --icon=builder/icons/mac/icon.icns", (error) => {
if (!error) {
console.log('Successfully created packager at ./mac_packager/');
} else {
Expand All @@ -37,13 +37,13 @@ switch (process.env.NODE_OS) {
});
break;
case "linux":
if (fs.existsSync('./linux_packager')) {
console.log('Removing existing ./linux_packager...');
execSync("rm -rf linux_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./linux_packager/');
}
if (fs.existsSync('./linux_packager')) {
console.log('Removing existing ./linux_packager...');
execSync("rm -rf linux_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./linux_packager/');
}
console.log('Creating linux packager...');
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['3'] + " --arch=" + spec['arch']['2'] + " --prune=true --out=linux_packager --icon=builder/icons/linux/icon.png", (error) => {
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['linux'] + " --arch=" + spec['arch']['64'] + " --prune=true --out=linux_packager --icon=builder/icons/linux/icon.png", (error) => {
if (!error) {
console.log('Successfully created packager at ./linux_packager/');
} else {
Expand All @@ -52,13 +52,13 @@ switch (process.env.NODE_OS) {
});
break;
case "win":
if (fs.existsSync('./win_packager')) {
console.log('Removing existing ./win_packager...');
execSync("del /s /q win_packager && rmdir /s /q win_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./win_packager/');
}
if (fs.existsSync('./win_packager')) {
console.log('Removing existing ./win_packager...');
execSync("del /s /q win_packager && rmdir /s /q win_packager", { maxBuffer: 1024 * 2048 });
console.log('Successfully removed ./win_packager/');
}
console.log('Creating windows packager...');
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['1'] + " --arch=" + spec['arch']['2'] + " --prune=true --out=win_packager --icon=builder/icons/win/icon.ico", (error) => {
exec("cross-env NODE_ENV=prod webpack && electron-packager . --overwrite --platform=" + spec['platform']['win'] + " --arch=" + spec['arch']['64'] + " --prune=true --out=win_packager --icon=builder/icons/win/icon.ico", (error) => {
if (!error) {
console.log('Successfully created packager at ./win_packager/');
} else {
Expand All @@ -68,4 +68,4 @@ switch (process.env.NODE_OS) {
break;
default:
throw new Error("NODE_OS undefined");
}
}
Loading

0 comments on commit a961bdd

Please sign in to comment.