From d006234790433886e8f34af2895dbecd92826b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 23 Nov 2021 12:24:55 +0100 Subject: [PATCH] :fire: Remove unused translations output --- packages/nodes-base/gulpfile.js | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/packages/nodes-base/gulpfile.js b/packages/nodes-base/gulpfile.js index daa23fbc94..2ae4316e22 100644 --- a/packages/nodes-base/gulpfile.js +++ b/packages/nodes-base/gulpfile.js @@ -13,13 +13,12 @@ function copyIcons() { return src('credentials/**/*.{png,svg}').pipe(dest('dist/credentials')); } -task('build:translations', writeHeadersAndTranslations); +task('build:translations', writeHeaders); /** - * Write all node translation headers at `/dist/nodes/headers.js` and write - * each node translation at `/dist/nodes//translations/.js` + * Write all node translation headers at `/dist/nodes/headers.js`. */ -function writeHeadersAndTranslations(done) { +function writeHeaders(done) { const { N8N_DEFAULT_LOCALE: locale } = process.env; log(`Default locale set to: ${colorize(PURPLE_ANSI_COLOR_CODE, locale || 'en')}`); @@ -30,7 +29,7 @@ function writeHeadersAndTranslations(done) { }; const paths = getTranslationPaths(); - const { headers, translations } = getHeadersAndTranslations(paths); + const headers = getHeaders(paths); const headersDestinationPath = path.join(__dirname, 'dist', 'nodes', 'headers.js'); @@ -39,13 +38,6 @@ function writeHeadersAndTranslations(done) { log('Headers translation file written to:'); log(headersDestinationPath, { bulletpoint: true }); - translations.forEach(t => { - writeDestinationFile(t.destinationPath, t.content); - }); - - log('Main translation files written to:'); - translations.forEach(t => log(t.destinationPath, { bulletpoint: true })) - done(); } @@ -82,7 +74,7 @@ function getTranslationPaths() { }, []); } -function getHeadersAndTranslations(paths) { +function getHeaders(paths) { return paths.reduce((acc, cur) => { const translation = require(cur.source); const nodeTypes = Object.keys(translation); @@ -91,17 +83,12 @@ function getHeadersAndTranslations(paths) { const { header } = translation[nodeType]; if (isValidHeader(header, ALLOWED_HEADER_KEYS)) { - acc.headers[nodeType] = header; + acc[nodeType] = header; } - - acc.translations.push({ - destinationPath: cur.destination, - content: translation, - }); } return acc; - }, { headers: {}, translations: [] }); + }, {}); }