Build: Simplify Gruntfile constructions

Fixes gh-3246
This commit is contained in:
Oleg Gaidarenko 2016-07-26 02:53:57 +03:00
parent 9c90be9c04
commit 308e4b534b
5 changed files with 42 additions and 32 deletions

4
.gitignore vendored
View File

@ -8,11 +8,11 @@
.bower.json .bower.json
.sizecache.json .sizecache.json
npm-debug.log npm-debug.log*
# Ignore everything in dist folder except for eslint config # Ignore everything in dist folder except for eslint config
/dist/* /dist/*
!/dist/.eslintrc !/dist/.eslintrc.json
/node_modules /node_modules

View File

@ -1,5 +1,5 @@
.eslintignore .eslintignore
.eslintrc .eslintrc.json
/.editorconfig /.editorconfig
/.gitattributes /.gitattributes

View File

@ -113,8 +113,15 @@ module.exports = function( grunt ) {
// See https://github.com/sindresorhus/grunt-eslint/issues/119 // See https://github.com/sindresorhus/grunt-eslint/issues/119
quiet: true 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: { testswarm: {
tests: [ tests: [
@ -148,7 +155,7 @@ module.exports = function( grunt ) {
] ]
}, },
watch: { watch: {
files: [ "<%= eslint.dev %>" ], files: [ "<%= eslint.dev.src %>" ],
tasks: [ "dev" ] tasks: [ "dev" ]
}, },
uglify: { uglify: {
@ -196,36 +203,39 @@ module.exports = function( grunt ) {
grunt.registerTask( "lint", [ grunt.registerTask( "lint", [
"jsonlint", "jsonlint",
runIfNewNode( "eslint:dev" ), runIfNewNode( "eslint" )
runIfNewNode( "eslint:dist" )
] ); ] );
grunt.registerTask( "test_fast", [ runIfNewNode( "node_smoke_tests" ) ] ); grunt.registerTask( "lint:newer", [
"newer:jsonlint",
runIfNewNode( "newer:eslint" )
] );
grunt.registerTask( "test", [ "test_fast" ].concat( grunt.registerTask( "test:fast", runIfNewNode( "node_smoke_tests" ) );
[ runIfNewNode( "promises_aplus_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", [ grunt.registerTask( "dev", [
"build:*:*", "build:*:*",
runIfNewNode( "newer:eslint:dev" ), runIfNewNode( "newer:eslint:dev" ),
"uglify", "newer:uglify",
"remove_map_comment", "remove_map_comment",
"dist:*" "dist:*",
]
);
grunt.registerTask( "default", [
"dev",
runIfNewNode( "eslint:dist" ),
"test_fast",
"compare_size" "compare_size"
] ); ] );
grunt.registerTask( "precommit_lint", [ grunt.registerTask( "default", [
"newer:jsonlint", runIfNewNode( "eslint:dev" ),
runIfNewNode( "newer:eslint:dev" ), "build:*:*",
runIfNewNode( "newer:eslint:dist" ) "uglify",
"remove_map_comment",
"dist:*",
runIfNewNode( "eslint:dist" ),
"test:fast",
"compare_size"
] ); ] );
}; };

2
dist/.eslintrc vendored
View File

@ -1,7 +1,7 @@
{ {
"extends": "../src/.eslintrc", "extends": "../src/.eslintrc",
"rules": { "rules": {
// That is okay for built version // That is okay for the built version
"no-multiple-empty-lines": "off", "no-multiple-empty-lines": "off",
// Because sizze is not compatible to jquery code style // Because sizze is not compatible to jquery code style

View File

@ -60,8 +60,8 @@
"scripts": { "scripts": {
"build": "npm install && grunt", "build": "npm install && grunt",
"start": "grunt watch", "start": "grunt watch",
"test": "grunt && grunt test", "test": "grunt && grunt test:slow",
"precommit": "grunt precommit_lint", "precommit": "grunt lint:newer",
"commitmsg": "node node_modules/commitplease" "commitmsg": "node node_modules/commitplease"
}, },
"commitplease": { "commitplease": {