diff options
author | Saivan <savian@me.com> | 2018-02-27 00:48:11 +1100 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-02-27 00:48:11 +1100 |
commit | bec7881979149425a9c1b894f4741413b28c8141 (patch) | |
tree | 3a496f834520925686af3a8059766b61b65be390 /gulpfile.js | |
parent | ec0a8aee0e21a93b22c255dae6768a9ff7b09e73 (diff) | |
download | svg.js-bec7881979149425a9c1b894f4741413b28c8141.tar.gz svg.js-bec7881979149425a9c1b894f4741413b28c8141.zip |
The first half of the library complies with Standard linting
This commit reformats the code so that it complies with the
standard linting style. Its currently a work in progress, but
it is meant to pave the way for linting in the build process
Diffstat (limited to 'gulpfile.js')
-rw-r--r-- | gulpfile.js | 174 |
1 files changed, 88 insertions, 86 deletions
diff --git a/gulpfile.js b/gulpfile.js index e7618a0..6d07261 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,91 +1,89 @@ -var del = require('del')
- , gulp = require('gulp')
- , chmod = require('gulp-chmod')
- , concat = require('gulp-concat')
- , header = require('gulp-header')
- , rename = require('gulp-rename')
- , size = require('gulp-size')
- , trim = require('gulp-trimlines')
- , uglify = require('gulp-uglify')
- , wrapUmd = require('gulp-wrap')
- , request = require('request')
- , fs = require('fs')
- , pkg = require('./package.json')
+var del = require('del'),
+ gulp = require('gulp'),
+ chmod = require('gulp-chmod'),
+ concat = require('gulp-concat'),
+ header = require('gulp-header'),
+ rename = require('gulp-rename'),
+ size = require('gulp-size'),
+ trim = require('gulp-trimlines'),
+ uglify = require('gulp-uglify'),
+ wrapUmd = require('gulp-wrap'),
+ pkg = require('./package.json'),
+ standard = require('gulp-standard')
-
-var headerLong = ['/*!'
- , '* <%= pkg.name %> - <%= pkg.description %>'
- , '* @version <%= pkg.version %>'
- , '* <%= pkg.homepage %>'
- , '*'
- , '* @copyright <%= pkg.author %>'
- , '* @license <%= pkg.license %>'
- , '*'
- , '* BUILT: <%= pkg.buildDate %>'
- , '*/;'
- , ''].join('\n')
+var headerLong = ['/*!',
+ '* <%= pkg.name %> - <%= pkg.description %>',
+ '* @version <%= pkg.version %>',
+ '* <%= pkg.homepage %>',
+ '*',
+ '* @copyright <%= pkg.author %>',
+ '* @license <%= pkg.license %>',
+ '*',
+ '* BUILT: <%= pkg.buildDate %>',
+ '*/;',
+ ''].join('\n')
var headerShort = '/*! <%= pkg.name %> v<%= pkg.version %> <%= pkg.license %>*/;'
// all files in the right order (currently we don't use any dependency management system)
var parts = [
- 'src/svg.js'
-, 'src/regex.js'
-, 'src/utilities.js'
-, 'src/default.js'
-, 'src/color.js'
-, 'src/array.js'
-, 'src/pointarray.js'
-, 'src/patharray.js'
-, 'src/number.js'
-, 'src/HtmlNode.js'
-, 'src/element.js'
-, 'src/fx.js'
-, 'src/matrix.js'
-, 'src/point.js'
-, 'src/attr.js'
-, 'src/transform.js'
-, 'src/css.js'
-, 'src/parent.js'
-, 'src/flatten.js'
-, 'src/container.js'
-, 'src/event.js'
-, 'src/defs.js'
-, 'src/group.js'
-, 'src/arrange.js'
-, 'src/mask.js'
-, 'src/clip.js'
-, 'src/gradient.js'
-, 'src/pattern.js'
-, 'src/doc.js'
-, 'src/shape.js'
-, 'src/bare.js'
-, 'src/symbol.js'
-, 'src/use.js'
-, 'src/rect.js'
-, 'src/ellipse.js'
-, 'src/line.js'
-, 'src/poly.js'
-, 'src/pointed.js'
-, 'src/path.js'
-, 'src/image.js'
-, 'src/text.js'
-, 'src/textpath.js'
-, 'src/nested.js'
-, 'src/hyperlink.js'
-, 'src/marker.js'
-, 'src/sugar.js'
-, 'src/set.js'
-, 'src/data.js'
-, 'src/memory.js'
-, 'src/selector.js'
-, 'src/helpers.js'
-, 'src/polyfill.js'
-, 'src/boxes.js'
-, 'src/parser.js'
+ 'src/svg.js',
+ 'src/regex.js',
+ 'src/utilities.js',
+ 'src/default.js',
+ 'src/color.js',
+ 'src/array.js',
+ 'src/pointarray.js',
+ 'src/patharray.js',
+ 'src/number.js',
+ 'src/HtmlNode.js',
+ 'src/element.js',
+ 'src/fx.js',
+ 'src/matrix.js',
+ 'src/point.js',
+ 'src/attr.js',
+ 'src/transform.js',
+ 'src/css.js',
+ 'src/parent.js',
+ 'src/flatten.js',
+ 'src/container.js',
+ 'src/event.js',
+ 'src/defs.js',
+ 'src/group.js',
+ 'src/arrange.js',
+ 'src/mask.js',
+ 'src/clip.js',
+ 'src/gradient.js',
+ 'src/pattern.js',
+ 'src/doc.js',
+ 'src/shape.js',
+ 'src/bare.js',
+ 'src/symbol.js',
+ 'src/use.js',
+ 'src/rect.js',
+ 'src/ellipse.js',
+ 'src/line.js',
+ 'src/poly.js',
+ 'src/pointed.js',
+ 'src/path.js',
+ 'src/image.js',
+ 'src/text.js',
+ 'src/textpath.js',
+ 'src/nested.js',
+ 'src/hyperlink.js',
+ 'src/marker.js',
+ 'src/sugar.js',
+ 'src/set.js',
+ 'src/data.js',
+ 'src/memory.js',
+ 'src/selector.js',
+ 'src/helpers.js',
+ 'src/polyfill.js',
+ 'src/boxes.js',
+ 'src/parser.js'
]
-gulp.task('clean', function() {
+gulp.task('clean', function () {
return del([ 'dist/*' ])
})
@@ -94,12 +92,17 @@ gulp.task('clean', function() { * wrap the whole thing in a UMD wrapper (@see https://github.com/umdjs/umd)
* add the license information to the header plus the build time stamp‏
*/
-gulp.task('unify', ['clean'], function() {
+gulp.task('unify', ['clean'], function () {
pkg.buildDate = Date()
return gulp.src(parts)
+ // .pipe(standard())
+ // .pipe(standard.reporter('default', {
+ // breakOnError: true,
+ // quiet: true
+ // }))
.pipe(concat('svg.js', { newLine: '\n' }))
// wrap the whole thing in an immediate function call
- .pipe(wrapUmd({ src: 'src/umd.js'}))
+ .pipe(wrapUmd({src: 'src/umd.js'}))
.pipe(header(headerLong, { pkg: pkg }))
.pipe(trim({ leading: false }))
.pipe(chmod(0o644))
@@ -112,10 +115,10 @@ gulp.task('unify', ['clean'], function() { * add the license info
* show the gzipped file size
*/
-gulp.task('minify', ['unify'], function() {
+gulp.task('minify', ['unify'], function () {
return gulp.src('dist/svg.js')
.pipe(uglify())
- .pipe(rename({ suffix:'.min' }))
+ .pipe(rename({ suffix: '.min' }))
.pipe(size({ showFiles: true, title: 'Minified' }))
.pipe(header(headerShort, { pkg: pkg }))
.pipe(chmod(0o644))
@@ -123,5 +126,4 @@ gulp.task('minify', ['unify'], function() { .pipe(size({ showFiles: true, gzip: true, title: 'Gzipped' }))
})
-
-gulp.task('default', ['clean', 'unify', 'minify'])
\ No newline at end of file +gulp.task('default', ['clean', 'unify', 'minify'])
|