Improve grunt tasks dependencies.

This commit is contained in:
Alexis Lahouze 2016-10-15 12:50:57 +02:00
parent 4c0a37495f
commit 47ed5a2b5c
4 changed files with 61 additions and 44 deletions

View File

@ -46,23 +46,37 @@ module.exports = function(grunt) {
// Toolchain tasks.
// ================
// Manage dev dependencies with npm
grunt.registerTask('npm', [
// Linting on package.json.
'newer:jsonlint:package',
// NodeJS dependencies.
'shell:npmInstall'
]);
grunt.registerTask('grunt', [
// Linting on Grunt files.
'newer:eslint:grunt',
]);
// Manage toolchain
grunt.registerTask('toolchain', [
// NodeJS dependencies for toolchain.
'shell:npmInstall',
// Configuration file linting.
'newer:eslint:toolchain',
'newer:jsonlint:toolchain'
// NPM.
'npm',
// Grunt.
'grunt'
]);
// Backend tasks.
// ==============
// Manage backend dependencies with pip.
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
// 'shell:pipInstall'
//'shell:pipInstall'
]);
// Linting
// Backend linting
grunt.registerTask('beLint', [
// Use flake8 for python linting.
'newer:flake8'
@ -79,6 +93,8 @@ module.exports = function(grunt) {
// Front dependency management.
grunt.registerTask('feDeps', [
// Bower file linting
'newer:jsonlint:bower',
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.

View File

@ -1,13 +1,13 @@
'use strict';
module.exports = {
grunt: [
'Gruntfile.js',
'grunt-config/*.js'
],
frontend: [
'<%= accountant.frontend.src %>/index.html',
'<%= accountant.frontend.src %>/views/*.html',
'<%= accountant.frontend.src %>/js/*.js'
],
toolchain: [
'Gruntfile.js',
'grunt-config/*.js'
]
};

View File

@ -1,8 +1,16 @@
'use strict';
module.exports = {
toolchain: {
src: ['.eslintrc.json', 'package.json', 'bower.json'],
package: {
src: ['package.json'],
options: {
formatter: 'prose',
reporter: 'jslint',
indent: 2
}
},
bower: {
src: ['bower.json'],
options: {
formatter: 'prose',
reporter: 'jslint',

View File

@ -1,43 +1,36 @@
'use strict';
module.exports = {
// Toolchain
npm: {
files: ['package.json'],
taks: ['npm']
},
grunt: {
files: ['Gruntfile.js', 'grunt-config/*.js'],
tasks: ['grunt']
},
// Backend
requirements: {
files: ['requirements.txt'],
tasks: ['beDeps']
},
be: {
files: 'accountant/{,**}/*.py',
tasks: ['beLint', 'bgShell:runserver']
},
// Frontend
bower: {
files: 'bower.json',
tasks: ['wiredep']
tasks: ['feDeps']
},
js: {
files: [
'<%= accountant.frontend.src %>/js/*.js %>',
'grunt-config/*.js'
],
tasks: ['jsdev']
},
py: {
files: 'accountant/**/*.py',
tasks: ['pydev', 'bgShell:runserver']
},
html: {
files: [
'<%= accountant.frontend.src %>/*.html',
'<%= accountant.frontend.src %>/views/*.html'
],
tasks: ['htmldev']
},
gruntfile: {
files: ['Gruntfile.js', 'grunt-config/*.js']
},
livereload: {
fe: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= accountant.frontend.src %>/{,*/}*.html',
'<%= accountant.frontend.src %>/js/*.js',
'<%= accountant.frontend.src %>/css/*.css'
]
},
requirements: {
files: ['requirements.txt'],
tasks: ['shell:pipInstall']
'<%= accountant.frontend.src %>/{,**}/*',
],
tasks: ['feLint']
}
};