2014-08-07 17:27:32 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
2015-01-09 12:54:00 +00:00
|
|
|
// Load all grunt modules
|
|
|
|
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
|
|
|
|
|
2014-12-09 08:04:28 +00:00
|
|
|
// Tell our Express server that Grunt launched it
|
|
|
|
process.env.GRUNTED = true;
|
|
|
|
|
2014-08-07 17:27:32 +00:00
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2014-12-30 07:11:47 +00:00
|
|
|
settings: grunt.file.readJSON('./server_config/settings.json'),
|
2014-08-07 17:27:32 +00:00
|
|
|
|
2014-09-04 14:15:24 +00:00
|
|
|
less: {
|
2014-09-26 21:22:43 +00:00
|
|
|
all: {
|
2014-12-18 17:02:04 +00:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'front/src/less/',
|
|
|
|
src: ['**/*.less'],
|
|
|
|
dest: 'front/src/css/',
|
|
|
|
ext: '.css'
|
|
|
|
}
|
|
|
|
]
|
2014-09-04 14:15:24 +00:00
|
|
|
}
|
|
|
|
},
|
2014-08-07 17:27:32 +00:00
|
|
|
jshint: {
|
|
|
|
all: [
|
|
|
|
'*.js',
|
2014-11-28 09:45:30 +00:00
|
|
|
'app/lib/*.js',
|
|
|
|
'bin/*.js',
|
|
|
|
'lib/**/*.js',
|
2014-08-07 17:27:32 +00:00
|
|
|
'app/nodeControllers/*.js',
|
|
|
|
'app/public/scripts/*.js',
|
2014-12-01 23:08:07 +00:00
|
|
|
'phantomas_custom/**/*.js',
|
2015-03-08 09:32:57 +00:00
|
|
|
'test/api/*.js',
|
|
|
|
'test/core/*.js',
|
|
|
|
'test/fixtures/*.js',
|
2014-12-15 17:58:38 +00:00
|
|
|
'front/src/js/**/*.js'
|
2019-03-14 02:27:37 +00:00
|
|
|
],
|
|
|
|
options: {
|
|
|
|
esversion: 6
|
|
|
|
}
|
2014-09-03 07:06:35 +00:00
|
|
|
},
|
|
|
|
clean: {
|
2015-01-05 22:18:15 +00:00
|
|
|
tmp: {
|
2015-01-09 12:54:00 +00:00
|
|
|
src: ['.tmp']
|
2014-09-04 14:15:24 +00:00
|
|
|
},
|
2014-12-18 17:02:04 +00:00
|
|
|
dev: {
|
|
|
|
src: ['front/src/css']
|
|
|
|
},
|
2015-01-09 12:54:00 +00:00
|
|
|
build: {
|
|
|
|
src: ['front/build']
|
2014-09-03 07:06:35 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
copy: {
|
2015-01-09 12:54:00 +00:00
|
|
|
build: {
|
|
|
|
files: [
|
2021-01-31 01:42:03 +00:00
|
|
|
{src: ['./front/src/main.html'], dest: './front/build/main.html'},
|
2015-01-09 12:54:00 +00:00
|
|
|
{src: ['./front/src/img/favicon.png'], dest: './front/build/img/favicon.png'},
|
2015-01-09 17:13:16 +00:00
|
|
|
{src: ['./front/src/img/logo-large.png'], dest: './front/build/img/logo-large.png'},
|
2015-01-09 12:54:00 +00:00
|
|
|
]
|
2021-02-01 15:10:30 +00:00
|
|
|
},
|
|
|
|
favicons: {
|
|
|
|
files: [
|
|
|
|
{src: ['./front/src/img/favicon.png'], dest: './front/build/img/favicon.png'},
|
|
|
|
{src: ['./front/src/img/favicon-fail.png'], dest: './front/build/img/favicon-fail.png'},
|
|
|
|
{src: ['./front/src/img/favicon-success.png'], dest: './front/build/img/favicon-success.png'},
|
|
|
|
]
|
2014-09-03 07:06:35 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mochaTest: {
|
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
reporter: 'spec',
|
|
|
|
},
|
2018-01-17 03:06:18 +00:00
|
|
|
src: ['test/core/*.js', 'test/api/*.js']
|
2014-11-28 09:45:30 +00:00
|
|
|
},
|
|
|
|
'test-current-work': {
|
|
|
|
options: {
|
|
|
|
reporter: 'spec',
|
|
|
|
},
|
2019-03-14 02:27:37 +00:00
|
|
|
src: ['test/core/mediaQueriesCheckerTest.js']
|
2014-11-28 09:45:30 +00:00
|
|
|
}
|
|
|
|
},
|
2015-01-09 12:54:00 +00:00
|
|
|
env: {
|
|
|
|
dev: {
|
|
|
|
NODE_ENV: 'development'
|
|
|
|
},
|
2015-03-16 12:06:56 +00:00
|
|
|
built: {
|
2015-01-09 12:54:00 +00:00
|
|
|
NODE_ENV: 'production'
|
|
|
|
}
|
|
|
|
},
|
2014-11-28 09:45:30 +00:00
|
|
|
express: {
|
2014-12-09 08:04:28 +00:00
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
port: 8383,
|
|
|
|
server: './bin/server.js',
|
|
|
|
serverreload: true,
|
|
|
|
showStack: true
|
|
|
|
}
|
|
|
|
},
|
2015-03-16 12:06:56 +00:00
|
|
|
built: {
|
2015-01-09 12:54:00 +00:00
|
|
|
options: {
|
|
|
|
port: 8383,
|
|
|
|
server: './bin/server.js',
|
|
|
|
serverreload: true,
|
|
|
|
showStack: true
|
|
|
|
}
|
|
|
|
},
|
2014-12-22 21:08:24 +00:00
|
|
|
test: {
|
|
|
|
options: {
|
|
|
|
port: 8387,
|
2018-01-17 03:06:18 +00:00
|
|
|
server: './bin/server.js',
|
2014-12-22 21:08:24 +00:00
|
|
|
showStack: true
|
|
|
|
}
|
|
|
|
},
|
2015-01-16 14:50:56 +00:00
|
|
|
'test-current-work': {
|
|
|
|
options: {
|
|
|
|
port: 8387,
|
|
|
|
server: './bin/server.js',
|
|
|
|
showStack: true
|
|
|
|
}
|
|
|
|
},
|
2014-12-09 08:04:28 +00:00
|
|
|
testSuite: {
|
2014-11-28 09:45:30 +00:00
|
|
|
options: {
|
|
|
|
port: 8388,
|
|
|
|
bases: 'test/www'
|
|
|
|
}
|
2014-09-03 07:06:35 +00:00
|
|
|
}
|
2015-01-09 12:54:00 +00:00
|
|
|
},
|
|
|
|
useminPrepare: {
|
|
|
|
html: './front/src/main.html',
|
|
|
|
options: {
|
|
|
|
dest: './front/build',
|
|
|
|
root: ['./', './front/src']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
usemin: {
|
|
|
|
html: './front/build/main.html',
|
|
|
|
css: './front/build/css/*.css',
|
|
|
|
options: {
|
2015-04-27 12:05:36 +00:00
|
|
|
assetsDirs: ['front/build']
|
2015-01-09 12:54:00 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
htmlmin: {
|
|
|
|
options: {
|
|
|
|
removeComments: true,
|
2015-03-16 12:16:05 +00:00
|
|
|
collapseWhitespace: true,
|
|
|
|
conservativeCollapse: true
|
2015-01-09 12:54:00 +00:00
|
|
|
},
|
|
|
|
main: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: './front/build/',
|
|
|
|
src: 'main.html',
|
|
|
|
flatten: true,
|
|
|
|
dest: './front/build'
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
views: {
|
|
|
|
files: [{
|
|
|
|
expand: true,
|
|
|
|
cwd: './front/src/views',
|
|
|
|
src: '*.html',
|
|
|
|
flatten: true,
|
|
|
|
dest: '.tmp/views/'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
inline_angular_templates: {
|
|
|
|
build: {
|
|
|
|
options: {
|
|
|
|
base: '.tmp',
|
2016-09-12 08:17:01 +00:00
|
|
|
method: 'append',
|
|
|
|
unescape: {
|
|
|
|
'<': '<',
|
|
|
|
'>': '>'
|
|
|
|
}
|
2015-01-09 12:54:00 +00:00
|
|
|
},
|
|
|
|
files: {
|
|
|
|
'./front/build/main.html': ['.tmp/views/*.html']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
filerev: {
|
|
|
|
options: {
|
|
|
|
algorithm: 'md5',
|
|
|
|
length: 8
|
|
|
|
},
|
|
|
|
assets: {
|
|
|
|
src: './front/build/*/*.*'
|
|
|
|
}
|
2014-08-07 17:27:32 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-01-17 16:58:02 +00:00
|
|
|
// Custom task that sets a variable for tests
|
|
|
|
grunt.registerTask('test-settings', function() {
|
|
|
|
process.env.IS_TEST = true;
|
|
|
|
});
|
2014-12-13 11:11:33 +00:00
|
|
|
|
2014-09-26 15:06:49 +00:00
|
|
|
grunt.registerTask('build', [
|
2015-01-09 17:18:35 +00:00
|
|
|
'jshint',
|
2015-01-09 12:54:00 +00:00
|
|
|
'clean:build',
|
|
|
|
'copy:build',
|
2014-12-30 07:11:47 +00:00
|
|
|
'less',
|
2015-01-09 12:54:00 +00:00
|
|
|
'useminPrepare',
|
|
|
|
'concat',
|
|
|
|
'uglify',
|
|
|
|
'cssmin',
|
|
|
|
'htmlmin:views',
|
|
|
|
'inline_angular_templates',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
|
|
|
'htmlmin:main',
|
2021-02-01 15:10:30 +00:00
|
|
|
'clean:tmp',
|
|
|
|
'copy:favicons'
|
2014-09-26 15:06:49 +00:00
|
|
|
]);
|
|
|
|
|
2014-09-03 07:06:35 +00:00
|
|
|
grunt.registerTask('hint', [
|
|
|
|
'jshint'
|
|
|
|
]);
|
|
|
|
|
2014-12-09 08:04:28 +00:00
|
|
|
grunt.registerTask('dev', [
|
2015-01-09 12:54:00 +00:00
|
|
|
'env:dev',
|
2014-12-22 21:13:17 +00:00
|
|
|
'express:dev'
|
2014-12-09 08:04:28 +00:00
|
|
|
]);
|
|
|
|
|
2015-03-16 12:06:56 +00:00
|
|
|
grunt.registerTask('built', [
|
|
|
|
'env:built',
|
|
|
|
'express:built'
|
2015-01-09 12:54:00 +00:00
|
|
|
]);
|
|
|
|
|
2014-09-03 07:06:35 +00:00
|
|
|
grunt.registerTask('test', [
|
2018-01-17 16:58:02 +00:00
|
|
|
'test-settings',
|
2014-11-28 09:45:30 +00:00
|
|
|
'build',
|
2014-12-09 08:04:28 +00:00
|
|
|
'express:testSuite',
|
2014-12-22 21:08:24 +00:00
|
|
|
'express:test',
|
2014-11-28 09:45:30 +00:00
|
|
|
'mochaTest:test',
|
2015-01-05 22:18:15 +00:00
|
|
|
'clean:tmp'
|
2014-11-28 09:45:30 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('test-current-work', [
|
2018-01-17 16:58:02 +00:00
|
|
|
'test-settings',
|
2014-11-28 09:45:30 +00:00
|
|
|
'jshint',
|
2014-12-09 08:04:28 +00:00
|
|
|
'express:testSuite',
|
2015-01-16 14:50:56 +00:00
|
|
|
'express:test-current-work',
|
2015-01-05 22:18:15 +00:00
|
|
|
'mochaTest:test-current-work',
|
|
|
|
'clean:tmp'
|
2014-09-03 07:06:35 +00:00
|
|
|
]);
|
2014-08-07 17:27:32 +00:00
|
|
|
|
|
|
|
};
|