keeweb/Gruntfile.js

708 lines
25 KiB
JavaScript
Raw Normal View History

2015-10-17 23:49:24 +02:00
'use strict';
2016-07-17 13:30:38 +02:00
/* eslint-env node */
2017-01-31 07:50:28 +01:00
const fs = require('fs');
const path = require('path');
2015-10-17 23:49:24 +02:00
2017-01-31 07:50:28 +01:00
const StringReplacePlugin = require('string-replace-webpack-plugin');
const StatsPlugin = require('stats-webpack-plugin');
2015-10-17 23:49:24 +02:00
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
2015-11-07 08:55:45 +01:00
grunt.loadTasks('grunt/tasks');
2015-10-17 23:49:24 +02:00
2017-01-31 07:50:28 +01:00
const webpack = require('webpack');
const pkg = require('./package.json');
const dt = new Date().toISOString().replace(/T.*/, '');
const minElectronVersionForUpdate = '1.0.1';
let zipCommentPlaceholder = 'zip_comment_placeholder_that_will_be_replaced_with_hash';
const electronVersion = pkg.devDependencies['electron'].replace(/^\D/, '');
2016-03-05 12:16:12 +01:00
while (zipCommentPlaceholder.length < 512) {
zipCommentPlaceholder += '.';
}
2015-10-17 23:49:24 +02:00
function replaceFont(css) {
2016-07-17 13:30:38 +02:00
css.walkAtRules('font-face', rule => {
2017-01-31 07:50:28 +01:00
const fontFamily = rule.nodes.filter(n => n.prop === 'font-family')[0];
2015-10-17 23:49:24 +02:00
if (!fontFamily) {
throw 'Bad font rule: ' + rule.toString();
}
2017-01-31 07:50:28 +01:00
const value = fontFamily.value.replace(/["']/g, '');
const fontFiles = {
2015-10-17 23:49:24 +02:00
FontAwesome: 'fontawesome-webfont.woff'
};
2017-01-31 07:50:28 +01:00
const fontFile = fontFiles[value];
2015-10-17 23:49:24 +02:00
if (!fontFile) {
throw 'Unsupported font ' + value + ': ' + rule.toString();
}
2017-01-31 07:50:28 +01:00
const data = fs.readFileSync('tmp/fonts/' + fontFile, 'base64');
const src = 'url(data:application/font-woff;charset=utf-8;base64,{data}) format(\'woff\')'
2015-10-17 23:49:24 +02:00
.replace('{data}', data);
2016-07-17 13:30:38 +02:00
// var src = 'url(\'../fonts/fontawesome-webfont.woff\') format(\'woff\')';
rule.nodes = rule.nodes.filter(n => n.prop !== 'src');
2015-10-17 23:49:24 +02:00
rule.append({ prop: 'src', value: src });
});
}
2017-01-31 07:50:28 +01:00
const webpackConfig = {
2016-07-16 13:36:15 +02:00
entry: {
app: 'app',
2017-02-04 14:17:33 +01:00
vendor: ['jquery', 'underscore', 'backbone', 'kdbxweb', 'baron', 'dropbox', 'pikaday', 'filesaver', 'qrcode',
'argon2-asm', 'argon2-wasm', 'argon2']
2016-07-16 13:36:15 +02:00
},
output: {
2017-01-30 22:55:26 +01:00
path: path.resolve('.', 'tmp/js'),
2016-07-16 13:36:15 +02:00
filename: 'app.js'
},
stats: {
colors: false,
modules: true,
reasons: true
},
progress: false,
failOnError: true,
resolve: {
2017-01-30 22:55:26 +01:00
modules: [path.join(__dirname, 'app/scripts'), path.join(__dirname, 'bower_components')],
2016-07-16 13:36:15 +02:00
alias: {
backbone: 'backbone/backbone-min.js',
underscore: 'underscore/underscore-min.js',
_: 'underscore/underscore-min.js',
jquery: 'jquery/dist/jquery.min.js',
2017-01-30 22:55:26 +01:00
hbs: path.resolve(__dirname, 'node_modules', 'handlebars/runtime.js'),
2016-07-16 13:36:15 +02:00
kdbxweb: 'kdbxweb/dist/kdbxweb.js',
dropbox: 'dropbox/lib/dropbox.min.js',
baron: 'baron/baron.min.js',
pikaday: 'pikaday/pikaday.js',
filesaver: 'FileSaver.js/FileSaver.min.js',
qrcode: 'jsqrcode/dist/qrcode.min.js',
2017-02-04 14:17:33 +01:00
'argon2-asm': 'argon2-browser/docs/dist/argon2-asm.min.js',
'argon2-wasm': 'argon2-browser/docs/dist/argon2.wasm',
'argon2': 'argon2-browser/docs/dist/argon2.min.js',
2016-07-16 13:36:15 +02:00
templates: path.join(__dirname, 'app/templates')
}
},
module: {
loaders: [
{ test: /\.hbs$/, loader: StringReplacePlugin.replace('handlebars-loader', { replacements: [{
pattern: /\r?\n\s*/g,
replacement: function() { return '\n'; }
}]})},
2017-01-28 23:13:39 +01:00
{ test: /runtime-info\.js$/, loader: StringReplacePlugin.replace({ replacements: [
2016-07-16 13:36:15 +02:00
{ pattern: /@@VERSION/g, replacement: function() { return pkg.version; } },
{ pattern: /@@DATE/g, replacement: function() { return dt; } },
{ pattern: /@@COMMIT/g, replacement: function() { return grunt.config.get('gitinfo.local.branch.current.shortSHA'); } }
]})},
2017-01-30 22:55:26 +01:00
{ test: /baron(\.min)?\.js$/, loader: 'exports-loader?baron; delete window.baron;' },
{ test: /pikaday\.js$/, loader: 'uglify-loader' },
2016-07-16 13:36:15 +02:00
{ test: /handlebars/, loader: 'strip-sourcemap-loader' },
2017-01-30 22:55:26 +01:00
{ test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel-loader',
2016-07-16 13:36:15 +02:00
query: { presets: ['es2015'], cacheDirectory: true }
2016-08-21 23:12:49 +02:00
},
2017-01-30 22:55:26 +01:00
{ test: /\.json$/, loader: 'json-loader' },
2017-02-04 14:17:33 +01:00
{ test: /argon2-asm\.min\.js$/, loader: 'raw-loader' },
{ test: /argon2\.wasm$/, loader: 'base64-loader' },
{ test: /argon2\.min\.js/, loader: 'raw-loader' } // exports-loader?Module
2016-07-16 13:36:15 +02:00
]
},
plugins: [
2017-01-30 22:55:26 +01:00
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: Infinity, filename: 'vendor.js' }),
2017-01-30 21:26:31 +01:00
new webpack.BannerPlugin('keeweb v' + pkg.version + ', (c) ' + new Date().getFullYear() + ' ' + pkg.author.name +
2016-07-16 13:36:15 +02:00
', opensource.org/licenses/' + pkg.license),
new webpack.ProvidePlugin({ _: 'underscore', $: 'jquery' }),
new webpack.IgnorePlugin(/^(moment)$/),
2016-09-23 21:12:02 +02:00
new StringReplacePlugin(),
new StatsPlugin('stats.json', { chunkModules: true })
2016-07-16 13:36:15 +02:00
],
node: {
console: false,
process: false,
2017-01-29 23:28:04 +01:00
crypto: false,
2016-07-16 13:36:15 +02:00
Buffer: false,
__filename: false,
2017-01-30 21:26:31 +01:00
__dirname: false,
2017-01-30 22:55:26 +01:00
fs: false,
2017-01-30 23:02:24 +01:00
setImmediate: false,
path: false
2016-07-16 13:36:15 +02:00
},
externals: {
2017-01-29 23:28:04 +01:00
xmldom: 'null',
2017-01-30 21:26:31 +01:00
crypto: 'null',
2017-01-30 23:02:24 +01:00
fs: 'null',
path: 'null'
2016-07-16 13:36:15 +02:00
}
};
2015-10-17 23:49:24 +02:00
grunt.initConfig({
2015-11-07 08:55:45 +01:00
gitinfo: {
branch: {
current: {
SHA: 'Current HEAD SHA',
shortSHA: 'Current HEAD short SHA',
name: 'Current branch name',
lastCommitTime: 'Last commit time'
}
}
},
2015-10-17 23:49:24 +02:00
'bower-install-simple': {
install: {
}
},
clean: {
2015-11-07 08:55:45 +01:00
dist: ['dist', 'tmp'],
2016-07-16 18:39:52 +02:00
desktop: ['tmp/desktop', 'dist/desktop']
2015-10-17 23:49:24 +02:00
},
copy: {
html: {
src: 'app/index.html',
dest: 'tmp/index.html',
nonull: true
},
favicon: {
src: 'app/favicon.png',
dest: 'tmp/favicon.png',
nonull: true
},
2016-02-07 14:08:37 +01:00
touchicon: {
src: 'app/touchicon.png',
dest: 'tmp/touchicon.png',
nonull: true
},
2015-10-17 23:49:24 +02:00
fonts: {
src: 'bower_components/font-awesome/fonts/fontawesome-webfont.*',
dest: 'tmp/fonts/',
nonull: true,
expand: true,
flatten: true
2015-11-07 08:55:45 +01:00
},
2016-07-16 18:39:52 +02:00
'desktop-app-content': {
2017-01-28 23:13:39 +01:00
cwd: 'desktop/',
2015-11-14 09:39:22 +01:00
src: '**',
dest: 'tmp/desktop/app/',
expand: true,
nonull: true
},
2016-07-16 18:39:52 +02:00
'desktop-windows-helper-ia32': {
2016-08-09 04:59:44 +02:00
src: 'helper/win32/KeeWebHelper.exe',
2016-08-08 21:53:59 +02:00
dest: 'tmp/desktop/KeeWeb-win32-ia32/resources/app/',
2015-11-07 08:55:45 +01:00
nonull: true
2016-03-01 20:06:23 +01:00
},
2016-07-16 18:39:52 +02:00
'desktop-windows-helper-x64': {
2016-08-09 04:59:44 +02:00
src: 'helper/win32/KeeWebHelper.exe',
2016-08-08 21:53:59 +02:00
dest: 'tmp/desktop/KeeWeb-win32-x64/resources/app/',
nonull: true
},
'desktop-darwin-helper-x64': {
2016-08-09 04:59:44 +02:00
src: 'helper/darwin/KeeWebHelper',
2016-08-12 20:11:46 +02:00
dest: 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app/Contents/Resources/app/',
2016-08-12 20:21:32 +02:00
nonull: true,
2016-08-12 20:30:47 +02:00
options: { mode: '0755' }
2016-07-21 22:54:03 +02:00
},
2016-07-22 21:13:39 +02:00
'desktop-win32-dist-x64': {
src: 'tmp/desktop/KeeWeb.win.x64.exe',
dest: `dist/desktop/KeeWeb-${pkg.version}.win.x64.exe`,
nonull: true
},
'desktop-win32-dist-ia32': {
src: 'tmp/desktop/KeeWeb.win.ia32.exe',
dest: `dist/desktop/KeeWeb-${pkg.version}.win.ia32.exe`,
2016-07-21 22:54:03 +02:00
nonull: true
2015-10-17 23:49:24 +02:00
}
},
2016-07-17 13:30:38 +02:00
eslint: {
app: ['app/scripts/**/*.js'],
2017-01-28 23:13:39 +01:00
desktop: ['desktop/**/*.js', '!desktop/node_modules/**'],
2016-07-17 13:30:38 +02:00
grunt: ['Gruntfile.js', 'grunt/**/*.js']
2015-10-17 23:49:24 +02:00
},
sass: {
options: {
sourceMap: false,
includePaths: ['./bower_components']
},
dist: {
files: {
'tmp/css/main.css': 'app/styles/main.scss'
}
}
},
postcss: {
options: {
processors: [
replaceFont,
require('cssnano')({discardComments: {removeAll: true}})
]
},
dist: {
src: 'tmp/css/main.css',
dest: 'tmp/css/main.css'
}
},
inline: {
app: {
src: 'tmp/index.html',
dest: 'tmp/app.html'
}
},
htmlmin: {
options: {
removeComments: true,
collapseWhitespace: true
},
app: {
files: {
2015-10-17 23:53:17 +02:00
'dist/index.html': 'tmp/app.html'
2015-10-17 23:49:24 +02:00
}
}
},
2015-10-21 23:02:17 +02:00
'string-replace': {
manifest: {
options: {
2015-11-14 09:39:22 +01:00
replacements: [
2016-01-17 21:34:40 +01:00
{ pattern: '# YYYY-MM-DD:v0.0.0', replacement: '# ' + dt + ':v' + pkg.version },
2016-02-03 21:44:18 +01:00
{ pattern: '# updmin:v0.0.0', replacement: '# updmin:v' + minElectronVersionForUpdate }
2015-11-14 09:39:22 +01:00
]
2015-10-21 23:02:17 +02:00
},
files: { 'dist/manifest.appcache': 'app/manifest.appcache' }
2015-11-14 09:39:22 +01:00
},
2016-07-16 18:39:52 +02:00
'manifest-html': {
2015-12-06 21:32:41 +01:00
options: { replacements: [{ pattern: '<html', replacement: '<html manifest="manifest.appcache"' }] },
files: { 'dist/index.html': 'dist/index.html' }
},
2016-07-16 18:39:52 +02:00
'desktop-html': {
2015-11-14 09:39:22 +01:00
options: { replacements: [{ pattern: ' manifest="manifest.appcache"', replacement: '' }] },
files: { 'tmp/desktop/app/index.html': 'dist/index.html' }
2015-10-21 23:02:17 +02:00
}
},
2015-10-17 23:49:24 +02:00
webpack: {
2016-07-16 13:36:15 +02:00
js: webpackConfig
},
'webpack-dev-server': {
options: {
webpack: webpackConfig,
publicPath: '/tmp/js',
progress: false
},
2015-10-17 23:49:24 +02:00
js: {
2017-01-30 22:55:26 +01:00
keepalive: true,
2016-07-16 13:36:15 +02:00
webpack: {
devtool: 'source-map'
2016-04-23 17:01:56 +02:00
},
2016-07-16 13:36:15 +02:00
port: 8085
2015-10-17 23:49:24 +02:00
}
},
uglify: {
options: {
preserveComments: false
},
app: {
files: { 'tmp/js/app.js': ['tmp/js/app.js'] }
},
vendor: {
options: {
mangle: false,
compress: false
},
files: { 'tmp/js/vendor.js': ['tmp/js/vendor.js'] }
}
},
watch: {
options: {
interrupt: true,
debounceDelay: 500
},
styles: {
files: 'app/styles/**/*.scss',
tasks: ['sass']
},
indexhtml: {
files: 'app/index.html',
tasks: ['copy:html']
}
2015-11-07 08:55:45 +01:00
},
electron: {
options: {
name: 'KeeWeb',
2015-11-14 09:39:22 +01:00
dir: 'tmp/desktop/app',
2015-11-07 08:55:45 +01:00
out: 'tmp/desktop',
2017-02-03 23:01:49 +01:00
electronVersion: electronVersion,
2015-11-07 08:55:45 +01:00
overwrite: true,
2016-07-16 18:39:52 +02:00
'app-copyright': 'Copyright © 2016 Antelle',
2015-11-07 08:55:45 +01:00
'app-version': pkg.version,
2016-07-17 13:30:38 +02:00
'build-version': '<%= gitinfo.local.branch.current.shortSHA %>'
2015-11-07 08:55:45 +01:00
},
2016-07-16 18:39:52 +02:00
linux: {
2015-11-07 08:55:45 +01:00
options: {
platform: 'linux',
2016-07-16 18:39:52 +02:00
arch: ['x64', 'ia32'],
2016-07-16 18:49:19 +02:00
icon: 'graphics/icon.ico'
2015-11-07 08:55:45 +01:00
}
},
2016-07-16 18:39:52 +02:00
darwin: {
2016-03-01 20:06:23 +01:00
options: {
2016-07-16 18:39:52 +02:00
platform: 'darwin',
arch: ['x64'],
icon: 'graphics/icon.icns',
'app-bundle-id': 'net.antelle.keeweb',
'app-category-type': 'public.app-category.productivity',
'extend-info': 'package/osx/extend.plist'
2016-03-01 20:06:23 +01:00
}
2015-11-07 08:55:45 +01:00
},
2016-07-16 18:39:52 +02:00
win32: {
2015-11-07 08:55:45 +01:00
options: {
2016-07-16 18:39:52 +02:00
platform: 'win32',
arch: ['ia32', 'x64'],
2016-07-16 18:49:19 +02:00
icon: 'graphics/icon.ico',
2016-07-16 19:09:06 +02:00
'build-version': pkg.version,
'version-string': {
'CompanyName': 'KeeWeb',
2016-07-16 19:09:55 +02:00
'FileDescription': pkg.description,
2016-07-16 19:09:06 +02:00
'OriginalFilename': 'KeeWeb.exe',
'ProductName': 'KeeWeb',
'InternalName': 'KeeWeb'
}
2015-11-07 08:55:45 +01:00
}
}
},
compress: {
2016-07-16 18:39:52 +02:00
options: {
level: 6
},
'desktop-update': {
options: { archive: 'dist/desktop/UpdateDesktop.zip', comment: zipCommentPlaceholder },
2016-09-01 19:24:11 +02:00
files: [
{ cwd: 'tmp/desktop/app', src: '**', expand: true, nonull: true },
2016-09-01 20:08:35 +02:00
{ src: 'helper', nonull: true },
{ src: 'helper/darwin', nonull: true },
2016-09-01 19:24:11 +02:00
{ src: 'helper/darwin/KeeWebHelper', nonull: true },
2016-09-01 20:08:35 +02:00
{ src: 'helper/win32', nonull: true },
2016-09-01 19:24:11 +02:00
{ src: 'helper/win32/KeeWebHelper.exe', nonull: true }
]
2016-07-16 18:39:52 +02:00
},
'win32-x64': {
2016-07-22 21:13:39 +02:00
options: { archive: `dist/desktop/KeeWeb-${pkg.version}.win.x64.zip` },
2016-07-16 18:39:52 +02:00
files: [{ cwd: 'tmp/desktop/KeeWeb-win32-x64', src: '**', expand: true }]
},
'win32-ia32': {
2016-07-22 21:13:39 +02:00
options: { archive: `dist/desktop/KeeWeb-${pkg.version}.win.ia32.zip` },
2016-07-16 18:39:52 +02:00
files: [{ cwd: 'tmp/desktop/KeeWeb-win32-ia32', src: '**', expand: true }]
},
'linux-x64': {
2016-07-22 21:13:39 +02:00
options: { archive: `dist/desktop/KeeWeb-${pkg.version}.linux.x64.zip` },
2015-11-07 08:55:45 +01:00
files: [{ cwd: 'tmp/desktop/KeeWeb-linux-x64', src: '**', expand: true }]
2015-11-14 12:09:36 +01:00
},
2016-07-16 18:39:52 +02:00
'linux-ia32': {
2016-07-22 21:13:39 +02:00
options: { archive: `dist/desktop/KeeWeb-${pkg.version}.linux.ia32.zip` },
2016-03-01 20:06:23 +01:00
files: [{ cwd: 'tmp/desktop/KeeWeb-linux-ia32', src: '**', expand: true }]
2016-07-16 18:39:52 +02:00
}
},
appdmg: {
options: {
title: 'KeeWeb',
icon: 'graphics/icon.icns',
background: 'graphics/background.png',
'background-color': '#E0E6F9',
'icon-size': 80,
window: { size: { width: 658, height: 498 } },
contents: [
{ x: 438, y: 344, type: 'link', path: '/Applications' },
{ x: 192, y: 344, type: 'file', path: 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app' }
]
2016-03-01 20:06:23 +01:00
},
2016-07-16 18:39:52 +02:00
app: {
2016-07-22 21:13:39 +02:00
dest: `dist/desktop/KeeWeb-${pkg.version}.mac.dmg`
2015-11-07 08:55:45 +01:00
}
2015-11-14 16:47:51 +01:00
},
2016-07-16 20:35:16 +02:00
nsis: {
options: {
vars: {
version: pkg.version,
rev: function() { return grunt.config.get('gitinfo.local.branch.current.shortSHA'); },
homepage: pkg.homepage
}
},
'win32-x64': {
options: {
2016-07-22 21:13:39 +02:00
installScript: 'package/nsis/main.nsi',
2016-07-17 11:13:14 +02:00
arch: 'x64',
2016-07-21 22:54:03 +02:00
output: 'tmp/desktop/KeeWeb.win.x64.exe'
2016-07-16 20:35:16 +02:00
}
},
2016-07-22 21:13:39 +02:00
'win32-un-x64': {
options: {
installScript: 'package/nsis/main-un.nsi',
arch: 'x64',
output: 'tmp/desktop/KeeWeb-win32-x64/uninst.exe'
}
},
2016-07-16 20:35:16 +02:00
'win32-ia32': {
options: {
2016-07-22 21:13:39 +02:00
installScript: 'package/nsis/main.nsi',
2016-07-17 11:13:14 +02:00
arch: 'ia32',
2016-07-21 22:54:03 +02:00
output: 'tmp/desktop/KeeWeb.win.ia32.exe'
2016-07-16 20:35:16 +02:00
}
2016-07-22 21:13:39 +02:00
},
'win32-un-ia32': {
options: {
installScript: 'package/nsis/main-un.nsi',
arch: 'ia32',
output: 'tmp/desktop/KeeWeb-win32-ia32/uninst.exe'
}
2016-07-16 20:35:16 +02:00
}
},
2016-04-02 13:21:07 +02:00
deb: {
2016-07-16 18:39:52 +02:00
'linux-x64': {
2016-04-02 13:21:07 +02:00
options: {
tmpPath: 'tmp/desktop/',
package: {
name: 'keeweb-desktop',
version: pkg.version,
description: pkg.description,
author: pkg.author,
homepage: pkg.homepage,
rev: function() { return grunt.config.get('gitinfo.local.branch.current.shortSHA'); }
},
info: {
arch: 'amd64',
2016-07-16 18:39:52 +02:00
targetDir: 'dist/desktop',
2016-07-22 21:13:39 +02:00
pkgName: `KeeWeb-${pkg.version}.linux.x64.deb`,
2016-04-08 17:47:37 +02:00
appName: 'KeeWeb',
2016-07-21 21:37:23 +02:00
depends: 'libappindicator1',
2016-04-02 21:37:25 +02:00
scripts: {
postinst: 'package/deb/scripts/postinst'
}
2016-04-02 13:21:07 +02:00
}
},
files: [
{
cwd: 'package/deb/usr',
src: '**',
dest: '/usr',
expand: true,
nonull: true
},
{
cwd: 'tmp/desktop/KeeWeb-linux-x64/',
src: '**',
dest: '/opt/keeweb-desktop',
expand: true,
nonull: true
},
{
2016-04-02 21:03:02 +02:00
src: 'graphics/128x128.png',
2016-04-02 13:21:07 +02:00
dest: '/usr/share/icons/hicolor/128x128/apps/keeweb.png',
nonull: true
}]
}
},
2016-03-05 12:16:12 +01:00
'sign-archive': {
2016-07-16 18:39:52 +02:00
'desktop-update': {
2016-03-05 12:16:12 +01:00
options: {
file: 'dist/desktop/UpdateDesktop.zip',
signature: zipCommentPlaceholder,
2016-03-05 13:05:44 +01:00
privateKey: 'keys/private-key.pem'
2016-03-05 12:16:12 +01:00
}
}
},
2015-11-14 16:47:51 +01:00
'validate-desktop-update': {
desktop: {
options: {
file: 'dist/desktop/UpdateDesktop.zip',
2016-09-01 19:24:11 +02:00
expected: [
2016-09-01 20:08:35 +02:00
'main.js', 'app.js', 'index.html', 'package.json', 'icon.png',
2016-09-01 19:24:11 +02:00
'node_modules/node-stream-zip/node_stream_zip.js',
'helper/darwin/KeeWebHelper',
'helper/win32/KeeWebHelper.exe'
],
2016-09-01 20:08:35 +02:00
expectedCount: 15,
2016-03-05 12:45:37 +01:00
publicKey: 'app/resources/public-key.pem'
2015-11-14 16:47:51 +01:00
}
}
2016-04-02 22:44:53 +02:00
},
'sign-html': {
'app': {
options: {
file: 'dist/index.html',
privateKey: 'keys/private-key.pem'
}
}
2016-07-16 13:36:15 +02:00
},
2016-07-20 19:05:39 +02:00
'sign-exe': {
2016-07-21 22:54:03 +02:00
options: {
spc: 'keys/code-sign-win32.spc',
pvk: 'keys/code-sign-win32.pvk',
algo: 'sha1',
url: pkg.homepage,
keytarPasswordService: 'code-sign-win32-keeweb',
keytarPasswordAccount: 'code-sign-win32-keeweb'
},
2016-07-22 21:13:39 +02:00
'win32-build-x64': {
options: {
files: {
'tmp/desktop/KeeWeb-win32-x64/KeeWeb.exe': 'KeeWeb',
'tmp/desktop/KeeWeb-win32-x64/ffmpeg.dll': '',
'tmp/desktop/KeeWeb-win32-x64/libEGL.dll': 'ANGLE libEGL Dynamic Link Library',
'tmp/desktop/KeeWeb-win32-x64/libGLESv2.dll': 'ANGLE libGLESv2 Dynamic Link Library',
'tmp/desktop/KeeWeb-win32-x64/node.dll': 'Node.js'
}
}
},
'win32-build-ia32': {
options: {
files: {
'tmp/desktop/KeeWeb-win32-ia32/KeeWeb.exe': 'KeeWeb',
'tmp/desktop/KeeWeb-win32-ia32/ffmpeg.dll': '',
'tmp/desktop/KeeWeb-win32-ia32/libEGL.dll': 'ANGLE libEGL Dynamic Link Library',
'tmp/desktop/KeeWeb-win32-ia32/libGLESv2.dll': 'ANGLE libGLESv2 Dynamic Link Library',
'tmp/desktop/KeeWeb-win32-ia32/node.dll': 'Node.js'
}
}
},
'win32-uninst-x64': {
options: {
files: {
'tmp/desktop/KeeWeb-win32-x64/uninst.exe': 'KeeWeb Uninstaller'
}
}
},
'win32-uninst-ia32': {
options: {
files: {
'tmp/desktop/KeeWeb-win32-ia32/uninst.exe': 'KeeWeb Uninstaller'
}
}
},
2016-07-21 22:54:03 +02:00
'win32-installer-x64': {
options: {
2016-07-22 21:13:39 +02:00
files: {
'tmp/desktop/KeeWeb.win.x64.exe': 'KeeWeb Setup'
}
2016-07-21 22:54:03 +02:00
}
},
'win32-installer-ia32': {
2016-07-20 19:05:39 +02:00
options: {
2016-07-22 21:13:39 +02:00
files: {
'tmp/desktop/KeeWeb.win.ia32.exe': 'KeeWeb Setup'
}
2016-07-20 19:05:39 +02:00
}
}
2016-07-20 19:32:21 +02:00
},
2016-07-16 13:36:15 +02:00
'concurrent': {
options: {
2016-07-17 13:30:38 +02:00
logConcurrentOutput: true
2016-07-16 13:36:15 +02:00
},
'dev-server': [
2016-07-17 15:44:13 +02:00
'watch:styles',
2016-07-16 13:36:15 +02:00
'webpack-dev-server'
]
2015-10-17 23:49:24 +02:00
}
});
2016-07-16 18:39:52 +02:00
// compound builder tasks
grunt.registerTask('build-web-app', [
2015-11-14 09:39:22 +01:00
'gitinfo',
2015-10-17 23:49:24 +02:00
'bower-install-simple',
'clean',
2016-07-17 13:30:38 +02:00
'eslint',
2015-10-17 23:49:24 +02:00
'copy:html',
'copy:favicon',
2016-02-07 14:08:37 +01:00
'copy:touchicon',
2015-10-17 23:49:24 +02:00
'copy:fonts',
'webpack',
'uglify',
'sass',
'postcss',
'inline',
2015-10-21 23:02:17 +02:00
'htmlmin',
2016-07-16 18:39:52 +02:00
'string-replace:manifest-html',
2016-04-02 22:44:53 +02:00
'string-replace:manifest',
'sign-html'
2015-10-17 23:49:24 +02:00
]);
2015-11-07 08:55:45 +01:00
2016-07-16 18:39:52 +02:00
grunt.registerTask('build-desktop-app-content', [
'copy:desktop-app-content',
2016-07-17 13:30:38 +02:00
'string-replace:desktop-html'
2016-07-16 13:36:15 +02:00
]);
2016-07-16 18:39:52 +02:00
grunt.registerTask('build-desktop-update', [
'compress:desktop-update',
'sign-archive:desktop-update',
2016-07-17 13:30:38 +02:00
'validate-desktop-update'
2016-07-16 18:39:52 +02:00
]);
grunt.registerTask('build-desktop-executables', [
2015-11-07 08:55:45 +01:00
'electron',
2016-07-22 21:13:39 +02:00
'sign-exe:win32-build-x64',
'sign-exe:win32-build-ia32',
2016-08-08 21:53:59 +02:00
'copy:desktop-darwin-helper-x64',
2016-07-16 18:39:52 +02:00
'copy:desktop-windows-helper-ia32',
2016-07-17 13:30:38 +02:00
'copy:desktop-windows-helper-x64'
2016-07-16 18:39:52 +02:00
]);
grunt.registerTask('build-desktop-archives', [
'compress:win32-x64',
'compress:win32-ia32',
'compress:linux-x64',
2016-07-17 13:30:38 +02:00
'compress:linux-ia32'
2016-07-16 18:39:52 +02:00
]);
grunt.registerTask('build-desktop-dist-darwin', [
'appdmg'
]);
grunt.registerTask('build-desktop-dist-win32', [
2016-07-22 21:13:39 +02:00
'nsis:win32-un-x64',
'nsis:win32-un-ia32',
'sign-exe:win32-uninst-x64',
'sign-exe:win32-uninst-ia32',
2016-07-16 20:35:16 +02:00
'nsis:win32-x64',
2016-07-21 22:54:03 +02:00
'nsis:win32-ia32',
'sign-exe:win32-installer-x64',
'sign-exe:win32-installer-ia32',
2016-07-22 21:13:39 +02:00
'copy:desktop-win32-dist-x64',
'copy:desktop-win32-dist-ia32'
2016-07-16 18:39:52 +02:00
]);
grunt.registerTask('build-desktop-dist-linux', [
'deb:linux-x64'
]);
grunt.registerTask('build-desktop-dist', [
'build-desktop-dist-darwin',
'build-desktop-dist-win32',
'build-desktop-dist-linux'
]);
grunt.registerTask('build-desktop', [
'gitinfo',
'clean:desktop',
'build-desktop-app-content',
'build-desktop-update',
'build-desktop-executables',
'build-desktop-archives',
'build-desktop-dist'
]);
// entry point tasks
grunt.registerTask('default', 'Default: build web app', [
'build-web-app'
]);
2016-09-18 12:30:09 +02:00
grunt.registerTask('dev', 'Build project and start web server and watcher', [
'build-web-app',
'devsrv'
]);
grunt.registerTask('devsrv', 'Start web server and watcher', [
2016-07-16 18:39:52 +02:00
'concurrent:dev-server'
2015-11-07 08:55:45 +01:00
]);
2016-07-16 13:36:15 +02:00
2016-07-16 18:39:52 +02:00
grunt.registerTask('desktop', 'Build web and desktop apps for all platforms', [
2016-07-16 13:36:15 +02:00
'default',
'build-desktop'
]);
2015-10-17 23:49:24 +02:00
};