mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix all code style issues
This commit is contained in:
parent
f04d415b0a
commit
df8085bee0
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require('fs'),
|
||||
chalk = require('chalk'),
|
||||
error = chalk.bold.red,
|
||||
cli = require('../lib/cli.js'),
|
||||
lib = require('../lib')
|
||||
// var fs = require('fs')
|
||||
var chalk = require('chalk')
|
||||
var error = chalk.bold.red
|
||||
var cli = require('../lib/cli.js')
|
||||
var lib = require('../lib')
|
||||
|
||||
cli.parse(process.argv.slice(2), function (err, message, options) {
|
||||
if (err) {
|
||||
|
@ -1,19 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
var Stream = require('stream')
|
||||
var Path = require('path')
|
||||
// var Path = require('path')
|
||||
|
||||
function gulpRename (obj) {
|
||||
var stream = new Stream.Transform({objectMode: true})
|
||||
|
||||
function parsePath (path) {
|
||||
var extname = Path.extname(path)
|
||||
return {
|
||||
dirname: Path.dirname(path),
|
||||
basename: Path.basename(path, extname),
|
||||
extname: extname
|
||||
}
|
||||
}
|
||||
// function parsePath (path) {
|
||||
// var extname = Path.extname(path)
|
||||
// return {
|
||||
// dirname: Path.dirname(path),
|
||||
// basename: Path.basename(path, extname),
|
||||
// extname: extname
|
||||
// }
|
||||
// }
|
||||
|
||||
stream._transform = function (file, unused, callback) {
|
||||
console.log('a file')
|
||||
|
@ -4,6 +4,10 @@
|
||||
var gulp = require('gulp')
|
||||
var shell = require('gulp-shell')
|
||||
var liveServer = require('live-server')
|
||||
var rename = require('gulp-rename')
|
||||
var uglify = require('gulp-uglify')
|
||||
var browserify = require('gulp-browserify')
|
||||
var extReplace = require('gulp-ext-replace')
|
||||
|
||||
var params = {
|
||||
port: 8080, // Set the server port. Defaults to 8080.
|
||||
|
@ -1,12 +1,12 @@
|
||||
var gulp = require('gulp')
|
||||
var browserify = require('gulp-browserify')
|
||||
var shell = require('gulp-shell')
|
||||
// var shell = require('gulp-shell')
|
||||
|
||||
var concat = require('gulp-concat')
|
||||
var uglify = require('gulp-uglify')
|
||||
var extReplace = require('gulp-ext-replace')
|
||||
var rename = require('gulp-rename')
|
||||
var istanbul = require('gulp-istanbul')
|
||||
// var istanbul = require('gulp-istanbul')
|
||||
var insert = require('gulp-insert')
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ gulp.task('fullDist', ['slimDist'], function () {
|
||||
// Basic usage
|
||||
gulp.task('mermaid.slim', function () {
|
||||
// Single entry point to browserify
|
||||
var EXTERNALS = ['d3']
|
||||
// var EXTERNALS = ['d3']
|
||||
|
||||
return gulp.src('src/mermaid.js')
|
||||
.pipe(browserify({
|
||||
|
@ -1,8 +1,8 @@
|
||||
var gulp = require('gulp')
|
||||
var mdvars = require('gulp-mdvars')
|
||||
// var mdvars = require('gulp-mdvars')
|
||||
var vartree = require('gulp-vartree')
|
||||
var gmarked = require('gulp-marked')
|
||||
var marked = require('marked')
|
||||
// var marked = require('marked')
|
||||
var concat = require('gulp-concat')
|
||||
var frontMatter = require('gulp-front-matter')
|
||||
var hogan = require('hogan.js')
|
||||
@ -70,7 +70,8 @@ gulp.task('vartree', ['dox', 'copyContent', 'copySite'], function () {
|
||||
// Run each file through a template
|
||||
.pipe(es.map(function (file, cb) {
|
||||
// console.log('file:',fileList);
|
||||
file.contents = new Buffer(template.render(file))
|
||||
// file.contents = new Buffer(template.render(file))
|
||||
file.contents = Buffer.from(template.render(file))
|
||||
|
||||
cb(null, file)
|
||||
}))
|
||||
@ -82,9 +83,9 @@ gulp.task('vartree', ['dox', 'copyContent', 'copySite'], function () {
|
||||
|
||||
var dox = require('gulp-dox')
|
||||
|
||||
var doxJson2Md = require('../plugins/doxJson2Md')
|
||||
// var doxJson2Md = require('../plugins/doxJson2Md')
|
||||
var map = require('map-stream')
|
||||
var ext_replace = require('gulp-ext-replace')
|
||||
var extReplace = require('gulp-ext-replace')
|
||||
|
||||
gulp.task('dox', function () {
|
||||
// return gulp.src(['src/**/*.js','!src/**/parser/*.js','!src/**/*.spec.js'])
|
||||
@ -102,10 +103,11 @@ gulp.task('dox', function () {
|
||||
// console.log(json[i].description.full);
|
||||
str = str + json[i].description.full + '\n'
|
||||
}
|
||||
file.contents = new Buffer(str)
|
||||
// file.contents = new Buffer(str)
|
||||
file.contents = Buffer.from(str)
|
||||
done(null, file)
|
||||
}))
|
||||
.pipe(ext_replace('.md'))
|
||||
.pipe(extReplace('.md'))
|
||||
.pipe(gulp.dest('./build/content'))
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
var gulp = require('gulp')
|
||||
var bump = require('gulp-bump')
|
||||
var tagVersion = require('gulp-tag-version')
|
||||
|
||||
gulp.task('bump', function () {
|
||||
gulp.src('./bw.json')
|
||||
@ -10,7 +11,7 @@ gulp.task('bump', function () {
|
||||
// Assuming there's "version: 1.2.3" in package.json,
|
||||
// tag the last commit as "v1.2.3"//
|
||||
gulp.task('tag', function () {
|
||||
return gulp.src(['./package.json']).pipe(tag_version())
|
||||
return gulp.src(['./package.json']).pipe(tagVersion())
|
||||
})
|
||||
|
||||
/**
|
||||
|
@ -1,16 +1,16 @@
|
||||
var gulp = require('gulp')
|
||||
var jasmine = require('gulp-jasmine')
|
||||
var gulp = require('gulp')
|
||||
var browserify = require('gulp-browserify')
|
||||
// var gulp = require('gulp')
|
||||
// var browserify = require('gulp-browserify')
|
||||
var shell = require('gulp-shell')
|
||||
var jison = require('gulp-jison')
|
||||
// var jison = require('gulp-jison')
|
||||
|
||||
var concat = require('gulp-concat')
|
||||
var uglify = require('gulp-uglify')
|
||||
var extReplace = require('gulp-ext-replace')
|
||||
var rename = require('gulp-rename')
|
||||
// var concat = require('gulp-concat')
|
||||
// var uglify = require('gulp-uglify')
|
||||
// var extReplace = require('gulp-ext-replace')
|
||||
// var rename = require('gulp-rename')
|
||||
var istanbul = require('gulp-istanbul')
|
||||
var insert = require('gulp-insert')
|
||||
// var insert = require('gulp-insert')
|
||||
var jshint = require('gulp-jshint')
|
||||
var stylish = require('jshint-stylish')
|
||||
|
||||
@ -20,49 +20,49 @@ var bower = require('gulp-bower')
|
||||
// Using gulp-jshint and jshint-stylish
|
||||
gulp.task('lint', function () {
|
||||
return gulp.src(['./src/**/*.js', '!**/parser/*.js'])
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter(stylish))
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter(stylish))
|
||||
})
|
||||
|
||||
gulp.task('test', ['coverage', 'tape', 'jasmine', 'qunit'])
|
||||
|
||||
gulp.task('jasmine', ['jison', 'lint'], function () {
|
||||
return gulp.src(['src/**/*.spec.js'])
|
||||
.pipe(jasmine({includeStackTrace: true}))
|
||||
.pipe(jasmine({ includeStackTrace: true }))
|
||||
})
|
||||
|
||||
gulp.task('jas', function () {
|
||||
return gulp.src(['src/**/*.spec.js'])
|
||||
.pipe(jasmine({includeStackTrace: true}))
|
||||
.pipe(jasmine({ includeStackTrace: true }))
|
||||
})
|
||||
|
||||
gulp.task('tape', shell.task(['node_modules/.bin/tape ./test/cli_test-*.js']))
|
||||
|
||||
gulp.task('coverage', function (cb) {
|
||||
gulp.src(['src/**/*.js', '!src/**/*.spec.js'])
|
||||
.pipe(istanbul()) // Covering files
|
||||
.on('finish', function () {
|
||||
gulp.src(['src/**/*.spec.js'])
|
||||
.pipe(jasmine())
|
||||
.pipe(istanbul.writeReports()) // Creating the reports after tests runned
|
||||
.on('end', cb)
|
||||
})
|
||||
.pipe(istanbul()) // Covering files
|
||||
.on('finish', function () {
|
||||
gulp.src(['src/**/*.spec.js'])
|
||||
.pipe(jasmine())
|
||||
.pipe(istanbul.writeReports()) // Creating the reports after tests runned
|
||||
.on('end', cb)
|
||||
})
|
||||
})
|
||||
|
||||
gulp.task('qunit', ['usageTestsBower'], function () {
|
||||
return gulp.src('test/usageTests/requireTest.html')
|
||||
.pipe(qunit())
|
||||
.pipe(qunit())
|
||||
})
|
||||
|
||||
gulp.task('usageTestsBower', function () {
|
||||
return bower({cwd: 'test/usageTests'})
|
||||
.pipe(gulp.dest('test/usageTests/bower_components'))
|
||||
return bower({ cwd: 'test/usageTests' })
|
||||
.pipe(gulp.dest('test/usageTests/bower_components'))
|
||||
})
|
||||
|
||||
var jasmineBrowser = require('gulp-jasmine-browser')
|
||||
|
||||
gulp.task('jasmine2', function () {
|
||||
return gulp.src(['src/**/*.js'])
|
||||
.pipe(jasmineBrowser.specRunner({console: true}))
|
||||
.pipe(jasmineBrowser.headless())
|
||||
.pipe(jasmineBrowser.specRunner({ console: true }))
|
||||
.pipe(jasmineBrowser.headless())
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user