@tangelo/tangelo-configuration-toolkit 1.24.0 → 1.24.2

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.24.0",
3
+ "version": "1.24.2",
4
4
  "engines": {
5
5
  "node": ">=14.0.0"
6
6
  },
@@ -29,8 +29,8 @@ module.exports = function() {
29
29
  const tclConfig = new TclConfig(tclFileDir, createAddToStreamFn(this));
30
30
  tclConfig.outputJson(path.resolve(tclFileDir, 'fonto/assets'));
31
31
  tclConfig.outputCss(path.resolve(tclFileDir, 'fonto'));
32
- const esefCssDir = path.resolve(tclFileDir, 'export/esef/esef_out/css');
33
- if (fs.existsSync(esefCssDir)) tclConfig.outputCss(esefCssDir);
32
+ const xbrlCssDir = path.resolve(tclFileDir, 'export/xbrl/xbrl_out/css');
33
+ if (fs.existsSync(xbrlCssDir)) tclConfig.outputCss(xbrlCssDir);
34
34
  }
35
35
  cb();
36
36
  }
@@ -91,7 +91,7 @@ module.exports = class TclConfig {
91
91
  outputCss(dir) {
92
92
  if (this.#tclFileExists) {
93
93
  const filepath = path.join(dir, TclConfig.#TCL_CSS_FILE_NAME);
94
- const moduleName = dir.includes('esef') ? 'ESEF' : 'FONTO';
94
+ const moduleName = dir.includes('xbrl') ? 'XBRL' : 'FONTO';
95
95
  this.#outputFn(filepath, this.#getCss(moduleName));
96
96
  this.modifyFontoHtml(dir);
97
97
  }
@@ -4,6 +4,7 @@ const fs = require('fs-extra');
4
4
  const globby = require('globby');
5
5
  const gulp = require('gulp');
6
6
  const g_tcl = require('../../lib/gulp-tcl-config');
7
+ const path = require('path');
7
8
  const through2 = require('through2');
8
9
  const {spawnSync} = require('child_process');
9
10
 
@@ -35,6 +36,8 @@ const createDeliveryPack = () => { // create install scripts if necessary, zip o
35
36
  });
36
37
 
37
38
  if (dbiSql[0]) { // complete and output sql script
39
+
40
+ const checkVersion = fs.existsSync(path.join(_paths.tdi, 'src/database/tdi/scripts/_check_version.sql')) ? '@@tangelo-default-implementation/src/database/tdi/scripts/_check_version.sql' : '';
38
41
  dbiSql.unshift(
39
42
  `accept l_tns char prompt 'Database TNS name : '`,
40
43
  `accept l_pw_tancms char prompt 'TANCMS password : '`,
@@ -43,6 +46,7 @@ const createDeliveryPack = () => { // create install scripts if necessary, zip o
43
46
  'prompt ',
44
47
  'connect tancms/&l_pw_tancms@&l_tns',
45
48
  'prompt ',
49
+ `${checkVersion}`,
46
50
  'set verify off define off'
47
51
  );
48
52
  dbiSql.push('prompt ', 'pause Press ENTER to exit', 'exit');
@@ -160,7 +164,11 @@ async function combineTranslations(file, enc, cb) {
160
164
  const language = file.basename.match(/custom-UI-text(_.+?)?\.properties/)[1] ?? '';
161
165
 
162
166
  // Read matching tdi translation file
163
- const tdiTranslationPath = `cmscustom/tdi/custom-UI-text/custom-UI-text${language}.properties`;
167
+ const tdiTranslationPath = path.join(
168
+ // Current working directory can be either repo root for delivery pack or config folder otherwise, so adjust path accordingly
169
+ file.cwd.split(path.sep).pop() == 'config' ? '' : 'config',
170
+ `cmscustom/tdi/custom-UI-text/custom-UI-text${language}.properties`
171
+ );
164
172
  let tdiTranslations;
165
173
  try {
166
174
  tdiTranslations = await fs.readFile(tdiTranslationPath, enc);
@@ -3,6 +3,7 @@ const fs = require('fs-extra');
3
3
  const globby = require('globby');
4
4
  const inquirer = require('inquirer');
5
5
  const path = require('path');
6
+ const {compare} = require('compare-versions');
6
7
 
7
8
  const execGitCommand = require('../../lib/exec-git-command');
8
9
  const getTdiBranch = require('../../lib/get-tdi-branch');
@@ -202,17 +203,23 @@ function updateSubmodule({dates = [], updateSubmodule: releaseBranchName}) {
202
203
  const migrations = _modulesTdi.require('git/tdiCommitsRequiringMigration.js');
203
204
  const fromDate = dateCustomFrom ? new Date(dateCustomFrom) : branch.commonAncestor?.date ?? dateBeforeUpdate;
204
205
  const toDate = dateCustomTo ? new Date(dateCustomTo) : new Date();
206
+ const fromVersion = branch.from?.name?.replace('release/', '');
207
+ const toVersion = branch.name.replace('release/', '');
205
208
 
206
209
  _info(`TDI commits requiring migration between ${_formatDate(fromDate)} and ${_formatDate(toDate)}`);
207
210
  // Filter the migrations that should be applied/considered; Also display older releases migrations
208
211
  // For a branch upgrade, all the migrations need to be executed from the beginning of the target branch, not just within the given date range
209
212
  const migrationsFiltered = migrations.filter(m => m.releases.find(r => {
210
213
  const withinDateRange = fromDate < new Date(r.date) && new Date(r.date) < toDate;
211
- const isTargetBranch = `release/${r.release}` === branch.name;
212
- return branchUpgrade ?
213
- isTargetBranch || (branch.from.name <= `release/${r.release}` && `release/${r.release}` < branch.name && withinDateRange) :
214
- isTargetBranch && withinDateRange
215
- ;
214
+
215
+ if (branchUpgrade) {
216
+ // For branch upgrades, include all migrations for versions newer than the current one, and include new migrations for the current version
217
+ const isTargetBranch = compare(r.release, toVersion, '<=') && compare(r.release, fromVersion, '>');
218
+ return isTargetBranch || (r.release === fromVersion && withinDateRange);
219
+ } else {
220
+ // For non-branch upgrades, only include new migrations for the current branch
221
+ return r.release === toVersion && withinDateRange;
222
+ }
216
223
  }));
217
224
 
218
225
  let relevantMigrationCount = 0;
@@ -2,7 +2,7 @@ const {execSync} = require('child_process');
2
2
  const fs = require('fs-extra');
3
3
  const globby = require('globby');
4
4
  const inquirer = require('inquirer');
5
-
5
+ const path = require('path');
6
6
 
7
7
  const runSqlScript = (path, db, un, pw) => {
8
8
  const connect = db ? `${un}/${pw}@${db}` : '/nolog';
@@ -72,6 +72,13 @@ module.exports = function sql (argv) {
72
72
  const script = [`define l_env = ${a.pw=='tancms' ? 'dev' : 'prd'}`, 'set verify off define off'];
73
73
 
74
74
  script.push(`spool install-config.log`);
75
+
76
+ if (fs.existsSync(path.join(_paths.tdi, 'src/database/tdi/scripts/_check_version.sql'))) {
77
+ script.push(`whenever sqlerror exit sql.sqlcode`);
78
+ script.push(`@@../../tangelo-default-implementation/src/database/tdi/scripts/_check_version.sql`);
79
+ script.push(`whenever sqlerror continue`);
80
+ }
81
+
75
82
  a.projects.forEach(p => {
76
83
  const dir = p.path_dbconfig ? p.path_dbconfig.join('/') : (_repoconfig.customer.dirname+'/'+p.dirname);
77
84
  script.push('prompt ', `prompt Loading configuration for: ${p.name}`);