From 05f33b4fcb36e56cbfd32021f5b8209b59b59511 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 17 Oct 2023 17:13:55 +0200 Subject: [PATCH] Bug 35079: Replace --force-extract by --generate-pot={always,auto,never} This restores the original behaviour of always building the POT file in order to not break existing workflows Option --force-extract is deleted in favor of a new option --generate-pot that can have 3 values: * always: always build the POT file. This is the default value * auto: build the POT file only if it does not exist * never: never build the POT file Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- gulpfile.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8cea78b04c..1c119663ce 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,7 +19,7 @@ const exec = require('gulp-exec'); const merge = require('merge-stream'); const through2 = require('through2'); const Vinyl = require('vinyl'); -const args = require('minimist')(process.argv.slice(2)); +const args = require('minimist')(process.argv.slice(2), { default: { 'generate-pot': 'always' } }); const rename = require('gulp-rename'); const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css"; @@ -262,7 +262,11 @@ function po_create_type (type) { // Generate .pot only if it doesn't exist or --force-extract is given const extract = () => stream.finished(poTasks[type].extract()); - const p = args['force-extract'] ? extract() : access(pot).catch(extract); + const p = + args['generate-pot'] === 'always' ? extract() : + args['generate-pot'] === 'auto' ? access(pot).catch(extract) : + args['generate-pot'] === 'never' ? Promise.resolve(0) : + Promise.reject(new Error('Invalid value for option --generate-pot: ' + args['generate-pot'])) return p.then(function () { const languages = getLanguages(); @@ -299,7 +303,11 @@ function po_update_type (type) { // Generate .pot only if it doesn't exist or --force-extract is given const extract = () => stream.finished(poTasks[type].extract()); - const p = args['force-extract'] ? extract() : access(pot).catch(extract); + const p = + args['generate-pot'] === 'always' ? extract() : + args['generate-pot'] === 'auto' ? access(pot).catch(extract) : + args['generate-pot'] === 'never' ? Promise.resolve(0) : + Promise.reject(new Error('Invalid value for option --generate-pot: ' + args['generate-pot'])) return p.then(function () { const languages = getLanguages(); -- 2.20.1