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

[WIP] Electron builder #192

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
11f8a1a
Create .ico file, refactor resource folders
May 12, 2016
8539dee
Add build and directories settings to package.json
May 12, 2016
c4000ca
Make electron-builder a little happier
May 13, 2016
9408f07
Merge branch 'fix-electron-1.0.1' into electron-builder
May 13, 2016
b790209
Remove unnecessary option and properly set output directory
May 13, 2016
a415a1f
Add 'background' item for electron-builder
May 13, 2016
9f0af30
Apparently `background` isn't based off of `buildResources`
May 13, 2016
cf829d9
Cool, nothing is based off of `buildResources`. I'm not really sure w…
May 13, 2016
99dead8
Output should be to binaries
May 13, 2016
e3eb03b
Don't need electron-packager directly anymore
May 14, 2016
7cc7681
Put development version into app version
May 14, 2016
28e5ba5
Put 'name' back in app package.json
May 14, 2016
0bd8cb3
Add icnsutils to travis apt
May 14, 2016
aba6605
Add graphicsmagick to apt
May 14, 2016
0f74b64
Ensure that travis fails when builder.build
May 14, 2016
f2580f8
Build for both linux and osx
May 14, 2016
fd132ba
Travis, pls use trusty
May 14, 2016
ebda43b
Travis, I only need one linux. Trusty only. No precise. Precis?
May 14, 2016
7d4bb37
Don't need wine if appveyor will do windows
May 14, 2016
db91880
Configure appveyor
May 14, 2016
1b01fc5
Add artifacts to appveyor config
May 14, 2016
f26d871
On windows, only build x64
May 14, 2016
5f8373a
Ensure that windows only builds x64, for sure now
May 14, 2016
30648fa
Appveyor no tests
May 14, 2016
60a74bb
Add GH_TOKENs
May 14, 2016
2b51f3c
Appveyor get version from package.json
May 14, 2016
1795d43
Oops, powershell that version-getting
May 14, 2016
45753e4
Attempt to set appveyor build version in init
May 14, 2016
676abd8
Re-add license and repository to main package.json
May 14, 2016
c642657
Env variables test for travis
May 14, 2016
ff33ca1
Fix yml
May 14, 2016
012a8fc
Appveyor doesn't want to play with artifacts, and I'll let this one go
May 14, 2016
5c97348
Attempt to add secure travis var again
May 14, 2016
c31a220
Travis, why you playin'
May 14, 2016
8fb6cf8
More travis secure env testing
May 14, 2016
265e3f5
Attempt #376
May 14, 2016
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
41 changes: 19 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
sudo: required
dist: trusty
matrix:
include:
- os: osx
language: node_js
node_js:
- '5.1'
- '5.1'
addons:
apt:
packages:
- wine
- icnsutils
- graphicsmagick
script:
- npm --depth Infinity update
- npm run test-ci
before_deploy:
- npm run zip-binaries
deploy:
provider: releases
api_key:
secure: KEDggFkivi1iJbO/G4hicXznWk+bGA7sDuKSd36fBB9pIN/JSr08HlasrmqLmRva/rkHinbEdu+f75k/xh/m0UKll5jXUhmJVgbvNjPWQDtRSeeRM8UjveCL9wTZopkM4bLLxmWD2klyCC8qde5mMOJ1gRi+aPboGBgxEmtD69Bdhq1k3Dd2HTFnqQEh+8al2//+ayhne512Mo+lgwR1+4pLbhE/xK0iV7gQllRzTT2/ifbn5an8vbUkwfmm2NivNhSJTaPD2NndLvOVBKKQVcbIx+37gXO1Hn6F7Wr0MMHeh/ypJzGygxPQ2xZHtCKABw8jFetpFaFzm4xFcbyHsqclQlDLCv9J1e5DMvWk2ay29L9qWXT5dc7tnjaIVFPMEw4ViwIC30ThO44HHm6m+/tQAp3cDAD37uunp83wDAImbyCzZ3UoNLcmWHc39fxaD1s4Fzan3/++QbqSgdB+p4dXraxlRyqFcmKW+O5S+oGFolmdLuRbxPaaeIMMGm9AN7+fmGJgmiRzPU5k3/ao6eHoycXVPcIiuFV+2ZxvJS4ewqT+HiH6cNOFeeHEXx2O0fjEuj7mZG5Jey5GNsOdcq7loPnipcGbDnIHs+wRyqPCQ5aZ+94gQAemjBdtVnDTKd7RSjKHWmbo3Xx260XnwAEsTDtVuUJmyVjpIdCdNAs=
file:
- binaries/James-darwin-x64.zip
- binaries/James-linux-ia32.zip
- binaries/James-linux-x64.zip
- binaries/James-win32-ia32.zip
- binaries/James-win32-x64.zip
skip_cleanup: true
on:
repo: james-proxy/james
tags: true
- npm prune
- npm --depth Infinity update
- npm run test-ci
- npm run dist
cache:
apt: true
directories:
- node_modules
- $HOME/.electron
- node_modules
- "$HOME/.electron"
env:
global:
- TEST=true
- Derp=pls
- secure: "BbBbIa8BUgp8iUqd2AG8B59iZKN5+ppIqpUmYJ2tPR/r95m6yNBqlq3LidocfUVvTr1IrN8hJGApE62h3grc6cVZz4oB9++615CHdn8jCAf4KN7IP8sr91LDzGJaCyY5lOee61eTkPdSaSmRcxXN2J6W2OCwy7+9NEhtGY7uzGNdab4ofMgIzwzCRSEreA7PokafjQEzH8l8IxrmluTydubuX8ByuoIA5md4zNGyWTi1XqGpw0c9dG/cAPr8okNpIu9iHccNszy7ZAssPbNQ7pne6mhie+4SX8Th8xT9fur8Iev0t6MyipETyQ8owSjb9q79OECqXX+YNuMvFmhAFXoa2MGJNime9ukLbuOSmKVGEQcZoK2DT5vpAudFR2rUndXxtwK3NkjKO40KHqzV/xcsEP/TpHBIk7gTjTDurQQBiJ0Vjpju4UNK9Cgi84qvqXFYbcNmZEASJhIv6rmpSrlgdSKl6SzhAWTMCXciIv+9vrY/hn/suIZCVdSePLL5DsfdjIuWWQgbAWevFkZlZia/f09qyXMH22tz7Y7bhAXt03VQax/Nwf1brynn+q/dvkBWeidwOUD+JYeNZcCsCLqB9rcr6+hyHBAHcpMp4E5FzR0bfPzNzeVdUXz+4aaGe1M/8yBMJfm/OJEwlLWVOlfYP8FazYlEDYzFWvVBFkE="
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It is an open-source alternative to the popular developer tool [Charles](http://

James is build with [hoxy](https://github.com/greim/hoxy), [electron](https://github.com/atom/electron) and [react](https://facebook.github.io/react/index.html)

![](resource/screenshot-1.png)
![](resource-compile/screenshot-1.png)

## Installing
Download the correct version for your OS and run
Expand Down
26 changes: 26 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
platform:
- x64

cache:
- node_modules
- '%USERPROFILE%\.electron'

init:
- ps: $version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
- ps: Update-AppveyorBuild -Version "$version"

install:
- ps: Install-Product node 5 x64
- npm install
- npm prune
- npm --depth Infinity update

build_script:
- npm run test-ci
- npm run dist:win64

environment:
GH_TOKEN:
secure: 1V6S11hA8oo6wo6IaW/jcv+lybbbhSv7sRij94aPsNSzVP5pso9U6aSrs6PNLfQfeOp38vhLn854u85dYkQQlw==

test: off
67 changes: 29 additions & 38 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ const changed = require('gulp-changed');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const electron = require('electron-packager');
const builder = require('electron-builder');
const useref = require('gulp-useref');
const electronConnect = require('electron-connect').server;
const gulpif = require('gulp-if');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const jeditor = require('gulp-json-editor');
const version = require('./package.json').version;

gulp.task('default', ['js', 'css', 'resources']);
gulp.task('dist-prep', ['dist-resources', 'browserify']);

gulp.task('clean', () => {
return del.sync(['build', 'package', 'binaries']);
Expand Down Expand Up @@ -42,29 +45,37 @@ gulp.task('css', () => {
});

gulp.task('resources', () => {
const dest = 'build';

return es.merge([
gulp.src('node_modules/font-awesome/fonts/**').pipe(gulp.dest('build/fonts')),
gulp.src('package.json').pipe(gulp.dest('build')),
gulp.src('resource/**')
gulp.src('resource-runtime/**')
.pipe(changed('build'))
.pipe(gulp.dest('build'))
.pipe(gulp.dest(dest)),
gulp.src('resource-compile/package.json')
.pipe(jeditor({ version }))
.pipe(gulp.dest(dest))
]);
});

gulp.task('package-resources', ['default'], () => {
gulp.task('dist-resources', ['css'], () => {
const dest = 'package';

return es.merge([
gulp.src('node_modules/font-awesome/fonts/**').pipe(gulp.dest('package/fonts')),
gulp.src('build/james.css').pipe(gulp.dest('package')),
gulp.src('package.json').pipe(gulp.dest('package')),
gulp.src('resource/**')
gulp.src('resource-runtime/**')
.pipe(gulpif('*.html', useref()))
.pipe(gulp.dest('package'))
.pipe(gulp.dest(dest)),
gulp.src('resource-compile/package.json')
.pipe(jeditor({ version }))
.pipe(gulp.dest(dest))
]);
});

function gulpBrowserify(entry) {
gulp.task('browserify', ['js'], () => {
process.env.NODE_ENV = 'production';
return browserify(entry, {
const opts = {
builtins: false,
commondir: false,
browserField: false,
Expand All @@ -81,51 +92,31 @@ function gulpBrowserify(entry) {
transform: [
'envify'
]
}).bundle();
}
};

gulp.task('package-render', ['default'], () => {
gulpBrowserify('build/index.js')
browserify('build/index.js', opts)
.bundle()
.pipe(source('index.js'))
.pipe(gulp.dest('./package'));
});

gulp.task('package-main', ['default'], () => {
gulpBrowserify('build/electron-app.js')
browserify('build/electron-app.js', opts)
.bundle()
.pipe(source('electron-app.js'))
.pipe(gulp.dest('./package'));
});

gulp.task('package', ['package-resources', 'package-render', 'package-main'], (done) => {
const appVersion = require('./package.json').version;
const electronVersion = require('electron-prebuilt/package.json').version;
console.log(`Packaging James v${appVersion}...`);

electron({
all: true,
dir: 'package',
platform: 'all',
name: 'James',
overwrite: true,
icon: 'resource/icon.icns',
'app-version': appVersion,
version: electronVersion,
out: 'binaries'
}, (err) => done(err));
});

gulp.task('watch', ['default'], () => {
gulp.watch('src/**', ['js']);
gulp.watch('style/**', ['css']);
gulp.watch('resource/**', ['resources']);
gulp.watch('resource-runtime/**', ['resources']);
});

gulp.task('livereload', ['default'], () => {
var server = electronConnect.create({path: './build'});
const server = electronConnect.create({path: './build'});
server.start();
const reload = () => server.reload();

gulp.watch('src/**', ['js', reload]);
gulp.watch('style/**', ['css', reload]);
gulp.watch('resource/**', ['resources', reload]);
gulp.watch('resource-runtime/**', ['resources', reload]);
});
48 changes: 35 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "james",
"version": "1.4.5",
"description": "",
"description": "HTTP/HTTPS proxy built in Electron and ReactJS",
"author": "Julian Hollmann <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/james-proxy/james.git"
},
"main": "electron-app.js",
"scripts": {
"build": "gulp",
"start": "electron ./build",
"watch": "gulp watch",
"development": "gulp livereload",
"package": "gulp clean package",
"zip-binaries": "cd binaries; rm *.zip; for i in *; do zip --symlinks -r \"${i%/}.zip\" \"$i\"; done",
"start": "electron ./build",
"lint": "eslint ./src ./test",
"test": "mocha --reporter dot --recursive -r setup-referee-sinon/globals test/unit --compilers js:babel-core/register",
"test-ci": "npm run lint && npm run test && npm run package"
},
"author": "Julian Hollmann <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/james-proxy/james.git"
"test-ci": "npm run lint && npm run test",
"package": "npm run dist",
"dist": "gulp clean dist-prep && build --arch all",
"dist:win64": "gulp clean dist-prep && build --platform win32 --arch x64"
},
"dependencies": {
"hoxy": "^3.2.0",
Expand All @@ -39,12 +40,12 @@
"babel-preset-react": "^6.3.13",
"browserify": "^13.0.0",
"del": "^2.2.0",
"electron-builder": "^3.17.1",
"electron-connect": "^0.4.0",
"electron-localshortcut": "^0.6.0",
"electron-packager": "7.0.1",
"electron-prebuilt": "1.0.2",
"envify": "^3.4.0",
"eslint": "^2.2.0",
"eslint": "2.9.0",
"eslint-plugin-react": "^5.0.1",
"event-stream": "^3.3.2",
"font-awesome": "^4.5.0",
Expand All @@ -53,6 +54,7 @@
"gulp-babel": "^6.1.1",
"gulp-changed": "^1.3.0",
"gulp-if": "^2.0.0",
"gulp-json-editor": "^2.2.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.1.1",
"gulp-sourcemaps": "^1.6.0",
Expand All @@ -75,5 +77,25 @@
"plugins": [
"transform-object-rest-spread"
]
},
"build": {
"app-bundle-id": "com.jamesproxy.james",
"app-category-type": "public.app-category.productivity",
"productName": "James",
"osx": {
"icon": "resource-compile/icon.icns",
"background": "resource-compile/icon.png"
},
"win": {
"iconUrl": "https://github.com/mitchhentges/james/blob/electron-builder/resource-compile/icon.ico?raw=true"
},
"linux": {
"synopsis": "Web proxy"
}
},
"directories": {
"buildResources": "resource-compile",
"output": "binaries",
"app": "./package"
}
}
File renamed without changes.
Binary file added resource-compile/icon.ico
Binary file not shown.
File renamed without changes
12 changes: 12 additions & 0 deletions resource-compile/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "james",
"version": "1.4.5",
"description": "HTTP/HTTPS proxy built in Electron and ReactJS",
"main": "electron-app.js",
"author": "Julian Hollmann <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/james-proxy/james.git"
}
}
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.