Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add osx icons and npm scripts #6

Merged
merged 1 commit into from
Jun 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
debug.log
pkg
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# ipfs-electron
Electron Shell based ipfs app

# usage

```bash
npm run start
```
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

var os = require('os')
var app = require('app')
var BrowserWindow = require('browser-window')
var ipfsd = require('ipfsd-ctl')
Expand All @@ -9,6 +10,8 @@ var menu = require('menu')

var WEBUIPATH = '/webui'
var LOGO = __dirname + '/node_modules/ipfs-logo/ipfs-logo-256-ice.png'
var TRAY_ICON = (os.platform() !== 'darwin' ? LOGO
: __dirname + '/node_modules/ipfs-logo/platform-icons/osx-menu-bar.png')

// keep references around for gc purposes
var mainWindow = null
Expand All @@ -32,7 +35,7 @@ var openWindow = function (ipfs) {
if (!mainWindow) {
ipfs.config.get('Addresses.API', function (err, res) {
if (err) throw err
mainWindow = new BrowserWindow({icon: LOGO, width: 800, height: 600})
mainWindow = new BrowserWindow({icon: TRAY_ICON, width: 800, height: 600})
mainWindow.on('closed', function () {
mainWindow = null
})
Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "Ipfs electron",
"main": "index.js",
"dependencies": {
"ipfsd-ctl": "0.2.0",
"multiaddr": "0.1.2"
"ipfsd-ctl": "0.2.3",
"multiaddr": "0.1.2",
"silence-chromium": "2.0.0"
},
"repository": {
"type": "git",
Expand All @@ -14,13 +15,18 @@
"devDependencies": {
"electron-packager": "4.1.2",
"electron-prebuilt": "0.26.1",
"ipfs-logo": "0.1.1",
"shelljs": "0.4.0",
"rimraf": "2.3.4",
"ipfs-logo": "0.1.3",
"pre-commit": "1.0.6",
"standard": "3.3.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "git diff --name-only --cached --relative | egrep .js$ | xargs --no-run-if-empty standard"
"start": "electron index.js 2>&1 | silence-chromium",
"lint": "git diff --name-only --cached --relative | egrep .js$ | xargs --no-run-if-empty standard",
"package": "node pkg.js",
"package-all": "node pkg.js --all"
},
"pre-commit": [
"lint"
Expand Down
50 changes: 50 additions & 0 deletions pkg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env node

// from https://github.com/moose-team/friends/blob/master/pkg.js

var os = require('os')
var pkgjson = require('./package.json')
var path = require('path')
var sh = require('shelljs')

var appVersion = pkgjson.version
var appName = pkgjson.name
var electronPackager = './node_modules/.bin/electron-packager'
var electronVersion = '0.26.0'
var icon = './node_modules/ipfs-logo/platform-icons/ipfs.icns'

if (process.argv[2] === '--all') {
// build for all platforms
var archs = ['ia32', 'x64']
var platforms = ['linux', 'win32', 'darwin']

platforms.forEach(function (plat) {
archs.forEach(function (arch) {
pack(plat, arch)
})
})
} else {
// build for current platform only
pack(os.platform(), os.arch())
}

function pack (plat, arch) {
var outputPath = path.join('.', 'pkg', appVersion, plat, arch)

sh.exec('./node_modules/.bin/rimraf ' + outputPath)

// there is no darwin ia32 electron
if (plat === 'darwin' && arch === 'ia32') return

var cmd = electronPackager + ' . ' + appName +
' --platform=' + plat +
' --arch=' + arch +
' --version=' + electronVersion +
' --app-version' + appVersion +
' --icon=' + icon +
' --out=' + outputPath +
' --prune' +
' --ignore=pkg' // ignore the pkg directory or hilarity will ensue
console.log(cmd)
sh.exec(cmd)
}
7 changes: 2 additions & 5 deletions wizard/js/wizard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var remote = require('remote')
'use strict'

var ipc = require('ipc')

function initialize () {
Expand All @@ -9,7 +10,3 @@ ipc.on('err', function (err) {
var error = window.document.getElementById('error')
error.innerHTML = '<pre>' + err + '</pre>'
})

// ipc.on('initialized', function (err) {

// })