From b7af1ada6c07e72e58f9fbf650c05f1bf07cb91f Mon Sep 17 00:00:00 2001 From: Arnold Daniels Date: Fri, 7 Aug 2015 16:41:05 +0200 Subject: [PATCH] Using latest packages for grunt Renamed jscs.json to jscsrc Fixed styling errors in build js files --- Gruntfile.js | 18 ++++++++------ grunt/bs-raw-files-generator.js | 4 ++- grunt/shrinkwrap.js | 1 + js/.jscs.json | 15 ------------ js/.jscsrc | 43 +++++++++++++++++++++++++++++++++ package.json | 41 +++++++++++++++---------------- 6 files changed, 76 insertions(+), 46 deletions(-) delete mode 100644 js/.jscs.json create mode 100644 js/.jscsrc diff --git a/Gruntfile.js b/Gruntfile.js index 81dd4540..29066bfc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -64,7 +64,7 @@ module.exports = function (grunt) { jscs: { options: { - config: 'js/.jscs.json', + config: 'js/.jscsrc' }, grunt: { src: ['Gruntfile.js', 'grunt/*.js'] @@ -256,9 +256,9 @@ module.exports = function (grunt) { pretty: true, data: function () { var filePath = path.join(__dirname, 'less/build/variables.less'); - var fileContent = fs.readFileSync(filePath, {encoding: 'utf8'}); + var fileContent = fs.readFileSync(filePath, { encoding: 'utf8' }); var parser = new BsLessdocParser(fileContent); - return {sections: parser.parseFile()}; + return { sections: parser.parseFile() }; } }, files: { @@ -305,10 +305,12 @@ module.exports = function (grunt) { versionNumber: { src: ['*.js', '*.md', '*.json', '*.yml', 'js/*.js'], overwrite: true, - replacements: [{ - from: grunt.option('oldver'), - to: grunt.option('newver') - }] + replacements: [ + { + from: grunt.option('oldver'), + to: grunt.option('newver') + } + ] } }, @@ -335,7 +337,7 @@ module.exports = function (grunt) { // These plugins provide necessary tasks. - require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); + require('load-grunt-tasks')(grunt, { scope: 'devDependencies' }); // Docs HTML validation task grunt.registerTask('validate-html', ['jekyll', 'validation']); diff --git a/grunt/bs-raw-files-generator.js b/grunt/bs-raw-files-generator.js index 044717fc..72075067 100644 --- a/grunt/bs-raw-files-generator.js +++ b/grunt/bs-raw-files-generator.js @@ -6,6 +6,7 @@ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict'; + var btoa = require('btoa'); var fs = require('fs'); @@ -13,7 +14,7 @@ function getFiles(type, subdirs, exclude) { var files = {}; exclude = exclude || []; - subdirs.forEach(function(subdir) { + subdirs.forEach(function (subdir) { var sub = subdir ? subdir + '/' : ''; fs.readdirSync(type + '/' + sub) .filter(function (path) { @@ -24,6 +25,7 @@ function getFiles(type, subdirs, exclude) { files[sub + path] = fs.readFileSync(fullPath, 'utf8'); }); }); + return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'; } diff --git a/grunt/shrinkwrap.js b/grunt/shrinkwrap.js index d3292b49..ed210f63 100644 --- a/grunt/shrinkwrap.js +++ b/grunt/shrinkwrap.js @@ -9,6 +9,7 @@ This Grunt task updates the npm-shrinkwrap.canonical.json file that's used as th This task should be run and the updated file should be committed whenever Bootstrap's dependencies change. */ 'use strict'; + var canonicallyJsonStringify = require('canonical-json'); var NON_CANONICAL_FILE = 'npm-shrinkwrap.json'; var DEST_FILE = 'test-infra/npm-shrinkwrap.canonical.json'; diff --git a/js/.jscs.json b/js/.jscs.json deleted file mode 100644 index 313bfb69..00000000 --- a/js/.jscs.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "disallowKeywords": ["with"], - "requireLeftStickedOperators": [","], - "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], - "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireLineFeedAtFileEnd": true, - "requireRightStickedOperators": ["!"], - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "validateLineBreaks": "LF" -} diff --git a/js/.jscsrc b/js/.jscsrc new file mode 100644 index 00000000..cebf8269 --- /dev/null +++ b/js/.jscsrc @@ -0,0 +1,43 @@ +{ + "disallowEmptyBlocks": true, + "disallowKeywords": ["with"], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleLineStrings": true, + "disallowMultipleVarDecl": true, + "disallowQuotedKeysInObjects": "allButReserved", + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforeBinaryOperators": [","], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, + "disallowTrailingComma": true, + "disallowTrailingWhitespace": true, + "requireCamelCaseOrUpperCaseIdentifiers": true, + "requireCapitalizedConstructors": true, + "requireCommaBeforeLineBreak": true, + "requireDollarBeforejQueryAssignment": true, + "requireDotNotation": true, + "requireLineFeedAtFileEnd": true, + "requirePaddingNewLinesAfterUseStrict": true, + "requirePaddingNewLinesBeforeExport": true, + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], + "requireSpaceAfterLineComment": true, + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpaceBetweenArguments": true, + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true, "beforeOpeningRoundBrace": true }, + "requireSpacesInConditionalExpression": true, + "requireSpacesInForStatement": true, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInsideObjectBrackets": "allButNested", + "validateAlignedFunctionParameters": true, + "validateIndentation": 2, + "validateLineBreaks": "LF", + "validateNewlineAfterArrayElements": true, + "validateQuoteMarks": "'" +} + diff --git a/package.json b/package.json index 672909ab..cf58a8dd 100644 --- a/package.json +++ b/package.json @@ -20,35 +20,32 @@ "bugs": { "url": "https://github.com/jasny/bootstrap/issues" }, - "license": { - "type": "Apache-2.0", - "url": "https://github.com/jasny/bootstrap/blob/master/LICENSE" - }, + "license": "Apache-2.0", "devDependencies": { "btoa": "~1.1.1", "canonical-json": "~0.0.3", - "grunt": "~0.4.2", - "grunt-banner": "~0.2.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-concat": "~0.4.0", - "grunt-contrib-connect": "~0.7.0", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-csslint": "~0.2.0", - "grunt-contrib-cssmin": "~0.9.0", - "grunt-contrib-jade": "~0.11.0", - "grunt-contrib-jshint": "~0.10.0", - "grunt-contrib-less": "~0.11.0", - "grunt-contrib-qunit": "~0.4.0", - "grunt-contrib-uglify": "~0.4.0", + "grunt": "~0.4.5", + "grunt-banner": "~0.4.0", + "grunt-contrib-clean": "~0.6.0", + "grunt-contrib-concat": "~0.5.0", + "grunt-contrib-connect": "~0.11.0", + "grunt-contrib-copy": "~0.8.0", + "grunt-contrib-csslint": "~0.5.0", + "grunt-contrib-cssmin": "~0.13.0", + "grunt-contrib-jade": "~0.15.0", + "grunt-contrib-jshint": "~0.11.0", + "grunt-contrib-less": "~1.0", + "grunt-contrib-qunit": "~0.7.0", + "grunt-contrib-uglify": "~0.9.0", "grunt-contrib-watch": "~0.6.0", - "grunt-csscomb": "~2.0.1", + "grunt-csscomb": "~3.0.0", "grunt-exec": "~0.4.2", "grunt-html-validation": "~0.1.13", "grunt-jekyll": "~0.4.1", - "grunt-jscs-checker": "~0.4.0", - "grunt-saucelabs": "~5.1.0", - "grunt-text-replace": "~0.3.0", - "load-grunt-tasks": "~0.4.0", + "grunt-jscs": "~2.0.0", + "grunt-saucelabs": "~8.6.0", + "grunt-text-replace": "~0.4.0", + "load-grunt-tasks": "~3.2", "markdown": "~0.5.0" }, "jspm": {