forked from hammerjs/hammer.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(coffee to js): converts Gruntfile.coffee to Gruntfile.js for be…
…tter consistency and Bumps up a few old package versions to newer ones
- Loading branch information
1 parent
697d331
commit a6a59b3
Showing
3 changed files
with
118 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
var babel = require('rollup-plugin-babel'); | ||
|
||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
usebanner: { | ||
taskName: { | ||
options: { | ||
position: 'top', | ||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n * <%= pkg.homepage %>\n *\n * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;\n * Licensed under the <%= pkg.license %> license */', | ||
linebreak: true | ||
}, | ||
files: { | ||
src: ['./hammer.js', './hammer.min.js'] | ||
} | ||
} | ||
}, | ||
rollup: { | ||
options: { | ||
format: 'es6', | ||
plugins: [ | ||
babel({ | ||
exclude: 'node_modules/**' | ||
}) | ||
], | ||
intro: " (function(window, document, exportName, undefined) { \n'use strict';", | ||
outro: "})(window, document, 'Hammer');" | ||
}, | ||
files: { | ||
dest: 'hammer.js', | ||
src: 'src/main.js' | ||
} | ||
}, | ||
uglify: { | ||
min: { | ||
options: { | ||
report: 'gzip', | ||
sourceMap: 'hammer.min.map' | ||
}, | ||
files: { | ||
'hammer.min.js': ['hammer.js'] | ||
} | ||
} | ||
}, | ||
'string-replace': { | ||
version: { | ||
files: { | ||
'hammer.js': 'hammer.js' | ||
}, | ||
options: { | ||
replacements: [ | ||
{ | ||
pattern: '{{PKG_VERSION}}', | ||
replacement: '<%= pkg.version %>' | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
jshint: { | ||
options: { | ||
jshintrc: true | ||
}, | ||
build: { | ||
src: ['hammer.js'] | ||
} | ||
}, | ||
jscs: { | ||
src: ['src/**/*.js'], | ||
options: { | ||
config: "./.jscsrc", | ||
force: true | ||
} | ||
}, | ||
watch: { | ||
scripts: { | ||
files: ['src/**/*.js'], | ||
tasks: ['rollup', 'string-replace', 'uglify', 'jshint', 'jscs'], | ||
options: { | ||
interrupt: true | ||
} | ||
} | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
hostname: "0.0.0.0", | ||
port: 8000 | ||
} | ||
} | ||
}, | ||
qunit: { | ||
all: ['tests/unit/index.html'] | ||
} | ||
}); | ||
grunt.loadNpmTasks('grunt-rollup'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-qunit'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-string-replace'); | ||
grunt.loadNpmTasks('grunt-banner'); | ||
grunt.loadNpmTasks('grunt-jscs'); | ||
grunt.registerTask('default', ['connect', 'watch']); | ||
grunt.registerTask('default-test', ['connect', 'uglify:test', 'watch']); | ||
grunt.registerTask('build', ['rollup', 'string-replace', 'uglify:min', 'usebanner', 'test']); | ||
grunt.registerTask('test', ['jshint', 'jscs', 'qunit']); | ||
grunt.registerTask('test-travis', ['build']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters