@floatwork/grunt-po2mo
Version:
Compiles .po files into binary .mo files with `msgfmt`
66 lines (54 loc) • 1.48 kB
JavaScript
/*
* grunt-po2mo
* https://github.com/fltwrk/grunt-po2mo
*
* Copyright (c) 2013-2019 Michele Bertoli, floatwork_
* Licensed under the MIT license.
*/
;
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
eslint: {
target: ["tasks/po2mo.js"],
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ["tmp"],
},
// Configuration to be run (and then tested).
po2mo: {
stage: {
src: "test/fixtures/fr.po",
dest: "tmp/fr.mo",
},
prod: {
options: {
deleteSrc: true,
},
src: "tmp/fixtures/fr.po",
dest: "tmp/fr.mo",
},
},
// Unit tests.
nodeunit: {
tests: ["test/*_test.js"],
},
});
// Actually load this plugin's task(s).
grunt.loadTasks("tasks");
// These plugins provide necessary tasks.
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-nodeunit");
grunt.registerTask("copy", "Copy fixtures to a temp location.", function () {
grunt.file.copy("test/fixtures/fr.po", "tmp/fixtures/fr.po");
});
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask("test", ["clean", "copy", "po2mo", "nodeunit"]);
// Lint the source
grunt.registerTask("lint", ["eslint"]);
// By default, lint and run all tests.
grunt.registerTask("default", ["lint", "test"]);
};