accountant-ui/Gruntfile.js

159 lines
3.6 KiB
JavaScript
Raw Normal View History

2016-10-15 11:45:39 +02:00
// vim: set tw=80 ts=4 sw=4 sts=4:
2016-02-08 00:24:10 +01:00
'use strict';
2015-06-13 17:37:35 +02:00
module.exports = function(grunt) {
2016-10-15 11:45:39 +02:00
// Grunt plugin initialization.
// ============================
// Automagically load grunt tasks.
2015-06-13 17:37:35 +02:00
require('load-grunt-tasks')(grunt);
2016-10-15 11:45:39 +02:00
// Display duration for each task.
2015-06-13 17:37:35 +02:00
require('time-grunt')(grunt);
// Options
var options = {
2016-10-15 11:45:39 +02:00
// Application related configuration.
2016-02-17 09:52:13 +01:00
accountant: {
2016-10-15 11:45:39 +02:00
// Frontend related
2016-02-17 09:52:13 +01:00
frontend: {
2016-10-15 11:45:39 +02:00
// Application dependencies by bower.
2016-02-17 09:52:13 +01:00
app: require('./bower.json'),
2016-10-15 11:45:39 +02:00
// Source path
2016-04-12 10:55:08 +02:00
src: 'accountant-ui',
2016-10-15 11:45:39 +02:00
// Distribution path
2016-10-15 11:56:02 +02:00
dist: 'accountant-ui/dist'
2016-02-17 09:52:13 +01:00
}
},
2016-01-29 13:42:25 +01:00
2016-10-15 11:45:39 +02:00
// Grunt configurationi files.
2015-06-13 17:37:35 +02:00
config: {
2016-02-08 00:24:10 +01:00
src: 'grunt-config/*.js'
2015-06-13 17:37:35 +02:00
},
2016-10-15 11:45:39 +02:00
// 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'
2015-06-13 17:37:35 +02:00
};
2016-10-15 11:45:39 +02:00
// Load configuration from Grunt configuration directory.
2015-06-13 17:37:35 +02:00
var configs = require('load-grunt-configs')(grunt, options);
2016-10-15 11:45:39 +02:00
// Initialize Grunt configuration.
2015-06-13 17:37:35 +02:00
grunt.initConfig(configs);
2016-10-15 11:45:39 +02:00
// Toolchain tasks.
// ================
2016-10-15 12:50:57 +02:00
// 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',
]);
2016-10-15 11:45:39 +02:00
// Manage toolchain
grunt.registerTask('toolchain', [
2016-10-15 12:50:57 +02:00
// NPM.
'npm',
// Grunt.
'grunt'
2016-10-15 11:45:39 +02:00
]);
// Backend tasks.
// ==============
2016-10-15 12:50:57 +02:00
// Manage backend dependencies with pip.
2016-10-15 11:45:39 +02:00
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
2016-10-15 12:50:57 +02:00
//'shell:pipInstall'
2015-06-13 17:37:35 +02:00
]);
2016-10-15 12:50:57 +02:00
// Backend linting
2016-10-15 11:45:39 +02:00
grunt.registerTask('beLint', [
// Use flake8 for python linting.
2016-02-01 21:56:49 +01:00
'newer:flake8'
]);
2016-10-15 11:45:39 +02:00
// Backend dev task.
grunt.registerTask('beDev', [
'beDeps',
'beLint'
2015-06-13 17:37:35 +02:00
]);
2016-10-15 11:45:39 +02:00
// Frontend tasks.
// ===============
// Front dependency management.
grunt.registerTask('feDeps', [
2016-10-15 12:50:57 +02:00
// Bower file linting
'newer:jsonlint:bower',
2016-10-15 11:45:39 +02:00
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.
'wiredep:app'
]);
2016-10-15 21:40:20 +02:00
// Generate needed files.
grunt.registerTask('feGen', [
// Generate CSS from Less.
'newer:less:frontend'
]);
2016-10-15 11:45:39 +02:00
// Linting
grunt.registerTask('feLint', [
// ECMAScript
'newer:eslint:frontend',
2016-10-15 13:46:08 +02:00
// CSS
'newer:csslint:frontend',
2016-10-15 11:45:39 +02:00
// HTML.
2016-02-01 21:56:49 +01:00
'newer:htmllint'
]);
2016-10-15 11:45:39 +02:00
// Frontend dev task.
grunt.registerTask('feDev', [
'feDeps',
'feLint'
]);
// Global tasks.
// =============
// Dev.
2015-06-13 17:37:35 +02:00
grunt.registerTask('dev', [
2016-10-15 11:45:39 +02:00
'toolchain',
'beDev',
'feDev'
2015-06-13 17:37:35 +02:00
]);
2016-01-29 13:42:25 +01:00
2016-10-15 11:45:39 +02:00
// Serve application.
2016-01-29 13:42:25 +01:00
grunt.registerTask('serve', [
'dev',
'bgShell:runserver',
'connect:livereload',
2016-01-29 13:42:25 +01:00
'watch'
]);
2016-10-15 11:45:39 +02:00
// Make distribution.
grunt.registerTask('dist', [
2016-10-15 11:45:39 +02:00
'dev',
'clean:dist',
'useminPrepare',
'copy:dist',
'copy:styles',
'cssmin:generated',
2016-02-18 15:53:28 +01:00
'concat:generated',
'ngAnnotate',
'uglify:generated',
'filerev',
'usemin'
]);
2015-06-13 17:37:35 +02:00
};