diff --git a/README.md b/README.md
index 2a892ffb..edfdc20a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-#
WebTorrent.app
+#
WebTorrent.app
[![Gitter][webtorrent-gitter-image]][webtorrent-gitter-url]
[![Travis Build][webtorrent-app-travis-image]][webtorrent-app-travis-url]
diff --git a/bin/package.js b/bin/package.js
index 4d4b02e2..b1e71c97 100755
--- a/bin/package.js
+++ b/bin/package.js
@@ -25,7 +25,7 @@ var all = {
// Package the application's source code into an archive, using Electron's archive
// format. Mitigates issues around long path names on Windows and slightly speeds up
// require().
- asar: false,
+ asar: true,
// The build version of the application. Maps to the FileVersion metadata property on
// Windows, and CFBundleVersion on OS X. We're using the short git hash (e.g. 'e7d837e')
@@ -33,7 +33,7 @@ var all = {
// Pattern which specifies which files to ignore when copying files to create the
// package(s).
- ignore: /^\/(dist|static\/screenshot.png)$/,
+ ignore: /^\/dist|\/(appveyor.yml|AUTHORS|CONTRIBUTORS|bench|benchmark|benchmark\.js|bin|bower\.json|component\.json|coverage|doc|docs|docs\.mli|dragdrop\.min\.js|example|examples|example\.html|example\.js|externs|ipaddr\.min\.js|Makefile|min|minimist|perf|rusha|simplepeer\.min\.js|simplewebsocket\.min\.js|static\/screenshot\.png|test|tests|test\.js|tests\.js|webtorrent\.min\.js|\.[^\/]*|.*\.md|.*\.markdown)$/,
// The application name.
name: config.APP_NAME,
@@ -66,7 +66,7 @@ var darwin = {
'helper-bundle-id': 'io.webtorrent.app.helper',
// Application icon.
- icon: path.join(__dirname, '..', 'WebTorrent.icns')
+ icon: path.join(__dirname, '..', 'static', 'WebTorrent.icns')
}
var win32 = {
@@ -100,7 +100,7 @@ var win32 = {
},
// Application icon.
- icon: path.join(__dirname, '..', 'WebTorrent.ico')
+ icon: path.join(__dirname, '..', 'static', 'WebTorrent.ico')
}
var linux = {
@@ -109,11 +109,33 @@ var linux = {
// Note: Application icon for Linux is specified via the BrowserWindow `icon` option.
}
-electronPackager(Object.assign({}, all, darwin), done)
-electronPackager(Object.assign({}, all, win32), done)
-electronPackager(Object.assign({}, all, linux), done)
+var platform = process.argv[2]
-function done (err, appPath) {
+if (platform === '--darwin') {
+ buildDarwin()
+} else if (platform === '--win32') {
+ buildWin32()
+} else if (platform === '--linux') {
+ buildLinux()
+} else {
+ // Build all
+ buildDarwin(() => buildWin32(() => buildLinux()))
+}
+
+function buildDarwin (cb) {
+ electronPackager(Object.assign({}, all, darwin), done.bind(null, cb))
+}
+
+function buildWin32 (cb) {
+ electronPackager(Object.assign({}, all, win32), done.bind(null, cb))
+}
+
+function buildLinux (cb) {
+ electronPackager(Object.assign({}, all, linux), done.bind(null, cb))
+}
+
+function done (cb, err, appPath) {
if (err) console.error(err.message || err)
else console.log('Built ' + appPath)
+ if (cb) cb()
}
diff --git a/config.js b/config.js
index 39ac4c2a..311e0e90 100644
--- a/config.js
+++ b/config.js
@@ -2,7 +2,7 @@ var path = require('path')
module.exports = {
APP_NAME: 'WebTorrent',
- APP_ICON: path.join(__dirname, 'WebTorrent.png'),
+ APP_ICON: path.join(__dirname, 'static', 'WebTorrent.png'),
INDEX: 'file://' + path.join(__dirname, 'renderer', 'index.html'),
SOUND_ADD: 'file://' + path.join(__dirname, 'static', 'sound', 'add.wav'),
SOUND_DELETE: 'file://' + path.join(__dirname, 'static', 'sound', 'delete.wav'),
diff --git a/package.json b/package.json
index 31a17562..c33ae3f7 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,8 @@
"scripts": {
"cleanup": "node ./bin/cleanup.js",
"debug": "DEBUG=* electron .",
- "package": "node ./bin/package.js",
+ "package": "npm prune && npm dedupe && node ./bin/package.js",
+ "size": "npm run package -- --darwin && du -ch dist/WebTorrent-darwin-x64 | grep total",
"start": "electron .",
"test": "standard",
"update-authors": "./bin/update-authors.sh"
diff --git a/renderer/index.js b/renderer/index.js
index 848eb3af..d4412518 100644
--- a/renderer/index.js
+++ b/renderer/index.js
@@ -615,7 +615,6 @@ function onWarning (err) {
}
function showDoneNotification (torrent) {
- console.log(state.window.isFocused)
if (state.window.isFocused) return
var notif = new window.Notification('Download Complete', {
diff --git a/WebTorrent.icns b/static/WebTorrent.icns
similarity index 100%
rename from WebTorrent.icns
rename to static/WebTorrent.icns
diff --git a/WebTorrent.ico b/static/WebTorrent.ico
similarity index 100%
rename from WebTorrent.ico
rename to static/WebTorrent.ico
diff --git a/WebTorrent.png b/static/WebTorrent.png
similarity index 100%
rename from WebTorrent.png
rename to static/WebTorrent.png