@tangelo/tangelo-configuration-toolkit 1.23.1 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangelo/tangelo-configuration-toolkit",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "engines": {
5
5
  "node": ">=14.0.0"
6
6
  },
@@ -12,7 +12,7 @@ module.exports = function getRepoconfig(repoPath) {
12
12
 
13
13
  const dtDisplayName = dtSqlInsert.match(/'([^']+)' display_name/)[1];
14
14
  const ntName = ntSqlInsert.match(/'([^']+)' name/)[1];
15
- const xpiDir = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)[1];
15
+ const xpiDir = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)?.[1] ?? dtSqlInsert.match(/'([^']+)' xsl_xincludes/)[1];
16
16
 
17
17
  const path_cmscustom = xpiDir.replace(/\/[^/]+$/, '').split(/\//);
18
18
  const path_dbconfig = p.replace(/.*\/database\/config\/(.*)\/[^/]+/, '$1').split(/[/\\]/);
@@ -123,6 +123,7 @@ module.exports = function transfer (paths, {watch, lrServer} = {}) {
123
123
  .pipe(shF.restore)
124
124
  .pipe(g_plumber.stop())
125
125
  .pipe(g_replace(c.replaceStrings))
126
+ .pipe(through2.obj(combineTranslations))
126
127
  .pipe(through2.obj((file, enc, cb) => {
127
128
  file.originalRelativePath = file.relative; // original path needed for sftp.fastPut
128
129
  file.path = file.path.replace(/(fonto).(?:dev|dist|packages.sx-shell-.+src)(.+)/, '$1$2'); // change destination path for fonto build files
@@ -143,4 +144,35 @@ module.exports = function transfer (paths, {watch, lrServer} = {}) {
143
144
 
144
145
  if (c.deliveryPack) createDeliveryPack();
145
146
  });
146
- };
147
+ };
148
+
149
+ // Combine custom translations/resource bundle with tdi translations
150
+ async function combineTranslations(file, enc, cb) {
151
+ const isTranslationFile = file.basename.match(/custom-UI-text.*\.properties/);
152
+
153
+ // Ignore non-translation files
154
+ if (!isTranslationFile) return cb(null, file);
155
+
156
+ // Remove tdi translations from pipe
157
+ if (file.path.match(/tdi/)) return cb();
158
+
159
+ // Get language from file name
160
+ const language = file.basename.match(/custom-UI-text(_.+?)?\.properties/)[1] ?? '';
161
+
162
+ // Read matching tdi translation file
163
+ const tdiTranslationPath = `cmscustom/tdi/custom-UI-text/custom-UI-text${language}.properties`;
164
+ let tdiTranslations;
165
+ try {
166
+ tdiTranslations = await fs.readFile(tdiTranslationPath, enc);
167
+ }
168
+ catch {
169
+ // If tdi translation file does not exist (<5.8), leave custom translations unchanged
170
+ return cb(null, file);
171
+ }
172
+
173
+ // Combine file content
174
+ const separator = `# Contents of ${tdiTranslationPath}`;
175
+ const newText = [file.contents, separator, tdiTranslations].join('\n');
176
+ file.contents = Buffer.from(newText);
177
+ return cb(null, file);
178
+ }
@@ -54,7 +54,7 @@ module.exports = function fonto (argv) {
54
54
  const data = execSync(`${fdtCommand(fontoVersionCurrent)} editor versions`, {encoding: 'UTF-8'});
55
55
  fontoVersionNew = data.match(/\d+\.\d+\.\d+/g).find(v => allowedFontoVersionRegex.test(v));
56
56
  }
57
- else if (!allowedFontoVersionRegex.test(fontoVersionNew)) {
57
+ else if (fontoVersionNew !== 'nightly' && !allowedFontoVersionRegex.test(fontoVersionNew)) {
58
58
  _error(`Fonto version ${fontoVersionNew} is not compatible with the current TDI submodule commit!\nExecute: ${'tct fonto --init latest'.cyan}`);
59
59
  }
60
60
 
@@ -172,7 +172,8 @@ module.exports = function info (argv) {
172
172
  const id = dtRow.match(/(\d+) id/)?.[1];
173
173
  const name = dtRow.match(/'([^']+)' display_name/)?.[1];
174
174
  const dbPath = p.match(/(database\/config\/(:?.*)\/)txd_document_types.sql/i)?.[1];
175
- const prPath = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)[1].replace('prepare_xincludes.xsl', '');
175
+ const xincl = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)?.[1] ?? dtRow.match(/'([^']+)' xsl_xincludes/)[1];
176
+ const prPath = xincl.replace('prepare_xincludes.xsl', '');
176
177
 
177
178
  doctypesInfo.addRows([
178
179
  {id, name, paths: 'config/cmscustom/'+ prPath},
@@ -7,7 +7,7 @@ const rif = require('replace-in-file');
7
7
 
8
8
  class PathSearcher {
9
9
  #filter;
10
- #ignorePaths = [_paths.tdi + '/**', 'config/cmscustom/tdi/**'];
10
+ #ignorePaths = [_paths.tdi + '/**', 'config/cmscustom/tdi/**', '**/node_modules/**', '**/fonto/packages_shared/**', '**/fonto/platform/**'];
11
11
  constructor (filter, ignoreProjectPaths) {
12
12
  this.#filter = filter;
13
13
  this.#ignorePaths.push(...ignoreProjectPaths);