@tangelo/tangelo-configuration-toolkit 1.9.0 → 1.9.3

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
@@ -106,6 +106,7 @@ else {
106
106
  }
107
107
 
108
108
 
109
+ global._tdiSubmoduleExists = fs.existsSync(path.join(_paths.repo, _paths.tdi));
109
110
  global._isPre42 = fs.existsSync(path.join(_paths.repo, _paths.tdi, 'create_new_project')); // folder changed in 4.2
110
111
  global._isPre51 = !fs.existsSync(path.join(_paths.repo, _paths.tdi, 'src')); // folder changed in 5.1 (check new folder because old one could still exist after branch switch)
111
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangelo/tangelo-configuration-toolkit",
3
- "version": "1.9.0",
3
+ "version": "1.9.3",
4
4
  "description": "Tangelo Configuration Toolkit is a command-line toolkit which offers support for developing a Tangelo configuration.",
5
5
  "bin": {
6
6
  "tct": "bin/index.js",
@@ -17,8 +17,8 @@
17
17
  "author": "Iddo Fontijn <iddo.fontijn@tangelo.nl>",
18
18
  "license": "SEE LICENSE IN LICENSE.md",
19
19
  "dependencies": {
20
- "babel-core": "^6.26.3",
21
- "babel-preset-es2015-without-strict": "0.0.4",
20
+ "@babel/core": "^7.17.4",
21
+ "@babel/preset-env": "^7.16.11",
22
22
  "cli-spinner": "^0.2.10",
23
23
  "compare-versions": "^4.1.1",
24
24
  "del": "^6.0.0",
@@ -28,7 +28,7 @@
28
28
  "global-modules-path": "^2.3.1",
29
29
  "globby": "^6.1.0",
30
30
  "gulp": "^4.0.2",
31
- "gulp-babel": "^7.0.1",
31
+ "gulp-babel": "^8.0.0",
32
32
  "gulp-eol": "^0.2.0",
33
33
  "gulp-filter": "^7.0.0",
34
34
  "gulp-plumber": "^1.2.1",
@@ -37,11 +37,11 @@
37
37
  "gulp-sourcemaps": "^3.0.0",
38
38
  "inquirer": "^8.2.0",
39
39
  "istextorbinary": "^6.0.0",
40
- "minimatch": "^3.0.4",
40
+ "minimatch": "^5.0.0",
41
41
  "node-ssh": "^12.0.2",
42
42
  "object-assign-deep": "^0.4.0",
43
43
  "p-limit": "^3.1.0",
44
- "replace-in-file": "^3.4.4",
44
+ "replace-in-file": "^6.3.2",
45
45
  "sass": "^1.43.5",
46
46
  "saxon-js": "^2.3.0",
47
47
  "ssh2-sftp-client": "^7.2.2",
@@ -25,7 +25,7 @@ module.exports = function(ftpConfig, remotedir) {
25
25
  if (!files[0]) cb();
26
26
 
27
27
  const paths = [...new Set(files.map(({destination}) => path.dirname(destination)))] // collect unique paths
28
- .filter((p1, i, a) => !a.find(p2 => p1 != p2 && p2.includes(p1))) // remove paths being part of others
28
+ .filter((p1, i, a) => !a.find(p2 => p1 != p2 && p2.includes(p1+'/'))) // remove paths being part of others
29
29
  ;
30
30
 
31
31
  sftp.connect(ftpConfig)
@@ -53,7 +53,7 @@ module.exports = function(ftpConfig, remotedir) {
53
53
  cb();
54
54
  return sftp.end();
55
55
  })
56
- .catch(err => _error(err));
56
+ .catch(err => _error(`Could not connect to server${err ? ': '+err.message : ''}`));
57
57
  }
58
58
 
59
59
  )
@@ -54,7 +54,9 @@ module.exports = {
54
54
  parallel: serverConfig.config.parallel,
55
55
  username: serverConfig.config.username,
56
56
  agent: process.platform=='win32' ? 'pageant' : process.env.SSH_AUTH_SOCK,
57
- agentForward: process.platform!='win32'
57
+ agentForward: process.platform!='win32',
58
+ readyTimeout: 10000,
59
+ retries: 1
58
60
  }
59
61
  };
60
62
 
