From cb056d996fa9974f7600e3e4567af39b0a3928b6 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Tue, 27 Oct 2015 03:42:38 -0400 Subject: [PATCH] Remove gruntfile, everything moved to gulp --- Gruntfile.js | 248 --------------------------------------------------- 1 file changed, 248 deletions(-) delete mode 100644 Gruntfile.js diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 0394823ef..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,248 +0,0 @@ -module.exports = function (grunt) { - - /** LOAD Tasks **/ - grunt.loadNpmTasks('grunt-replace'); - grunt.loadNpmTasks('grunt-bower-cli'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-requirejs'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-npm2bower-sync'); - - grunt.loadNpmTasks('grunt-docco'); - - // Project configuration. - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - - clean: { - dist: ['./dist'] - }, - - sync: { - all: { - options: { - sync: ['author', 'name', 'license', 'main', 'keywords'], - from: 'package.json', - to: 'bower.json' - } - } - }, - - docco: { - source: { - src: ['src/parsley.js', 'src/parsley/*.js', 'src/extra/plugin/remote.js'], - options: { - output: 'doc/annotated-source/', - layout: 'parallel' - } - } - }, - - replace: { - annotated: { - options: { - patterns: [ - { - match: /
/ig, - replacement: function () { - return '
<<< back to documentation'; - } - }, - { - match: /<\/body>/ig, - replacement: function () { - return ''; - } - }, - { - match: 'version', - replacement: '<%= pkg.version %>' - }, - ] - }, - files: [ - { - expand: true, - flatten: true, - src: 'doc/annotated-source/*.html', - dest: 'doc/annotated-source/' - } - ] - }, - dist: { - options: { - patterns: [ - { - match: 'name', - replacement: '<%= pkg.name.charAt(0).toUpperCase() + pkg.name.slice(1) %>' - }, - { - match: 'version', - replacement: '<%= pkg.version %>' - }, - { - match: 'author', - replacement: '<%= pkg.author.name %> - <<%= pkg.author.email %>>' - }, - { - match: 'timestamp', - replacement: '<%= grunt.template.today() %>' - }, - { - match: 'license', - replacement: '<%= pkg.license %>' - }, - // Remove useless define statements that r.js add after concatenation, and not matched by convert callback - { - match: /define\("((?!\);)[\s\S])*\);/ig, - replacement: function () { - return ''; - } - }, - // Remove useless double line breaks - { - match: /\n\n/ig, - replacement: function () { - return "\n"; - } - } - ] - }, - files: [ - { - expand: true, - flatten: true, - src: 'dist/parsley.js', - dest: 'dist/' - }, - { - expand: true, - flatten: true, - src: 'dist/i18n/*.js', - dest: 'dist/i18n/' - } - ] - } - }, - - requirejs: { - compile: { - options: { - // name: "./bower_components/almond/almond", - name: "parsley", - mainConfigFile: "./src/config.js", - - wrap: { - startFile: "src/wrap/prepend.js", - endFile: "src/wrap/append.js" - }, - - optimize: 'none', - out: "dist/parsley.js", - findNestedDependencies: true, - - // Avoid breaking semicolons inserted by r.js - skipSemiColonInsertion: true, - onBuildWrite: convert - } - } - }, - - uglify: { - options: { - report: 'gzip', - preserveComments: function (pos, node) { - return new RegExp('^!').test(node.value) && RegExp('parsley', 'i').test(node.value); - } - }, - min: { - files: { - 'dist/parsley.min.js': 'dist/parsley.js' - } - }, - remote: { - files: { - 'dist/parsley.remote.min.js': 'dist/parsley.remote.js' - } - } - }, - - watch: { - dev: { - files: ['src/parsley.js', 'src/parsley.css', 'src/wrap/*.js', 'src/parsley/*.js'], - tasks: ['requirejs', 'replace:dist'] - } - }, - - concat: { - remote: { - src: ['dist/parsley.js', 'src/extra/plugin/remote.js'], - dest: 'dist/parsley.remote.js' - } - }, - - copy: { - i18n: { - expand: true, - cwd: "src/i18n/", - src: "*.js", - dest: "dist/i18n/", - options: { - process: function (content) { - // wrap the i18n source files in the UMD wrapper - // for environments that load jQuery as a UMD dependency - return [ - grunt.file.read("src/wrap/prepend.js"), - content, - '}));' - ].join('\n'); - } - } - } - } - }); - - /** Tasks here **/ - grunt.registerTask('default', []); - grunt.registerTask('configure', ['bower:install']); - grunt.registerTask('build-std', ['requirejs', 'copy:i18n', 'replace:dist', 'uglify:min']); - grunt.registerTask('build-remote', ['concat:remote', 'uglify:remote']); - grunt.registerTask('build-annotated-source', ['docco:source', 'replace:annotated']); - grunt.registerTask('build', ['configure', 'clean:dist', 'build-std', 'build-remote', 'build-annotated-source', 'sync']); - grunt.registerTask('build-all', ['build']); -}; - -var rdefineEnd = /\}\);[^}\w]*$/; - -function convert(name, path, contents) { - // Update original validatorjs for non-AMD implementation - if (/(dist\/validator.js)/.test(path)) { - - // Makes sure the self-executing wrapper function stores a variable - contents = contents.replace("(","var Validator = ("); - - // Makes sure the self-executing wrapper function returns an object - var lastClosingBraceIndex = contents.lastIndexOf("}"); - contents = contents.substring(0, lastClosingBraceIndex) - + "\n\n return exports;\n}" - + contents.substring(lastClosingBraceIndex + 1); - - return contents; - } - - // Ignore returns - contents = contents - .replace(/\s*return\s+[^\}]+(\}\);[^\w\}]*)$/, "$1") - // Multiple exports - .replace(/\s*exports\.\w+\s*=\s*\w+;/g, ""); - - // Remove define wrappers, closure ends, and empty declarations - contents = contents - .replace(/define\([^{]*?{/, "") - .replace(rdefineEnd, "\n"); - - return contents; -}