overte-HifiExperiments/server-console/packager.js
2016-03-30 12:41:13 -07:00

59 lines
1.7 KiB
JavaScript

var packager = require('electron-packager')
var osType = require('os').type();
var platform = null;
if (osType == "Darwin" || osType == "Linux") {
platform = osType.toLowerCase();
} else if (osType == "Windows_NT") {
platform = "win32"
}
var argv = require('yargs').argv;
// check which icon we should use, beta or regular
var iconName = argv.production ? "console" : "console-beta";
// setup the common options for the packager
var options = {
dir: __dirname,
name: "server-console",
version: "0.35.4",
overwrite: true,
prune: true,
arch: "x64",
platform: platform,
icon: "resources/" + iconName,
ignore: "logs|(S|s)andbox-\\S+|electron-packager|README.md|CMakeLists.txt|packager.js|.gitignore"
}
const EXEC_NAME = "server-console";
const SHORT_NAME = "Sandbox";
const FULL_NAME = "High Fidelity Sandbox";
// setup per OS options
if (osType == "Darwin") {
options["app-bundle-id"] = "com.highfidelity.server-console" + (argv.production ? "" : "-dev")
options["name"] = SHORT_NAME
} else if (osType == "Windows_NT") {
options["version-string"] = {
CompanyName: "High Fidelity, Inc.",
FileDescription: SHORT_NAME,
ProductName: FULL_NAME,
OriginalFilename: EXEC_NAME + ".exe"
}
}
// check if we were passed a custom out directory, pass it along if so
if (argv.out) {
options.out = argv.out
}
// call the packager to produce the executable
packager(options, function(error, appPath) {
if (error) {
console.error("There was an error writing the packaged console: " + error.message);
process.exit(1);
} else {
console.log("Wrote new app to " + appPath);
}
});