Removed semi colons

This commit is contained in:
jos 2016-09-30 16:51:43 +02:00
parent b5ce5cb2ae
commit ae90077ed6
1 changed files with 38 additions and 38 deletions

View File

@ -1,38 +1,38 @@
var fs = require('fs');
var gulp = require('gulp');
var gutil = require('gulp-util');
var shell = require('gulp-shell');
var mkdirp = require('mkdirp');
var webpack = require('webpack');
var fs = require('fs')
var gulp = require('gulp')
var gutil = require('gulp-util')
var shell = require('gulp-shell')
var mkdirp = require('mkdirp')
var webpack = require('webpack')
var NAME = 'jsoneditor';
var NAME_MINIMALIST = 'jsoneditor-minimalist';
var ENTRY = './src/index.js';
var HEADER = './src/header.js';
var DIST = './dist';
var NAME = 'jsoneditor'
var NAME_MINIMALIST = 'jsoneditor-minimalist'
var ENTRY = './src/index.js'
var HEADER = './src/header.js'
var DIST = './dist'
var EMPTY = __dirname + '/src/utils/empty.js'
// generate banner with today's date and correct version
function createBanner() {
var today = gutil.date(new Date(), 'yyyy-mm-dd'); // today, formatted as yyyy-mm-dd
var version = require('./package.json').version; // math.js version
var today = gutil.date(new Date(), 'yyyy-mm-dd') // today, formatted as yyyy-mm-dd
var version = require('./package.json').version // math.js version
return String(fs.readFileSync(HEADER))
.replace('@@date', today)
.replace('@@version', version);
.replace('@@version', version)
}
var bannerPlugin = new webpack.BannerPlugin(createBanner(), {
entryOnly: true,
raw: true
});
})
var loaders = [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.less$/, loaders: '!style!css!less!' },
{ test: /\.svg$/, loader: 'svg-url-loader' }
];
]
// create a single instance of the compiler to allow caching
var compiler = webpack({
@ -54,7 +54,7 @@ var compiler = webpack({
loaders: loaders
},
cache: true
});
})
// create a single instance of the compiler to allow caching
var compilerMinimalist = webpack({
@ -78,59 +78,59 @@ var compilerMinimalist = webpack({
loaders: loaders
},
cache: true
});
})
function handleCompilerCallback (err, stats) {
if (err) {
gutil.log(err.toString());
gutil.log(err.toString())
}
if (stats && stats.compilation && stats.compilation.errors) {
// output soft errors
stats.compilation.errors.forEach(function (err) {
gutil.log(err.toString());
});
gutil.log(err.toString())
})
}
}
// make dist folder
gulp.task('mkdir', function () {
mkdirp.sync(DIST);
});
mkdirp.sync(DIST)
})
// bundle javascript
gulp.task('bundle', ['mkdir'], function (done) {
// update the banner contents (has a date in it which should stay up to date)
bannerPlugin.banner = createBanner();
bannerPlugin.banner = createBanner()
compiler.run(function (err, stats) {
handleCompilerCallback(err, stats)
gutil.log('bundled ' + NAME + '.js');
gutil.log('bundled ' + NAME + '.js')
done();
});
});
done()
})
})
// bundle minimalist version of javascript
gulp.task('bundle-minimalist', ['mkdir'], function (done) {
// update the banner contents (has a date in it which should stay up to date)
bannerPlugin.banner = createBanner();
bannerPlugin.banner = createBanner()
compilerMinimalist.run(function (err, stats) {
handleCompilerCallback(err, stats)
gutil.log('bundled ' + NAME_MINIMALIST + '.js');
gutil.log('bundled ' + NAME_MINIMALIST + '.js')
done();
});
});
done()
})
})
// TODO: zip file using archiver
var pkg = 'jsoneditor-' + require('./package.json').version + '.zip';
var pkg = 'jsoneditor-' + require('./package.json').version + '.zip'
gulp.task('zip', shell.task([
'zip ' + pkg + ' ' + 'README.md LICENSE HISTORY.md index.html src dist docs examples -r '
]));
]))
// The watch task (to automatically rebuild when the source code changes)
// Does only generate jsoneditor.js and jsoneditor.css, and copy the image
@ -138,8 +138,8 @@ gulp.task('zip', shell.task([
gulp.task('watch', ['bundle'], function () {
// TODO: don't minify when in watch mode
gulp.watch(['src/**/*'], ['bundle']);
});
gulp.watch(['src/**/*'], ['bundle'])
})
// The default task (called when you run `gulp`)
gulp.task('default', [ 'bundle', 'bundle-minimalist' ]);
gulp.task('default', [ 'bundle', 'bundle-minimalist' ])