2014-11-03 00:02:29 +01:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var jison = require('gulp-jison');
|
2014-11-13 19:51:05 +01:00
|
|
|
var shell = require('gulp-shell');
|
|
|
|
var concat = require('gulp-concat');
|
|
|
|
var uglify = require('gulp-uglify');
|
|
|
|
var extReplace = require('gulp-ext-replace');
|
2014-11-21 08:03:43 +01:00
|
|
|
var rename = require('gulp-rename');
|
|
|
|
|
2014-11-03 00:02:29 +01:00
|
|
|
|
2014-11-11 08:12:03 +01:00
|
|
|
gulp.task('jison2', function() {
|
2014-11-03 00:02:29 +01:00
|
|
|
return gulp.src('./src/*.jison')
|
|
|
|
.pipe(jison({ moduleType: 'amd' }))
|
|
|
|
.pipe(gulp.dest('./src/'));
|
|
|
|
});
|
|
|
|
|
2014-11-11 08:12:03 +01:00
|
|
|
gulp.task('jison', shell.task([
|
2014-11-19 19:29:55 +01:00
|
|
|
'jison src/parser/flow.jison -o src/parser/flow.js'
|
|
|
|
//'source scripts/compileJison.sh'
|
|
|
|
// 'jison src/parser/flow.jison -o src/parser/flow.js',
|
2014-11-12 07:35:44 +01:00
|
|
|
]))
|
|
|
|
|
2014-11-20 20:46:51 +01:00
|
|
|
gulp.task('jisonSd', shell.task([
|
|
|
|
//'jison src/parser/flow.jison -o src/parser/flow.js',
|
|
|
|
'jison src/parser/sequence.jison -o src/parser/sequence.js'
|
|
|
|
//'source scripts/compileFlow.sh'
|
|
|
|
]));
|
2014-11-13 19:51:05 +01:00
|
|
|
|
2014-11-21 08:03:43 +01:00
|
|
|
gulp.task('dist', ['slimDist', 'fullDist']);
|
|
|
|
|
|
|
|
var jasmine = require('gulp-jasmine');
|
|
|
|
|
|
|
|
gulp.task('jasmine',['jison'], function () {
|
|
|
|
return gulp.src('src/parser/flow.spec.js')
|
|
|
|
.pipe(jasmine());
|
|
|
|
});
|
|
|
|
|
|
|
|
var browserify = require('gulp-browserify');
|
|
|
|
|
|
|
|
// Basic usage
|
|
|
|
gulp.task('slimDist', function() {
|
|
|
|
// Single entry point to browserify
|
|
|
|
return gulp.src('src/main.js')
|
|
|
|
.pipe(browserify())
|
|
|
|
.pipe(rename('mermaid.slim.js'))
|
2014-11-13 19:51:05 +01:00
|
|
|
.pipe(gulp.dest('./dist/'))
|
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(extReplace('.min.js'))
|
|
|
|
.pipe(gulp.dest('./dist/'));
|
|
|
|
});
|
|
|
|
|
2014-11-21 08:03:43 +01:00
|
|
|
// Basic usage
|
|
|
|
gulp.task('fullDist', ['slimDist'], function() {
|
|
|
|
// Single entry point to browserify
|
|
|
|
gulp.src(['node_modules/d3/d3.min.js','node_modules/dagre-d3/dist/dagre-d3.min.js','dist/mermaid.slim.js'])
|
2014-11-13 19:51:05 +01:00
|
|
|
.pipe(concat('mermaid.full.js'))
|
2014-11-21 08:03:43 +01:00
|
|
|
.pipe(gulp.dest('./dist/'));
|
|
|
|
return gulp.src(['node_modules/d3/d3.min.js','node_modules/dagre-d3/dist/dagre-d3.min.js','dist/mermaid.slim.min.js'])
|
2014-11-13 19:51:05 +01:00
|
|
|
.pipe(concat('mermaid.full.min.js'))
|
2014-11-21 08:03:43 +01:00
|
|
|
.pipe(gulp.dest('./dist/'));
|
2014-11-13 19:51:05 +01:00
|
|
|
});
|