accountant-ui/Gruntfile.js
2016-10-15 12:50:57 +02:00

151 lines
3.4 KiB
JavaScript

// vim: set tw=80 ts=4 sw=4 sts=4:
'use strict';
module.exports = function(grunt) {
// Grunt plugin initialization.
// ============================
// Automagically load grunt tasks.
require('load-grunt-tasks')(grunt);
// Display duration for each task.
require('time-grunt')(grunt);
// Options
var options = {
// Application related configuration.
accountant: {
// Frontend related
frontend: {
// Application dependencies by bower.
app: require('./bower.json'),
// Source path
src: 'accountant-ui',
// Distribution path
dist: 'accountant-ui/dist'
}
},
// Grunt configurationi files.
config: {
src: 'grunt-config/*.js'
},
// Package description for NPM.
pkg: grunt.file.readJSON('package.json')
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %>\n' +
// '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %> */\n'
};
// Load configuration from Grunt configuration directory.
var configs = require('load-grunt-configs')(grunt, options);
// Initialize Grunt configuration.
grunt.initConfig(configs);
// 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', [
// NPM.
'npm',
// Grunt.
'grunt'
]);
// Backend tasks.
// ==============
// Manage backend dependencies with pip.
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
//'shell:pipInstall'
]);
// Backend linting
grunt.registerTask('beLint', [
// Use flake8 for python linting.
'newer:flake8'
]);
// Backend dev task.
grunt.registerTask('beDev', [
'beDeps',
'beLint'
]);
// Frontend tasks.
// ===============
// Front dependency management.
grunt.registerTask('feDeps', [
// Bower file linting
'newer:jsonlint:bower',
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.
'wiredep:app'
]);
// Linting
grunt.registerTask('feLint', [
// ECMAScript
'newer:eslint:frontend',
// HTML.
'newer:htmllint'
]);
// Frontend dev task.
grunt.registerTask('feDev', [
'feDeps',
'feLint'
]);
// Global tasks.
// =============
// Dev.
grunt.registerTask('dev', [
'toolchain',
'beDev',
'feDev'
]);
// Serve application.
grunt.registerTask('serve', [
'dev',
'bgShell:runserver',
'connect:livereload',
'watch'
]);
// Make distribution.
grunt.registerTask('dist', [
'dev',
'clean:dist',
'useminPrepare',
'copy:dist',
'copy:styles',
'cssmin:generated',
'concat:generated',
'ngAnnotate',
'uglify:generated',
'filerev',
'usemin'
]);
};