]> source.dussan.org Git - jquery.git/commitdiff
Build: Simplify Gruntfile constructions
authorOleg Gaidarenko <markelog@gmail.com>
Mon, 25 Jul 2016 23:53:57 +0000 (02:53 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 2 Aug 2016 17:58:01 +0000 (20:58 +0300)
Fixes gh-3246

.gitignore
.npmignore
Gruntfile.js
dist/.eslintrc
package.json

index 300adf912b1a16c638682b7c57ef946bbd975c25..8cb522de39d7df36fe4e0ee74e77f633f4cbcf3a 100644 (file)
@@ -8,11 +8,11 @@
 .bower.json
 .sizecache.json
 
-npm-debug.log
+npm-debug.log*
 
 # Ignore everything in dist folder except for eslint config
 /dist/*
-!/dist/.eslintrc
+!/dist/.eslintrc.json
 
 /node_modules
 
index 322f560b71ae571a38e7d978faed07769228ba7b..5af00bba31dee507ddaf1511b5b19a4293c9108a 100644 (file)
@@ -1,5 +1,5 @@
 .eslintignore
-.eslintrc
+.eslintrc.json
 
 /.editorconfig
 /.gitattributes
index 8cc4c91c0bb96400bf191e3ebde61986d114649c..7090a1af619f0367213ffbfa6b154a94903ff3fd 100644 (file)
@@ -113,8 +113,15 @@ module.exports = function( grunt ) {
                                // See https://github.com/sindresorhus/grunt-eslint/issues/119
                                quiet: true
                        },
-                       dist: "dist/jquery.js",
-                       dev: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
+
+                       // We have to explicitly declare "src" property otherwise "newer"
+                       // task wouldn't work properly :/
+                       dist: {
+                               src: "dist/jquery.js"
+                       },
+                       dev: {
+                               src: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
+                       }
                },
                testswarm: {
                        tests: [
@@ -148,7 +155,7 @@ module.exports = function( grunt ) {
                        ]
                },
                watch: {
-                       files: [ "<%= eslint.dev %>" ],
+                       files: [ "<%= eslint.dev.src %>" ],
                        tasks: [ "dev" ]
                },
                uglify: {
@@ -196,36 +203,39 @@ module.exports = function( grunt ) {
 
        grunt.registerTask( "lint", [
                "jsonlint",
-               runIfNewNode( "eslint:dev" ),
-               runIfNewNode( "eslint:dist" )
+               runIfNewNode( "eslint" )
        ] );
 
-       grunt.registerTask( "test_fast", [ runIfNewNode( "node_smoke_tests" ) ] );
+       grunt.registerTask( "lint:newer", [
+               "newer:jsonlint",
+               runIfNewNode( "newer:eslint" )
+       ] );
 
-       grunt.registerTask( "test", [ "test_fast" ].concat(
-               [ runIfNewNode( "promises_aplus_tests" ) ]
-       ) );
+       grunt.registerTask( "test:fast", runIfNewNode( "node_smoke_tests" ) );
+       grunt.registerTask( "test:slow", runIfNewNode( "promises_aplus_tests" ) );
+
+       grunt.registerTask( "test", [
+               "test:fast",
+               "test:slow"
+       ] );
 
-       // Short list as a high frequency watch task
        grunt.registerTask( "dev", [
-                       "build:*:*",
-                       runIfNewNode( "newer:eslint:dev" ),
-                       "uglify",
-                       "remove_map_comment",
-                       "dist:*"
-               ]
-       );
+               "build:*:*",
+               runIfNewNode( "newer:eslint:dev" ),
+               "newer:uglify",
+               "remove_map_comment",
+               "dist:*",
+               "compare_size"
+       );
 
        grunt.registerTask( "default", [
-               "dev",
+               runIfNewNode( "eslint:dev" ),
+               "build:*:*",
+               "uglify",
+               "remove_map_comment",
+               "dist:*",
                runIfNewNode( "eslint:dist" ),
-               "test_fast",
+               "test:fast",
                "compare_size"
        ] );
-
-       grunt.registerTask( "precommit_lint", [
-               "newer:jsonlint",
-               runIfNewNode( "newer:eslint:dev" ),
-               runIfNewNode( "newer:eslint:dist" )
-       ] );
 };
index d21ae4d16bb384748b3510a103e69212cd260d9a..ac4ec2feffaa029da5f16aede637add42c7b7324 100644 (file)
@@ -1,7 +1,7 @@
 {
        "extends": "../src/.eslintrc",
        "rules": {
-               // That is okay for built version
+               // That is okay for the built version
                "no-multiple-empty-lines": "off",
 
                // Because sizze is not compatible to jquery code style
index d05c2485a7b221547f2d9d61bccf6507ea8d3ebb..1e2e4262cc0d1d7962a7d36591365176bdbda138 100644 (file)
@@ -60,8 +60,8 @@
   "scripts": {
     "build": "npm install && grunt",
     "start": "grunt watch",
-    "test": "grunt && grunt test",
-    "precommit": "grunt precommit_lint",
+    "test": "grunt && grunt test:slow",
+    "precommit": "grunt lint:newer",
     "commitmsg": "node node_modules/commitplease"
   },
   "commitplease": {