@@ -105,7 +107,7 @@ module.exports = {
105
107
 
106
108
  this.transferPatterns = [transferPattern, tdiPattern, ...this.giPatterns, '!**/*.crdownload']; // ignore patterns must come last
107
109
 
108
- if (this.deliveryPack && transferPattern.includes(_paths.tdi)) this.transferPatterns.push(`${_paths.tdi}/src/database/create.sql`); // create.sql is called by tdi install
110
+ if (this.deliveryPack && transferPattern.includes(_paths.tdi)) this.transferPatterns.push(`${_paths.tdi}/src/database/create*.sql`); // create(_exists).sql is called by tdi install
109
111
 
110
112
  // add time parameters to all xopus requests to overcome cache
111
113
  const ts = new Date().toISOString().replace(/-|:/g, '').substring(0,15);
@@ -1,3 +1,4 @@
1
+ const babel_pe = require('@babel/preset-env');
1
2
  const execGitCommand = require('../../lib/exec-git-command');
2
3
  const fs = require('fs-extra');
3
4
  const globby = require('globby');
@@ -6,7 +7,6 @@ const {NodeSSH} = require('node-ssh');
6
7
  const through2 = require('through2');
7
8
  const {spawnSync} = require('child_process');
8
9
 
9
- const g_babel_env = require('babel-preset-es2015-without-strict');
10
10
  const g_babel = require('gulp-babel');
11
11
  const g_eol = require('gulp-eol');
12
12
  const g_filter = require('gulp-filter');
@@ -156,7 +156,7 @@ const transfer = (paths, lrServer) => {
156
156
  .pipe(xpsF.restore)
157
157
  .pipe(jsF)
158
158
  .pipe(g_sourcemaps.init())
159
- .pipe(g_babel({presets: [g_babel_env], comments: false, minified: true}))
159
+ .pipe(g_babel({presets: [[babel_pe, {modules: false}]], comments: false, minified: true})) // function must be executed here, otherwise second execution during watch fails
160
160
  .pipe(g_sourcemaps.write('.'))
161
161
  .pipe(jsF.restore)
162
162
  .pipe(sassF)
@@ -1,7 +1,8 @@
1
- const del = require('del');
2
- const gulp = require('gulp');
3
- const path = require('path');
4
- const tinylr = require('tiny-lr');
1
+ const del = require('del');
2
+ const gulp = require('gulp');
3
+ const path = require('path');
4
+ const sftpClient = require('ssh2-sftp-client');
5
+ const tinylr = require('tiny-lr');
5
6
 
6
7
  const {remote, transfer} = require('./execute');
7
8
  const c = require('./config');
@@ -60,6 +61,12 @@ module.exports = function deploy (argv) {
60
61
  }
61
62
  };
62
63
 
64
+ // check connection
65
+ if (!c.localTransfer) {
66
+ const sftp = new sftpClient();
67
+ sftp.connect(c.server.ftpConfig).then(() => sftp.end()).catch(err => _error(`Could not connect to server${err ? ': '+err.message : ''}`));
68
+ }
69
+
63
70
  // for fonto, only watch dev/dist (for the build, does not detect "assets" most of the times btw)
64
71
  gulp.watch([...c.transferPatterns, `!**/fonto/!(${c.envDev?'dev|':''}dist)/**`])
65
72
  .on('all', (event, filepath) => {
@@ -6,18 +6,20 @@ const path = require('path');
6
6
 
7
7
  module.exports = function fonto (argv) {
8
8
 
9
+ if (!_tdiSubmoduleExists) _error('TDI submodule folder is missing.');
10
+
9
11
  process.chdir(_paths.apply || '.');
10
-
12
+
11
13
  // find fonto instances by searching for manifest.json files having a fonto property
12
14
  const fontoPaths = globby.sync(['**/manifest.json', `!${_paths.tdi}/**`])
13
15
  .filter(p => (fs.readJsonSync(p, {throws: false}) || {}).edition == 'fontoxml-platform-base')
14
16
  .map(p => p.replace('manifest.json', ''))
15
17
  ;
16
-
18
+
17
19
  if (fontoPaths.length==0) _error('No Fonto instance found.');
18
-
20
+
19
21
  let promiseChain = Promise.resolve(); // for sequentially executing commands for each fonto instance
20
-
22
+
21
23
  fontoPaths.forEach((p, i) => {
22
24
  promiseChain = promiseChain
23
25
  .then(() => {
@@ -40,5 +42,5 @@ module.exports = function fonto (argv) {
40
42
  .catch(error => {
41
43
  if (error) _warn(error.message || error);
42
44
  });
43
-
45
+
44
46
  };
@@ -2,10 +2,10 @@ const fs = require('fs-extra');
2
2
  const globby = require('globby');
3
3
  const minimatch = require('minimatch');
4
4
  const path = require('path');
5
- const rif = require('replace-in-file');
5
+ const rif = require('replace-in-file');
6
6
 
7
7
 
8
- const getPaths = (search, filter) =>
8
+ const getPaths = (search, filter) =>
9
9
  globby
10
10
  .sync(search, {dot: true, ignore: [_paths.tdi + '/**','**/cmscustom/tdi/**']})
11
11
  .filter(p => !filter || minimatch(p, filter)
@@ -47,9 +47,11 @@ module.exports = function steps (step, dry, filter) {
47
47
  r.to = r.fromtoPairs.map(p => p[1]);
48
48
  }
49
49
 
50
- r.files = rif.sync(r); // execute first time
51
- const filesModCount = r.files.length; // save file count
52
- for (let i=0; i<20 && !dry && r.files[0]; i++) r.files = rif.sync(r); // execute repeatedly for modified files only (with safety limit of 20)
50
+ let filesModCount;
51
+ for (let i=0; i<20 && !dry && r.files[0]; i++) { // execute repeatedly for modified files only (with safety limit of 20)
52
+ r.files = rif.sync(r).filter(f => f.hasChanged).map(f => f.file);
53
+ if (i==0) filesModCount = r.files.length; // save count only after first run (after this only subsets are processed)
54
+ }
53
55
 
54
56
  _write('Files modified:', filesModCount);
55
57
  });