accountant-ui/Gruntfile.js

135 lines
3.1 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-04-12 10:55:08 +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.
// ================
// Manage toolchain
grunt.registerTask('toolchain', [
// NodeJS dependencies for toolchain.
2016-10-09 20:33:59 +02:00
'shell:npmInstall',
2016-10-15 11:45:39 +02:00
// Configuration file linting.
'newer:eslint:toolchain',
'newer:jsonlint:toolchain'
]);
// Backend tasks.
// ==============
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
// 'shell:pipInstall'
2015-06-13 17:37:35 +02:00
]);
2016-10-15 11:45:39 +02:00
// Linting
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', [
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.
'wiredep:app'
]);
// Linting
grunt.registerTask('feLint', [
// ECMAScript
'newer:eslint:frontend',
// 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
};