From d662e8110b1df0105b350f8820e162e723e03a81 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 25 Feb 2017 20:48:51 +0000 Subject: [PATCH] Remove Grunt --- CHANGELOG.md | 6 ++ Gruntfile.js | 166 --------------------------------------------------- bower.json | 1 - package.json | 22 +------ 4 files changed, 9 insertions(+), 186 deletions(-) delete mode 100644 Gruntfile.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 7045edc6..32598a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Strophe.js Change Log +## Version 1.2.13 - Unreleased + +* Use almond to create the build. This means that the build itself is an AMD + module and can be loaded via `require`. +* Remove Grunt as a build tool. + ## Version 1.2.12 - 2017-01-15 * Reduce the priority of the SASL-EXTERNAL auth mechanism. OpenFire 4.1.1 diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index d82ebad3..00000000 --- a/Gruntfile.js +++ /dev/null @@ -1,166 +0,0 @@ -// Check for the name of the naturaldocs binary -var fs = require('fs'); -if (fs.existsSync("/usr/bin/naturaldocs")) { - naturaldocs = "/usr/bin/naturaldocs"; -} else if (fs.existsSync("/usr/lib/bin/natural_docs")) { - naturaldocs = "/usr/lib/bin/natural_docs"; -} else { - naturaldocs = "naturaldocs"; -} - -module.exports = function(grunt){ - var pkg = grunt.file.readJSON('package.json'); - - grunt.initConfig({ - pkg: pkg, - - clean: { - "prepare-doc": ["<%= natural_docs.docs.inputs[0] %>", "<%= natural_docs.docs.project %>"], - "doc": ["<%= natural_docs.docs.output %>"], - "prepare-release": ["strophejs-<%= pkg.version %>"], - "release": ["strophejs-<%= pkg.version %>.zip", "strophejs-<%= pkg.version %>.tar.gz"], - "js": ["<%= concat.dist.dest %>", "strophe.min.js", "strophe-no-polyfills.js"] - }, - - connect: { - server: { - options: { - port: 8000, - base: '.' - } - } - }, - - concat: { - dist: { - src: ['src/wrap_header.js', 'src/base64.js', 'src/sha1.js', 'src/md5.js', 'src/utils.js', 'src/polyfills.js', 'src/core.js', 'src/bosh.js', 'src/websocket.js', 'src/wrapper.js', 'src/wrap_footer.js'], - dest: '<%= pkg.name %>' - }, - light: { - // This rule is meant to build a lighter version without Base64 nor Polyfills, - // by explicitly running `make strophe-no-polyfills.js` -- The generated file will - // work in all major browsers, including MSIE starting with version 10 - src: ['src/wrap_header.js', 'src/sha1.js', 'src/md5.js', 'src/utils.js', 'src/core.js', 'src/bosh.js', 'src/websocket.js', 'src/wrapper.js', 'src/wrap_footer.js'], - dest: 'strophe-no-polyfills.js', - options: { - process: function(src){ - return src.replace('@VERSION@', pkg.version) - .replace(/Base64\.encode/g, 'btoa') - .replace(/Base64\.decode/g, 'atob') - .replace(/, (?:root\.)?Base64/g, '') - .replace(/ +'strophe-base64',\r?\n/, '') - .replace(/,\s+"strophe-polyfill"/, '') - .replace(/ +(?:window\.)?Base64\s*[:=].*?Base64[,;]\r?\n/g, ''); - } - } - }, - options: { - process: function(src){ - return src.replace('@VERSION@', pkg.version); - } - } - }, - - copy: { - "prepare-release": { - files:[ - { - expand: true, - src:['<%= concat.dist.dest %>', 'strophe.min.js', 'LICENSE.txt', 'README.txt', - 'contrib/**', 'examples/**', 'plugins/**', 'tests/**', 'doc/**'], - dest:"strophejs-<%= pkg.version %>" - } - ] - }, - "prepare-doc": { - files:[ - { - src:['<%= concat.dist.dest %>'], - dest:"<%= natural_docs.docs.inputs[0] %>" - } - ] - } - }, - - jshint: { - files: ['Gruntfile.js', 'src/*.js'], - }, - - shell: { - tar: { - command: 'tar czf strophejs-<%= pkg.version %>.tar.gz strophejs-<%= pkg.version %>', - options: { failOnError: true } - }, - zip: { - command: 'zip -qr strophejs-<%= pkg.version %>.zip strophejs-<%= pkg.version %>', - options: { failOnError: true } - } - }, - - uglify: { - options: { - banner: '/*! <%= pkg.name %> v<%= pkg.version %> - built on <%= grunt.template.today("dd-mm-yyyy") %> */\n' - }, - dist: { - files: { 'strophe.min.js': ['<%= concat.dist.dest %>'] } - } - }, - - watch: { - files: ['<%= jshint.files %>'], - tasks: ['concat', 'uglify'] - }, - - natural_docs: { - docs: { - bin: naturaldocs, - inputs: [ "doc-tmp/" ], - project: "ndproj", - output: "doc" - }, - }, - - mkdir: { - "prepare-doc": { - options: { - create: ["<%= natural_docs.docs.project %>", "<%= natural_docs.docs.output %>"] - } - }, - }, - }); - - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks("grunt-contrib-uglify"); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks("grunt-contrib-concat"); - grunt.loadNpmTasks("grunt-contrib-clean"); - grunt.loadNpmTasks('grunt-shell'); - grunt.loadNpmTasks('grunt-natural-docs'); - grunt.loadNpmTasks('grunt-mkdir'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - - grunt.registerTask("default", ["jshint", "min"]); - grunt.registerTask("min", ["concat:dist", "uglify"]); - grunt.registerTask("prepare-release", ["copy:prepare-release"]); - grunt.registerTask("doc", ["concat:dist", "copy:prepare-doc", "mkdir:prepare-doc", "natural_docs"]); - grunt.registerTask("release", ["default", "doc", "copy:prepare-release", "shell:tar", "shell:zip"]); - grunt.registerTask("all", ["release", "clean"]); - - grunt.registerTask('almond', 'Create an almond build with r.js', function () { - var done = this.async(); - require('child_process').exec( - './node_modules/requirejs/bin/r.js -o build.js optimize=none out=strophe.almond.js', - function (err, stdout, stderr) { - if (err) { - grunt.log.write('build failed with error code '+err.code); - grunt.log.write(stderr); - } - grunt.log.write(stdout); - done(); - } - ); - grunt.task.run('uglify'); - }); -}; diff --git a/bower.json b/bower.json index 91d51ea8..3325b5c4 100644 --- a/bower.json +++ b/bower.json @@ -23,7 +23,6 @@ ".*", "release_checklist.txt", "Makefile", - "Gruntfile.js", "contrib", "examples", "tests" diff --git a/package.json b/package.json index 0092ed1f..3bd1c7de 100644 --- a/package.json +++ b/package.json @@ -38,11 +38,9 @@ "main": "strophe.js", "browser": "strophe.js", "scripts": { - "lint": "grunt", - "build": "grunt", - "clean": "grunt clean", - "doc": "grunt doc", - "release": "grunt release" + "lint": "make jshint", + "clean": "make clean", + "doc": "make doc" }, "engines": { "browser": "*" @@ -53,20 +51,6 @@ "devDependencies": { "jshint": "^2.9.4", "bower": "latest", - "grunt": "~1.0.1", - "grunt-cli": "~1.2.0", - "grunt-contrib-clean": "~1.0.0", - "grunt-contrib-concat": "~1.0.1", - "grunt-contrib-connect": "^1.0.2", - "grunt-contrib-copy": "~1.0.0", - "grunt-contrib-jshint": "~1.1.0", - "grunt-contrib-qunit": "^1.2.0", - "grunt-contrib-requirejs": "^1.0.0", - "grunt-contrib-uglify": "~2.0.0", - "grunt-contrib-watch": "~1.0.0", - "grunt-mkdir": "~1.0.0", - "grunt-natural-docs": "~1.0.1", - "grunt-shell": "~2.1.0", "http-server": "^0.9.0", "phantomjs": "~1.9.7-1", "qunit-phantomjs-runner": "^2.1.0",