Skip to content

Commit

Permalink
Build: Simplify Gruntfile constructions
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Aug 2, 2016
1 parent 9c90be9 commit 308e4b5
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.eslintignore
.eslintrc
.eslintrc.json

/.editorconfig
/.gitattributes
Expand Down
60 changes: 35 additions & 25 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -148,7 +155,7 @@ module.exports = function( grunt ) {
]
},
watch: {
files: [ "<%= eslint.dev %>" ],
files: [ "<%= eslint.dev.src %>" ],
tasks: [ "dev" ]
},
uglify: {
Expand Down Expand Up @@ -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" )
] );
};
2 changes: 1 addition & 1 deletion dist/.eslintrc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 308e4b5

Please sign in to comment.