Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
feat(desktop): added a way to make a desktop build for all platforms
Browse files Browse the repository at this point in the history
closes #19
  • Loading branch information
seiyria committed Oct 13, 2015
1 parent b61ce34 commit 977267f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -30,4 +30,7 @@ bower_components
.idea
.publish

dist
dist

bin-build
bin-cache
Binary file added favicon.icns
Binary file not shown.
39 changes: 36 additions & 3 deletions gulpfile.js
Expand Up @@ -39,6 +39,8 @@ var cached = require('gulp-cached');
var remember = require('gulp-remember');
var mocha = require('gulp-mocha');
var changelog = require('conventional-changelog');
var nwBuilder = require('gulp-nw-builder');
var packageJson = require('./package.json');

var watching = false;

Expand All @@ -49,7 +51,7 @@ var getPaths = function() {
gulp.task('deploy', function() {
var paths = getPaths();

return gulp.src(paths.dist + '**/*')
return gulp.src(paths.dist + '/(css|js|favicon.ico|index.html)')
.pipe(ghPages());
});

Expand Down Expand Up @@ -93,7 +95,7 @@ gulp.task('build:libjs', ['clean'], function() {
return gulp.src(paths.libjs)
//.pipe(cached('libjs'))
//.pipe(remember('libjs'))
.pipe(gulpif(!watching, uglify({ outSourceMaps: false })))
//.pipe(gulpif(!watching, uglify({ outSourceMaps: false })))
.pipe(concat('lib.min.js'))
.pipe(gulp.dest(paths.dist + 'js'))
.on('error', util.log);
Expand All @@ -117,7 +119,7 @@ gulp.task('compile:js', ['eslint', 'clean'], function() {
return bundler
.bundle()
.pipe(source('js/main.min.js'))
.pipe(gulpif(!watching, streamify(uglify({ outSourceMaps: false }))))
//.pipe(gulpif(!watching, uglify({ outSourceMaps: false })))
.pipe(ngAnnotate())
.pipe(gulp.dest(paths.dist))
.on('error', util.log);
Expand Down Expand Up @@ -265,6 +267,37 @@ gulp.task('generate:changelog', function() {
.pipe(fs.createWriteStream('CHANGELOG.md'));
});

gulp.task('copy:nw', function() {
var paths = getPaths();

return gulp.src(['./package.json', 'nw-setup/**/*'])
.pipe(gulp.dest(paths.dist))
.on('error', util.log);
});

gulp.task('generate:binaries', ['clean:binaries', 'copy:nw'], function() {
execSync('npm install --prefix ./dist/ express');
var paths = getPaths();

return gulp.src(paths.dist+'/**/*')
.pipe(nwBuilder({
version: 'v0.12.2',
platforms: ['osx64', 'win64', 'linux64'],
appName: packageJson.name,
appVersion: packageJson.version,
buildDir: './bin-build',
cacheDir: './bin-cache',
macIcns: './favicon.icns',
winIco: './favicon.ico'
}));
});

gulp.task('clean:binaries', function() {
return gulp.src('./bin-build')
.pipe(vinylPaths(del))
.on('error', util.log);
});

gulp.task('test', function() {
var paths = getPaths();

Expand Down
12 changes: 12 additions & 0 deletions nw-setup/nw.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>rerouting...</title>
<script>
window.location.href = 'http://localhost:30517';
</script>
</head>
<body>
</body>
</html>
5 changes: 5 additions & 0 deletions nw-setup/nw.js
@@ -0,0 +1,5 @@
var express = require('express');
var expressApp = express();

expressApp.use(express.static(__dirname));
expressApp.listen(30517);
14 changes: 13 additions & 1 deletion package.json
@@ -1,5 +1,5 @@
{
"name": "openchallenge",
"name": "OpenChallenge",
"description": "A tournament management tool.",
"readme": "README.md",
"repository": "https://github.com/seiyria/openchallenge",
Expand All @@ -8,6 +8,17 @@
"authors": [
"Kyle Kemp <kyle@seiyria.com>"
],

"node-main": "nw.js",
"main": "nw.html",

"window": {
"title": "OpenChallenge - loading...",
"width": 1024,
"height": 768,
"toolbar": false
},

"devDependencies": {
"babel": "^5.8.23",
"babel-eslint": "^4.1.0",
Expand Down Expand Up @@ -37,6 +48,7 @@
"gulp-minify-css": "~1.2.1",
"gulp-mocha": "^2.1.3",
"gulp-ng-annotate": "^1.1.0",
"gulp-nw-builder": "^1.3.1",
"gulp-open": "~1.0.0",
"gulp-remember": "^0.3.0",
"gulp-rename": "~1.2.2",
Expand Down

0 comments on commit 977267f

Please sign in to comment.