mirror of https://github.com/keeweb/keeweb.git
Building desktop images with grunt
This commit is contained in:
parent
ecd4833047
commit
196516faa1
130
Gruntfile.js
130
Gruntfile.js
|
@ -8,10 +8,12 @@ var StringReplacePlugin = require('string-replace-webpack-plugin');
|
|||
module.exports = function(grunt) {
|
||||
require('time-grunt')(grunt);
|
||||
require('load-grunt-tasks')(grunt);
|
||||
grunt.loadTasks('grunt/tasks');
|
||||
|
||||
var webpack = require('webpack');
|
||||
var pkg = require('./package.json');
|
||||
var dt = new Date().toISOString().replace(/T.*/, '');
|
||||
var electronVersion = '0.34.0';
|
||||
|
||||
function replaceFont(css) {
|
||||
css.walkAtRules('font-face', function (rule) {
|
||||
|
@ -37,12 +39,24 @@ module.exports = function(grunt) {
|
|||
}
|
||||
|
||||
grunt.initConfig({
|
||||
gitinfo: {
|
||||
branch: {
|
||||
current: {
|
||||
SHA: 'Current HEAD SHA',
|
||||
shortSHA: 'Current HEAD short SHA',
|
||||
name: 'Current branch name',
|
||||
lastCommitTime: 'Last commit time'
|
||||
}
|
||||
}
|
||||
},
|
||||
'bower-install-simple': {
|
||||
install: {
|
||||
}
|
||||
},
|
||||
clean: {
|
||||
dist: ['dist', 'tmp']
|
||||
dist: ['dist', 'tmp'],
|
||||
desktop_dist: ['dist/desktop'],
|
||||
desktop_tmp: ['tmp/desktop']
|
||||
},
|
||||
copy: {
|
||||
html: {
|
||||
|
@ -61,6 +75,21 @@ module.exports = function(grunt) {
|
|||
nonull: true,
|
||||
expand: true,
|
||||
flatten: true
|
||||
},
|
||||
'desktop_osx': {
|
||||
src: 'tmp/desktop/KeeWeb.dmg',
|
||||
dest: 'dist/desktop/KeeWeb.mac.dmg',
|
||||
nonull: true
|
||||
},
|
||||
'desktop_win': {
|
||||
src: 'tmp/desktop/KeeWeb Setup.exe',
|
||||
dest: 'dist/desktop/KeeWeb.win32.exe',
|
||||
nonull: true
|
||||
},
|
||||
'desktop_linux': {
|
||||
src: 'tmp/desktop/KeeWeb.linux.x64.zip',
|
||||
dest: 'dist/desktop/KeeWeb.linux.x64.zip',
|
||||
nonull: true
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
|
@ -114,7 +143,7 @@ module.exports = function(grunt) {
|
|||
options: {
|
||||
replacements: [{
|
||||
pattern: '# YYYY-MM-DD:v0.0.0',
|
||||
replacement: '# ' + dt + ':v' + require('./package').version
|
||||
replacement: '# ' + dt + ':v' + pkg.version
|
||||
}]
|
||||
},
|
||||
files: { 'dist/manifest.appcache': 'app/manifest.appcache' }
|
||||
|
@ -218,6 +247,90 @@ module.exports = function(grunt) {
|
|||
files: 'app/index.html',
|
||||
tasks: ['copy:html']
|
||||
}
|
||||
},
|
||||
electron: {
|
||||
options: {
|
||||
name: 'KeeWeb',
|
||||
dir: 'electron',
|
||||
out: 'tmp/desktop',
|
||||
version: electronVersion,
|
||||
overwrite: true,
|
||||
'app-version': pkg.version,
|
||||
'build-version': '<%= gitinfo.local.branch.current.shortSHA %>'
|
||||
},
|
||||
osx: {
|
||||
options: {
|
||||
platform: 'darwin',
|
||||
arch: 'x64',
|
||||
icon: 'graphics/app.icns'
|
||||
}
|
||||
},
|
||||
linux: {
|
||||
options: {
|
||||
platform: 'linux',
|
||||
arch: 'x64',
|
||||
icon: 'graphics/app.ico'
|
||||
}
|
||||
},
|
||||
win32: {
|
||||
options: {
|
||||
platform: 'win32',
|
||||
arch: 'ia32',
|
||||
icon: 'graphics/app.ico',
|
||||
'version-string': {
|
||||
CompanyName: 'antelle.github.io',
|
||||
LegalCopyright: 'Antelle, MIT license',
|
||||
FileDescription: 'KeeWeb Desktop',
|
||||
OriginalFilename: 'KeeWeb.exe',
|
||||
FileVersion: pkg.version,
|
||||
ProductVersion: pkg.version,
|
||||
ProductName: 'KeeWeb',
|
||||
InternalName: 'KeeWeb'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'electron_builder': {
|
||||
options: {
|
||||
out: path.join(__dirname, 'tmp/desktop'),
|
||||
basePath: __dirname,
|
||||
config: {
|
||||
osx: {
|
||||
title: 'KeeWeb',
|
||||
background: path.join(__dirname, 'graphics/dmg-bg.png'),
|
||||
icon: path.join(__dirname, 'graphics/app.icns'),
|
||||
'icon-size': 80,
|
||||
contents: [
|
||||
{'x': 438, 'y': 344, 'type': 'link', 'path': '/Applications'},
|
||||
{'x': 192, 'y': 344, 'type': 'file'}
|
||||
]
|
||||
},
|
||||
win: {
|
||||
title: 'KeeWeb',
|
||||
icon: path.join(__dirname, 'graphics/app.ico')
|
||||
}
|
||||
}
|
||||
},
|
||||
osx: {
|
||||
options: {
|
||||
platform: 'osx',
|
||||
appPath: path.join(__dirname, 'tmp/desktop/KeeWeb-darwin-x64')
|
||||
}
|
||||
},
|
||||
win: {
|
||||
options: {
|
||||
platform: 'win32',
|
||||
appPath: path.join(__dirname, 'tmp/desktop/KeeWeb-win32-ia32')
|
||||
}
|
||||
}
|
||||
},
|
||||
compress: {
|
||||
linux: {
|
||||
options: {
|
||||
archive: 'tmp/desktop/KeeWeb.linux.x64.zip'
|
||||
},
|
||||
files: [{ cwd: 'tmp/desktop/KeeWeb-linux-x64', src: '**', expand: true }]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -236,4 +349,17 @@ module.exports = function(grunt) {
|
|||
'htmlmin',
|
||||
'string-replace'
|
||||
]);
|
||||
|
||||
grunt.registerTask('desktop', [
|
||||
'gitinfo',
|
||||
'clean:desktop_tmp',
|
||||
'clean:desktop_dist',
|
||||
'electron',
|
||||
'electron_builder',
|
||||
'compress:linux',
|
||||
'copy:desktop_osx',
|
||||
'copy:desktop_win',
|
||||
'copy:desktop_linux',
|
||||
'clean:desktop_tmp'
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</head>
|
||||
<body class="th-d">
|
||||
<noscript>
|
||||
<h1>KeePass Web App</h1>
|
||||
<h1>KeeWeb</h1>
|
||||
<p>This app is written entirely in JavaScript. Please, enable JavaScript to run it.</p>
|
||||
</noscript>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
var builder = require('electron-builder').init();
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerMultiTask('electron_builder', 'Create app installer with electron-builder', function () {
|
||||
var done = this.async();
|
||||
builder.build(this.options(), function(err) {
|
||||
if (err) {
|
||||
grunt.warn(err);
|
||||
return;
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
};
|
|
@ -9,15 +9,19 @@
|
|||
"base64-loader": "^1.0.0",
|
||||
"cssnano": "^2.6.1",
|
||||
"ejs-loader": "^0.2.1",
|
||||
"electron-builder": "^2.1.1",
|
||||
"exports-loader": "^0.6.2",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-bower-install-simple": "^1.1.4",
|
||||
"grunt-contrib-clean": "^0.6.0",
|
||||
"grunt-contrib-compress": "^0.14.0",
|
||||
"grunt-contrib-copy": "^0.8.1",
|
||||
"grunt-contrib-htmlmin": "^0.4.0",
|
||||
"grunt-contrib-jshint": "^0.11.2",
|
||||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-electron": "^2.0.1",
|
||||
"grunt-gitinfo": "^0.1.7",
|
||||
"grunt-inline-alt": "^0.3.10",
|
||||
"grunt-postcss": "^0.6.0",
|
||||
"grunt-sass": "^1.0.0",
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"osx" : {
|
||||
"title": "KeeWeb",
|
||||
"background": "../graphics/dmg-bg.png",
|
||||
"icon": "../graphics/app.icns",
|
||||
"icon-size": 80,
|
||||
"contents": [
|
||||
{ "x": 438, "y": 344, "type": "link", "path": "/Applications" },
|
||||
{ "x": 192, "y": 344, "type": "file" }
|
||||
]
|
||||
},
|
||||
"win" : {
|
||||
"title": "KeeWeb",
|
||||
"icon": "graphics/app.ico"
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
electron-packager electron/ KeeWeb --platform=darwin --arch=x64 --version=0.34.0 --icon=graphics/app.icns
|
||||
electron-builder KeeWeb-darwin-x64/KeeWeb.app --platform=osx --out=. --config=./util/electron-builder.json
|
||||
mv KeeWeb.dmg KeeWeb.mac.dmg
|
||||
rm -rf ./KeeWeb-darwin-x64/
|
||||
|
||||
electron-packager electron/ KeeWeb --platform=linux --arch=x64 --version=0.34.0 --icon=graphics/app.ico
|
||||
zip -r ./KeeWeb.linux.x64.zip ./KeeWeb-linux-x64/
|
||||
rm -rf ./KeeWeb-linux-x64/
|
||||
|
||||
electron-packager electron/ KeeWeb --platform=win32 --arch=ia32 --version=0.34.0 --icon=graphics/app.ico
|
||||
electron-builder KeeWeb-win32-ia32 --platform=win --out=. --config=./util/electron-builder.json
|
||||
rm -rf ./KeeWeb-win32-ia32/
|
Loading…
Reference in New Issue