-
Notifications
You must be signed in to change notification settings - Fork 109
/
gulpfile.js
96 lines (86 loc) · 3.09 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
var gulp = require('gulp');
var clean = require('gulp-clean');
var browserify = require('gulp-browserify');
var rename = require('gulp-rename');
var closureCompiler = require('gulp-closure-compiler');
var source = require('vinyl-source-stream');
var jasmine = require('gulp-jasmine');
var PEG = require('pegjs');
var fs = require('fs');
var electron = require('gulp-electron');
var packageJson = require('./package.json');
gulp.task('clean-dist', function(){
return gulp.src('dist', {read: false})
.pipe(clean());
});
gulp.task('browserify', ['clean-dist'], function() {
return gulp.src(['./src/store.js'])
.pipe(browserify({
standalone: 'rdfstore',
exclude: ["sqlite3","indexeddb-js"]
}))
.pipe(rename('rdfstore.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('minimize', [ 'browserify' ], function() {
return gulp.src('dist/*.js')
.pipe(closureCompiler({
continueWithWarnings: true,
compilerPath: './node_modules/google-closure-compiler/compiler.jar',
fileName: 'dist/rdfstore_min.js',
compilerFlags: {
'language_in': 'ECMASCRIPT5'
//'compilation_level': 'ADVANCED_OPTIMIZATIONS'
}
}))
.pipe(gulp.dest("."));
});
gulp.task('performance',function(){
require('./src/perftest/trees');
});
gulp.task('specs', function () {
return gulp.src('./spec/*.js')
.pipe(jasmine({includeStackTrace: true, verbose:true}));
});
gulp.task('parseGrammar', function(){
fs.readFile('pegjs/sparql_query.grammar', 'utf8', function(err, grammar){
if(err) {
throw err;
} else {
var parser = PEG.generate(grammar, {output: 'source'});
//var parser = PEG.buildParser(grammar, {output: 'source', optimize: 'size'});
fs.unlinkSync('src/parser.js');
fs.writeFileSync('src/parser.js',"module.exports = "+parser);
}
});
});
gulp.task('frontend', function() {
gulp.src("")
.pipe(electron({
src: './frontend',
packageJson: packageJson,
release: './release',
cache: './cache',
version: 'v0.30.4',
packaging: true,
platforms: ['win32-ia32', 'darwin-x64'],
platformResources: {
darwin: {
CFBundleDisplayName: packageJson.name,
CFBundleIdentifier: packageJson.name,
CFBundleName: packageJson.name,
CFBundleVersion: packageJson.version,
icon: './frontend/icons/rdfstore.icns'
},
win: {
"version-string": packageJson.version,
"file-version": packageJson.version,
"product-version": packageJson.version,
"icon": './frontend/icons/rdfstore.ico'
}
}
}))
.pipe(gulp.dest(""));
});
gulp.task('default', ['parseGrammar', 'specs']);
gulp.task('browser', ['parseGrammar','clean-dist','browserify','minimize']);