@tangelo/tangelo-configuration-toolkit 1.20.0 → 1.20.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/index.js CHANGED
@@ -110,7 +110,10 @@ global._modulesTdi = {
110
110
  return require(path.join(this.absolutePathTdi, 'tct', module));
111
111
  }
112
112
  catch (e) {
113
- if (throws) _error('Module could not be loaded: ' + module);
113
+ if (throws) {
114
+ _debug(`${e}`);
115
+ _error('Module could not be loaded: ' + module);
116
+ }
114
117
  else return undefined;
115
118
  }
116
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangelo/tangelo-configuration-toolkit",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "engines": {
5
5
  "node": ">=14.0.0"
6
6
  },
@@ -17,12 +17,15 @@ module.exports = function getRepoconfig(repoPath) {
17
17
  const path_cmscustom = xpiDir.replace(/\/[^/]+$/, '').split(/\//);
18
18
  const path_dbconfig = p.replace(/.*\/database\/config\/(.*)\/[^/]+/, '$1').split(/[/\\]/);
19
19
  const dnRegex = [path_cmscustom[0].replace(/[_'"]/g, '.'), path_dbconfig[0].replace(/[_'"]/g, '.')].sort((a, b) => b.length - a.length).join('|');
20
- const customer_name = (dtDisplayName.match(RegExp(dnRegex, 'i')) || dtDisplayName.split(/ (.+)/))[0];
20
+ /* Get customer name based on txd_document_types.display_name; if that match fails fallback to customername defined in path */
21
+ const customer_name = (dtDisplayName.match(RegExp(dnRegex, 'i')) || [path_cmscustom[0].split(/[\s_]/g).map(s => s[0].toUpperCase() + s.substring(1)).join(' ')])[0];
22
+ const customer_name_regex = RegExp(customer_name.replace(/(\W)/g, '\\$1?'), 'gi'); // match customer name; allow differences in special characters / match case insensitive
21
23
 
22
24
  return {
23
25
  customer_name,
24
26
  customer_abbr: ntName.split('_')[0],
25
- project_name: dtDisplayName.split(RegExp(customer_name.replace(/(\W)/g, '\\$1')))[1].trim() || '',
27
+ /* if display name matches the customer name; strip customer name from display name to get the project name; otherwise use the complete display name as projectname */
28
+ project_name: dtDisplayName.match(customer_name_regex) ? dtDisplayName.replace(customer_name_regex, '').trim() : dtDisplayName,
26
29
  project_abbr: ntName.split('_')[1],
27
30
  path_cmscustom,
28
31
  path_dbconfig,
@@ -10,6 +10,9 @@ global._info = (msg, time = false) => {
10
10
  }
11
11
  console.log(msg.lgreen);
12
12
  };
13
+ global._debug = msg => {
14
+ if (global._devmode) console.log(`[DEBUG]: ${msg}`.yellow);
15
+ };
13
16
  global._warn = msg => {
14
17
  console.log(msg.lyellow);
15
18
  };
@@ -120,13 +120,13 @@ const createDeliveryPack = () => { // create install scripts if necessary, zip o
120
120
  };
121
121
 
122
122
 
123
- const transfer = (paths, lrServer) => {
123
+ const transfer = (paths, {watch, lrServer} = {}) => {
124
124
  const jsFGlob = _settingsTdi().transpileToES5 ? ['**/*.js', '!**/hce/**/template_*', '!**/fonto/**', '!**/vendor/**', '!**/*.min.js'] : [];
125
125
  const jsF = g_filter(jsFGlob, {restore: true});
126
126
  const xpsF = g_filter(['**/xopus/**/*.x*'], {restore: true});
127
127
  const sassF = g_filter(['**/*.scss'], {restore: true});
128
128
  const shF = g_filter(['**/*.sh'], {restore: true});
129
- const srcset = s.create(paths);
129
+ const srcset = s.create(paths, {watch});
130
130
  const files = [];
131
131
 
132
132
  // local git repo must be on latest commit containing fonto changes, and fonto build files must be newer than that commit, unless that commit belongs to the current user
@@ -33,7 +33,7 @@ module.exports = function deploy (argv) {
33
33
  // execute chosen option
34
34
 
35
35
  if (argv.test) {
36
- s.create([...c.transferPatterns, '!**/fonto/{*.*,!(dist)/**}'], true);
36
+ s.create([...c.transferPatterns, '!**/fonto/{*.*,!(dist)/**}'], {test: true});
37
37
  }
38
38
 
39
39
  if (argv.copy) {
@@ -52,7 +52,7 @@ module.exports = function deploy (argv) {
52
52
  this.queue = this.queue.map(p => p.replace(/fonto(.)(?:dist|dev).assets.schemas(.sx-shell-.*?).json/, 'fonto$1packages$2$1src$1assets$1schemas$2.json')); // fonto schema changes can be detected in different paths at the same time, rewrite paths to original package-path because files in build folders can be removed before transfer starts
53
53
  this.queue = [...new Set(this.queue)]; // remove duplicates
54
54
  this.queue.forEach(v => s.addToCache(v));
55
- transfer(this.queue, lrServer);
55
+ transfer(this.queue, {watch: true, lrServer});
56
56
  this.queue = [];
57
57
  },
58
58
  add (fp) {
@@ -9,12 +9,12 @@ const resolveBind = (d, p) => p.replace('#{cmscustompath}', 'cmscustom/').replac
9
9
 
10
10
  module.exports = {
11
11
 
12
- create (pattern, test) {
12
+ create (paths, {test, watch} = {}) {
13
13
  const startTime = new Date();
14
14
 
15
- this.filesToTransfer = globby.sync(pattern, {nodir: true}); // get list of files to transfer
16
- this.potentialBaseFilesCache = this.potentialBaseFilesCache || globby.sync('**/*.{xml,xsd,xsl,scss}'); // get list of potential base files, if not previously done
17
- this.potentialBaseFiles = this.potentialBaseFilesCache
15
+ this.filesToTransfer = watch ? paths : globby.sync(paths, {nodir: true}); // get list of files to transfer
16
+ this.potentialBaseFilesCache ??= globby.sync('**/*.{xml,xsd,xsl,scss}'); // get list of potential base files, if not previously done
17
+ this.potentialBaseFiles = this.potentialBaseFilesCache
18
18
  .filter(p => !this.filesToTransfer.includes(p)) // subtract files to transfer from list of potential base files
19
19
  .map(path => [path]); // make array so file contents can be added later
20
20