Files

147 lines
3.8 KiB
JavaScript
Raw Permalink Normal View History

2013-01-04 21:29:48 +01:00
module.exports = function(grunt) {
2015-05-29 10:44:10 +02:00
var _ = grunt.util._;
var locales = ["bg", "ca", "cs", "de", "es", "es_419", "es_DO", "fr", "fa", "hu",
"it", "lo", "lt", "nl", "pl", "pt", "ru", "sl", "zh_CN"];
2015-05-29 10:44:10 +02:00
var jsfiles = [
'src/sao.js',
'src/rpc.js',
'src/pyson.js',
'src/session.js',
2021-02-21 19:38:25 +01:00
'src/common.js',
2015-05-29 10:44:10 +02:00
'src/model.js',
2015-10-15 10:33:37 +02:00
'src/tab.js',
'src/screen.js',
'src/view.js',
2015-10-30 11:52:58 +01:00
'src/view/form.js',
'src/view/tree.js',
'src/view/graph.js',
'src/view/calendar.js',
2019-04-08 15:06:36 +02:00
'src/view/list_form.js',
2015-10-15 10:33:37 +02:00
'src/action.js',
'src/window.js',
'src/wizard.js',
2018-08-30 11:15:01 +02:00
'src/board.js',
'src/bus.js',
'src/chat.js',
2025-12-02 13:08:54 +01:00
'src/notification.js',
2020-06-29 17:33:06 +02:00
'src/plugins.js',
'src/html_sanitizer.js'
2015-05-29 10:44:10 +02:00
];
var less_paths = [
'src',
'node_modules',
'node_modules/bootstrap',
'node_modules/bootstrap/less',
'node_modules/bootstrap-rtl-ondemand/less',
];
2015-05-29 10:44:10 +02:00
2013-01-04 21:29:48 +01:00
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
2015-05-29 10:44:10 +02:00
shell: {
options: {
failOnError: true
},
msgmerge: {
command: _.map(locales, function(locale) {
var po = "locale/" + locale + ".po";
2022-04-04 20:16:41 +02:00
return (
"msgmerge " +
"-U " + po + " " +
"--no-location " +
"locale/messages.pot;");
2015-05-29 10:44:10 +02:00
}).join("")
2022-04-04 20:16:41 +02:00
},
xgettext: {
command: (
"xgettext " +
"--language=JavaScript --from-code=UTF-8 " +
"--omit-header --no-location " +
"-o locale/messages.pot " +
jsfiles.join(" "))
}
},
po2json: {
options: {
format: 'raw'
2015-05-29 10:44:10 +02:00
},
all: {
src: ['locale/*.po'],
dest: 'locale/'
2015-05-29 10:44:10 +02:00
}
},
2013-01-04 21:29:48 +01:00
concat: {
dist: {
2015-05-29 10:44:10 +02:00
src: jsfiles,
2013-01-04 21:29:48 +01:00
dest: 'dist/<%= pkg.name %>.js'
}
},
2013-09-17 17:40:59 +02:00
less: {
2024-03-15 10:13:23 +01:00
'default': {
2013-09-17 17:40:59 +02:00
options: {
paths: less_paths,
2013-09-17 17:40:59 +02:00
},
files: {
2020-08-16 17:43:21 +02:00
'dist/<%= pkg.name %>.css': 'src/sao.less'
2013-09-17 17:40:59 +02:00
}
}
},
2013-01-07 14:54:59 +01:00
watch: {
2013-09-17 17:40:59 +02:00
scripts: {
2018-03-06 10:34:28 +01:00
files: ['src/**/*.js'],
2024-03-11 23:33:12 +01:00
tasks: ['concat']
2013-09-17 17:40:59 +02:00
},
styles: {
files: ['src/*.less'],
2024-03-15 10:13:23 +01:00
tasks: 'less'
},
translations: {
files: ['locale/*.po'],
tasks: 'po2json'
2013-09-17 17:40:59 +02:00
}
2016-05-12 09:14:14 +02:00
},
qunit: {
options: {
2022-04-12 19:02:12 +02:00
timeout: 300000,
puppeteer: {
headless: true,
args: [
'--no-sandbox',
],
env: {
TZ: 'UTC',
},
},
},
2016-05-12 09:14:14 +02:00
all: ['tests/*.html']
2013-01-04 21:29:48 +01:00
}
});
2018-03-06 10:34:28 +01:00
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-po2json');
2023-01-08 01:55:20 +01:00
grunt.loadNpmTasks('grunt-qunit-junit');
2018-03-06 10:34:28 +01:00
grunt.registerTask('default', 'Build for production.', function() {
2024-03-15 10:13:23 +01:00
grunt.task.run(['concat', 'less', 'po2json']);
});
2024-03-15 10:13:23 +01:00
grunt.registerTask('watch', 'Watch development', function() {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.task.run(['watch']);
});
grunt.registerTask('msgmerge', 'Update locale messages.', function() {
grunt.loadNpmTasks('grunt-shell');
grunt.task.run(['shell:msgmerge']);
});
grunt.registerTask('xgettext', ' Extracts translatable messages', function() {
2022-04-04 20:16:41 +02:00
grunt.loadNpmTasks('grunt-shell');
grunt.task.run(['shell:xgettext']);
});
grunt.registerTask('test', 'Run tests', function() {
grunt.loadNpmTasks('grunt-contrib-qunit');
2024-03-15 10:13:23 +01:00
grunt.task.run(['concat', 'less', 'qunit_junit', 'qunit']);
});
2013-01-04 21:29:48 +01:00
};