Manage project with Grunt and Bower.

This commit is contained in:
Alexis Lahouze 2015-06-13 17:37:35 +02:00
parent 27fa96a7cb
commit 8ef26895ad
11 changed files with 175 additions and 0 deletions

46
Gruntfile.js Normal file
View File

@ -0,0 +1,46 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
// Options
var options = {
config: {
src: "grunt-config/*.js"
},
paths: {
frontend_js: [
'accountant/frontend/static/js/app.js',
'accountant/frontend/static/js/accounts.js',
'accountant/frontend/static/js/months.js',
'accountant/frontend/static/js/entries.js',
'accountant/frontend/static/js/scheduler.js'
],
frontend_build: 'accountant/frontend/static/build'
},
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',
};
var configs = require('load-grunt-configs')(grunt, options);
grunt.initConfig(configs);
grunt.registerTask('generatestatic', [
'shell:npm_install',
'bower:install',
'bower_concat',
'copy:bootstrap-select.css.map',
'copy:fontawesome-webfont.woff',
'copy:fontawesome-webfont.ttf'
]);
grunt.registerTask('jsdev', [
'jshint',
'concat'
]);
grunt.registerTask('dev', [
'generatestatic',
'jsdev'
]);
};

27
bower.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "accountant",
"version": "0.1.0",
"authors": [
"Alexis Lahouze <xals@lahouze.org>"
],
"license": "AGPL",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "2.1.4",
"moment": "2.10.3",
"bootstrap": "3.3.4",
"bootstrap-datepicker": "1.4.0",
"font-awesome": "4.3.0",
"pines-notify": "1.2.0",
"angular": "1.4.0",
"angular-strap": "2.2.4",
"d3": "3.5.5",
"nvd3": "1.8.1-alpha"
}
}

16
grunt-config/bower.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
install: {
options: {
copy: false
}
},
frontend: {
dest: 'accountant/frontend/static/third-party',
options: {
expand: true,
stripAffix: true,
keepExpandedHierarchy: false
}
}
};

View File

@ -0,0 +1,9 @@
module.exports = {
main: {
dest: 'accountant/frontend/static/build/js/vendor.js',
cssDest: 'accountant/frontend/static/build/css/vendor.css',
dependencies: {
'autotype': 'jquery'
}
},
};

5
grunt-config/clean.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
libs: [
"accountant/frontend/static/build"
]
};

15
grunt-config/concat.js Normal file
View File

@ -0,0 +1,15 @@
module.exports = {
options: {
stripBanners: false,
banner: '<%= banner %>\n',
process: function(src, filepath) {
// Add comments with original filename.
return '// ### Begin: ' + filepath + ' ### //\n' + src +
'// ### End: ' + filepath + ' ### //\n';
}
},
frontend_js: {
src: '<%= paths.frontend_js %>',
dest: '<%= paths.frontend_build %>/js/app.js'
}
};

14
grunt-config/copy.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
"bootstrap-select.css.map": {
src: 'bower_components/bootstrap-select/dist/css/bootstrap-select.css.map',
dest: '<%= paths.frontend_build %>/css/bootstrap-select.css.map'
},
"fontawesome-webfont.woff": {
src: 'bower_components/font-awesome/fonts/fontawesome-webfont.woff',
dest: '<%= paths.frontend_build %>/fonts/fontawesome-webfont.woff'
},
"fontawesome-webfont.ttf": {
src: 'bower_components/font-awesome/fonts/fontawesome-webfont.ttf',
dest: '<%= paths.frontend_build %>/fonts/fontawesome-webfont.ttf'
}
};

9
grunt-config/jshint.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
options: {
reporter: require('jshint-stylish')
},
work: [
'<%= paths.frontend_js %>/*.js',
'Gruntfile.js'
]
};

5
grunt-config/shell.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
npm_install: {
command: 'npm install'
}
};

6
grunt-config/watch.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
js: {
files: '<%= paths.frontend_js %>',
tasks: ['concat:frontend_js']
}
};

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "accountant",
"version": "0.1.0",
"repository": "https://git.lahouze.org/xals/accountant",
"license": "AGPL-1.0",
"dependencies": {
"grunt": "0.4.5",
"grunt-copy": "0.1.0",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-watch": "0.6.1",
"grunt-contrib-concat": "0.5.1",
"time-grunt": "1.2.1",
"load-grunt-configs": "0.4.3",
"load-grunt-tasks": "3.2.0",
"grunt-bowercopy": "0.4.1",
"grunt-shell": "1.1.2",
"grunt-bower-task": "0.4.0",
"grunt-bower-concat": "0.5.0",
"grunt-contrib-jshint": "0.11.2",
"jshint-stylish": "2.0.0"
},
"devDependencies": {}
}