2013-01-04 21:29:48 +01:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
2015-05-29 10:44:10 +02:00
|
|
|
var _ = grunt.util._;
|
2026-10-13 20:14:46 -04:00
|
|
|
var locales = ["bg", "ca", "cs", "de", "es", "es_419", "es_DO", "fr", "fa", "hu",
|
2019-01-03 12:07:35 +01:00
|
|
|
"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',
|
2019-01-18 10:23:13 +01:00
|
|
|
'src/bus.js',
|
2025-04-12 17:25:28 +02:00
|
|
|
'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
|
|
|
];
|
2020-10-26 21:24:19 +01:00
|
|
|
var less_paths = [
|
|
|
|
|
'src',
|
2024-10-04 20:54:56 +02:00
|
|
|
'node_modules',
|
|
|
|
|
'node_modules/bootstrap',
|
|
|
|
|
'node_modules/bootstrap/less',
|
|
|
|
|
'node_modules/bootstrap-rtl-ondemand/less',
|
2020-10-26 21:24:19 +01:00
|
|
|
];
|
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(" "))
|
2015-10-23 23:54:52 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
po2json: {
|
|
|
|
|
options: {
|
|
|
|
|
format: 'raw'
|
2015-05-29 10:44:10 +02:00
|
|
|
},
|
2015-10-23 23:54:52 +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: {
|
2020-10-26 21:24:19 +01:00
|
|
|
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: {
|
2019-05-03 11:01:36 +02:00
|
|
|
options: {
|
2022-04-12 19:02:12 +02:00
|
|
|
timeout: 300000,
|
2019-05-03 11:01:36 +02:00
|
|
|
puppeteer: {
|
|
|
|
|
headless: true,
|
|
|
|
|
args: [
|
|
|
|
|
'--no-sandbox',
|
|
|
|
|
],
|
2021-10-19 00:20:37 +02:00
|
|
|
env: {
|
|
|
|
|
TZ: 'UTC',
|
|
|
|
|
},
|
2019-05-03 11:01:36 +02:00
|
|
|
},
|
|
|
|
|
},
|
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
|
|
|
|
2017-01-13 20:11:17 +01:00
|
|
|
grunt.registerTask('default', 'Build for production.', function() {
|
2024-03-15 10:13:23 +01:00
|
|
|
grunt.task.run(['concat', 'less', 'po2json']);
|
2017-01-13 20:11:17 +01:00
|
|
|
});
|
2024-03-15 10:13:23 +01:00
|
|
|
grunt.registerTask('watch', 'Watch development', function() {
|
2017-01-13 20:11:17 +01:00
|
|
|
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']);
|
|
|
|
|
});
|
2017-04-10 23:21:54 +02:00
|
|
|
grunt.registerTask('xgettext', ' Extracts translatable messages', function() {
|
2022-04-04 20:16:41 +02:00
|
|
|
grunt.loadNpmTasks('grunt-shell');
|
|
|
|
|
grunt.task.run(['shell:xgettext']);
|
2017-04-10 23:21:54 +02:00
|
|
|
});
|
2017-01-13 20:11:17 +01:00
|
|
|
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']);
|
2017-01-13 20:11:17 +01:00
|
|
|
});
|
2013-01-04 21:29:48 +01:00
|
|
|
|
|
|
|
|
};
|