@tangelo/tangelo-configuration-toolkit 1.14.3 → 1.15.1

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/README.md CHANGED
@@ -1,67 +1,67 @@
1
- # tangelo-configuration-toolkit
2
-
3
- Tangelo Configuration Toolkit is a command-line toolkit which offers support for developing a Tangelo configuration.
4
-
5
- ## Installation
6
-
7
- The toolkit requires [NPM](https://www.npmjs.com/get-npm) on [Node.js®](https://nodejs.org/) (at least version 14.x). An active or maintenance LTS release is recommended. After installing Node.js, you can install the latest version of the Tangelo Configuration Toolkit globally on your system using the following command:
8
-
9
- npm i -g @tangelo/tangelo-configuration-toolkit
10
-
11
- ## Usage
12
-
13
- Get help for the available commands and see version:
14
-
15
- tangelo-configuration-toolkit
16
-
17
- Get help for a specific command, detailing all its arguments:
18
-
19
- tangelo-configuration-toolkit <command>
20
-
21
- Use the `tct` shorthand instead of `tangelo-configuration-toolkit`:
22
-
23
- tct <command>
24
-
25
- ## Config
26
-
27
- ### Global
28
-
29
- The `deploy` command requires server connection information. So you'll have to create a configuration file named `tangelo-configuration-toolkit-appconfig.json` in which such information can be stored. This file will be searched for in an ancestor directory of the current working directory.
30
-
31
- The contents looks like this (all properties are optional):
32
-
33
- {
34
- "sharedConfigPath": "absolute/or/relative/path/to/folder/containing/shared/config",
35
- "servers": [{
36
- "config": {
37
- "port": 22,
38
- "parallel": 4,
39
- "username": "username",
40
- "remotedir": "/absolute/path/to/tangelo/config/folder/on/server"
41
- },
42
- "domains": ["domain.name.com"],
43
- "name": "name-for-local-deploy"
44
- }],
45
- "serverDefaults": {
46
- "config": {
47
- ...
48
- }
49
- }
50
- "defaultServer": "can be set to the name of e.g. your favorite dev server",
51
- "defaultDatabase": "can be set to the tnsname of e.g. your favorite dev server"
52
- }
53
-
54
- When passing a server name, `tct` will look for a full match with a name or a partial match (the start) with a domain.
55
-
56
- ### Repo
57
-
58
- The `build` and `sql` commands make use of a configuration file in the repository named `tangelo-configuration-toolkit-repoconfig.json`. This contains information about the customer projects.
59
-
60
- For a new repository, using `tct build --init` also creates the repoconfig-file. For existing projects not having the repoconfig-file, you can use `tct build --config` to generate it.
61
-
62
- ### oXygen
63
-
64
- The `build -x` commands set projects transformation scenarios and masterfiles in the oXygen project file with the following functionality:
65
- - Will try to preserve manually added entries in the transformation scenarios and masterfiles
66
- - Will remove non existing masterfiles or masterfiles that start with a '_'
67
- - No masterfiles / scenarios will be added if their path match with oXygens hidden directory patterns
1
+ # tangelo-configuration-toolkit
2
+
3
+ Tangelo Configuration Toolkit is a command-line toolkit which offers support for developing a Tangelo configuration.
4
+
5
+ ## Installation
6
+
7
+ The toolkit requires [NPM](https://www.npmjs.com/get-npm) on [Node.js®](https://nodejs.org/) (at least version 18.x). An active or maintenance LTS release is recommended. After installing Node.js, you can install the latest version of the Tangelo Configuration Toolkit globally on your system using the following command:
8
+
9
+ npm i -g @tangelo/tangelo-configuration-toolkit
10
+
11
+ ## Usage
12
+
13
+ Get help for the available commands and see version:
14
+
15
+ tangelo-configuration-toolkit
16
+
17
+ Get help for a specific command, detailing all its arguments:
18
+
19
+ tangelo-configuration-toolkit <command>
20
+
21
+ Use the `tct` shorthand instead of `tangelo-configuration-toolkit`:
22
+
23
+ tct <command>
24
+
25
+ ## Config
26
+
27
+ ### Global
28
+
29
+ The `deploy` command requires server connection information. So you'll have to create a configuration file named `tangelo-configuration-toolkit-appconfig.json` in which such information can be stored. This file will be searched for in an ancestor directory of the current working directory.
30
+
31
+ The contents looks like this (all properties are optional):
32
+
33
+ {
34
+ "sharedConfigPath": "absolute/or/relative/path/to/folder/containing/shared/config",
35
+ "servers": [{
36
+ "config": {
37
+ "port": 22,
38
+ "parallel": 4,
39
+ "username": "username",
40
+ "remotedir": "/absolute/path/to/tangelo/config/folder/on/server"
41
+ },
42
+ "domains": ["domain.name.com"],
43
+ "name": "name-for-local-deploy"
44
+ }],
45
+ "serverDefaults": {
46
+ "config": {
47
+ ...
48
+ }
49
+ }
50
+ "defaultServer": "can be set to the name of e.g. your favorite dev server",
51
+ "defaultDatabase": "can be set to the tnsname of e.g. your favorite dev server"
52
+ }
53
+
54
+ When passing a server name, `tct` will look for a full match with a name or a partial match (the start) with a domain.
55
+
56
+ ### Repo
57
+
58
+ The `build` and `sql` commands make use of a configuration file in the repository named `tangelo-configuration-toolkit-repoconfig.json`. This contains information about the customer projects.
59
+
60
+ For a new repository, using `tct build --init` also creates the repoconfig-file. For existing projects not having the repoconfig-file, you can use `tct build --config` to generate it.
61
+
62
+ ### oXygen
63
+
64
+ The `build -x` commands set projects transformation scenarios and masterfiles in the oXygen project file with the following functionality:
65
+ - Will try to preserve manually added entries in the transformation scenarios and masterfiles
66
+ - Will remove non existing masterfiles or masterfiles that start with a '_'
67
+ - No masterfiles / scenarios will be added if their path match with oXygens hidden directory patterns
package/bin/index.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
-
1
+ #!/usr/bin/env node
2
+
3
3
  require('..');
package/index.js CHANGED
@@ -30,23 +30,23 @@ global._info = (msg, time = false) => {
30
30
  console.log(msg.lgreen);
31
31
  };
32
32
 
33
- global._warn = (msg) => {
33
+ global._warn = msg => {
34
34
  console.log(msg.lyellow);
35
35
  };
36
36
 
37
- global._error = (msg) => {
37
+ global._error = msg => {
38
38
  console.log(msg.red, '\n');
39
39
  process.exit();
40
40
  };
41
41
 
42
- global._perf = (t1) => {
42
+ global._perf = t1 => {
43
43
  const t2 = new Date();
44
44
  console.log(`\nExecution time: ${t2 - t1}ms`.blue);
45
45
  };
46
46
 
47
- global._formatDate = (date) => {
48
- return date.toLocaleDateString('en-gb', {day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit'});
49
- };
47
+ global._formatDate = date =>
48
+ date?.toLocaleDateString('en-gb', {day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit'});
49
+ ;
50
50
 
51
51
  global._paths = {
52
52
  app: __dirname,
@@ -61,7 +61,7 @@ _paths.apply = process.cwd().replace(_paths.repo, '').substr(1);
61
61
 
62
62
 
63
63
  global._appdata = fs.readJsonSync(_paths.appdata, {throws: false}) || {};
64
- _appdata._update = (data) => Object.assign(_appdata, data, {_changed: true});
64
+ _appdata._update = data => Object.assign(_appdata, data, {_changed: true});
65
65
  if (!_appdata.npmPath) {
66
66
  _appdata._update({npmPath: execSync('npm config get prefix', {encoding: 'UTF-8'}).replace(/\s$/, '')});
67
67
  }
@@ -112,7 +112,7 @@ global._git = {
112
112
 
113
113
 
114
114
  if (_git.commitTdi.after(_git.commitTdi.stopUsingRepoconfigFile)) {
115
- global._repoconfig = require('./src/lib/get-repoconfig')();
115
+ global._repoconfig = require('./src/lib/get-repoconfig')(_paths.repo);
116
116
  }
117
117
  else {
118
118
  try { global._repoconfig = fs.existsSync(_paths.repoconfig) && fs.readJsonSync(_paths.repoconfig) || {}; }
@@ -124,9 +124,34 @@ else {
124
124
  }
125
125
 
126
126
 
127
- global._tdiSubmoduleExists = fs.existsSync(path.join(_paths.repo, _paths.tdi));
128
- global._isPre42 = fs.existsSync(path.join(_paths.repo, _paths.tdi, 'create_new_project')); // folder changed in 4.2
129
- 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)
127
+ global._tdiSubmoduleExists = () => fs.existsSync(path.join(_paths.repo, _paths.tdi));
128
+ global._isPre42 = () => fs.existsSync(path.join(_paths.repo, _paths.tdi, 'create_new_project')); // folder changed in 4.2
129
+ 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)
130
+
131
+ global._modulesTdi = {
132
+ absolutePathTdi: path.join(_paths.repo, _paths.tdi),
133
+ ensureDepsUpToDate() {
134
+ if (this.depsUpToDate) return;
135
+ try {
136
+ _info('Checking installed dependencies in submodule');
137
+ execSync('npm list', {cwd: this.absolutePathTdi, stdio: 'ignore'});
138
+ } catch (e) {
139
+ _info('Updating dependencies in submodule');
140
+ execSync('npm update', {cwd: this.absolutePathTdi, stdio: 'ignore'});
141
+ }
142
+ this.depsUpToDate = true;
143
+ },
144
+ require(module) {
145
+ this.ensureDepsUpToDate();
146
+ _info(`Loading ${path.join(_paths.tdi, 'tct', module)}\n`);
147
+ try {
148
+ return require(path.join(this.absolutePathTdi, 'tct', module));
149
+ }
150
+ catch (e) {
151
+ _error('Module could not be loaded');
152
+ }
153
+ }
154
+ };
130
155
 
131
156
 
132
157
  process.on('beforeExit', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangelo/tangelo-configuration-toolkit",
3
- "version": "1.14.3",
3
+ "version": "1.15.1",
4
4
  "engines": {
5
5
  "node": ">=14.0.0"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "del": "^6.0.0",
29
29
  "event-stream": "^4.0.1",
30
30
  "find-up": "^5.0.0",
31
- "fs-extra": "^10.0.0",
31
+ "fs-extra": "^11.1.1",
32
32
  "globby": "^6.1.0",
33
33
  "gulp": "^4.0.2",
34
34
  "gulp-babel": "^8.0.0",
@@ -40,17 +40,17 @@
40
40
  "gulp-sourcemaps": "^3.0.0",
41
41
  "inquirer": "^8.2.0",
42
42
  "istextorbinary": "^6.0.0",
43
- "minimatch": "^5.0.0",
44
- "node-ssh": "^12.0.2",
43
+ "minimatch": "^8.0.4",
44
+ "node-ssh": "^13.1.0",
45
45
  "object-assign-deep": "^0.4.0",
46
46
  "p-limit": "^3.1.0",
47
47
  "replace-in-file": "^6.3.2",
48
48
  "sass": "^1.43.5",
49
49
  "saxon-js": "^2.3.0",
50
- "ssh2-sftp-client": "^7.2.2",
50
+ "ssh2-sftp-client": "^9.1.0",
51
51
  "through2": "^4.0.2",
52
52
  "tiny-lr": "^2.0.0",
53
- "yargs": "^16.2.0"
53
+ "yargs": "^17.7.2"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",
package/src/cli.js CHANGED
@@ -119,10 +119,9 @@ module.exports = function cli () {
119
119
  ['$0 git --update tdi --branch 5.4', 'Update TDI submodule to latest in specified branch']
120
120
  ])
121
121
  .check((argv, options) => {
122
- const passedOpts = Object.keys(argv).filter(k => !['_', '$0', 'server', 's', 'filter', 'f', 'branch', 'b'].includes(k)); // also filter options with defaults
123
- const hasOpts = Object.keys(options)[0];
124
- if (hasOpts && !passedOpts[0]) yargs.showHelp();
125
- return true;
122
+ const nonDefaultOptions = Object.keys(options.key).filter(o => !Object.keys(options.default).includes(o));
123
+ if (nonDefaultOptions.some(o => argv[o])) return true;
124
+ else throw new Error("Pass a non-default option");
126
125
  })
127
126
  .strict()
128
127
  .wrap(100)
@@ -2,12 +2,12 @@ const fs = require('fs-extra');
2
2
  const globby = require('globby');
3
3
 
4
4
 
5
- module.exports = function getRepoconfig() {
5
+ module.exports = function getRepoconfig(repoPath) {
6
6
 
7
7
  const repoconfig = [];
8
8
 
9
9
  globby
10
- .sync('database/config/**/txd_document_types.sql')
10
+ .sync('database/config/**/txd_document_types.sql', {cwd: repoPath, absolute: true})
11
11
  .forEach(p => {
12
12
  const dtSqlInsert = fs.readFileSync(p).toString().match(/select(.*?)from/s)[1];
13
13
  const ntSqlInsert = fs.readFileSync(p.replace('txd_document_types', 'txd_node_types')).toString().match(/select(.*?)from/s)[1];
@@ -17,7 +17,7 @@ module.exports = function getRepoconfig() {
17
17
  const xpiDir = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)[1];
18
18
 
19
19
  const path_cmscustom = xpiDir.replace(/\/[^/]+$/, '').split(/\//);
20
- const path_dbconfig = p.replace(/database\/config\/(.*)\/[^/]+/, '$1').split(/[/\\]/);
20
+ const path_dbconfig = p.replace(/.*\/database\/config\/(.*)\/[^/]+/, '$1').split(/[/\\]/);
21
21
  const dnRegex = [path_cmscustom[0].replace(/[_'"]/g, '.'), path_dbconfig[0].replace(/[_'"]/g, '.')].sort((a, b) => b.length - a.length).join('|');
22
22
  const customer_name = (dtDisplayName.match(RegExp(dnRegex, 'i')) || dtDisplayName.split(/ (.+)/))[0];
23
23
 
@@ -1,44 +1,44 @@
1
- const execGitCommand = require('./exec-git-command');
2
- const path = require('path');
3
-
4
- module.exports = function getTdiBranch(toBranchName) {
5
- const tdiBranch = {};
6
- // Fetch all
7
- _info(`Fetch TDI submodule`);
8
- const cmdFetch = execGitCommand('fetch -pf --all', path.join(_paths.repo, _paths.tdi));
9
- if (cmdFetch.error) _warn(`Fetch failed\n${cmdFetch.error}`);
10
-
11
- let toBranch;
12
- if (toBranchName) {
13
- // Check if specified branch exists; we will update to this branch
14
- toBranch = String(toBranchName).replace(/(?:release\/)?(\d+(?:\.[\dxt]+)*)/, `release/$1`);
15
- const branchExists = execGitCommand(`branch --remote`, path.join(_paths.repo, _paths.tdi)).match(`origin/${toBranch}`);
16
- if (!branchExists) _error(`TDI branch "${toBranch}" does not exist. Note that TCT can only update to a release branch.`);
17
- }
18
-
19
- // Get remote release branches containing TDI HEAD commit
20
- const releaseBranches = execGitCommand(`branch --all --contains ${_git.commitTdi.local().hash}`, path.join(_paths.repo, _paths.tdi)).match(/remotes\/origin\/release\/[^\s]+/gsm);
21
- if (!releaseBranches || releaseBranches.error) _error(`Could not retrieve TDI release branches`);
22
-
23
- // Get the first possible branch; prefer release/5.1 over release/5.2:
24
- releaseBranches.sort((a, b) => a > b ? 1 : -1);
25
-
26
- // Set branch name of firstBranch without 'remotes/origin/'
27
- tdiBranch.name = releaseBranches[0].replace(/remotes\/origin\//g, '');
28
-
29
- // In case of branch switch set from.name to the old branch and name to the new branch
30
- if (toBranch) {
31
- if (tdiBranch.name > toBranch) _error(`You cannot downgrade to a lower release branch with TCT.`);
32
- tdiBranch.from = {name: tdiBranch.name};
33
- tdiBranch.name = toBranch;
34
-
35
- const branchHash = execGitCommand(`rev-parse origin/${toBranch}`, path.join(_paths.repo, _paths.tdi));
36
- const commonAncestorHash = execGitCommand(`merge-base ${_git.commitTdi.local().hash} ${branchHash}`, path.join(_paths.repo, _paths.tdi));
37
- const commonAncestorDate = execGitCommand(`show ${commonAncestorHash} --no-patch --format=%cd --date=iso-strict `, path.join(_paths.repo, _paths.tdi), ['date']).date;
38
- tdiBranch.commonAncestor = {date: new Date(commonAncestorDate)};
39
- }
40
-
41
- // Get number of commits behind
42
- tdiBranch.commitsBehind = execGitCommand(`rev-list HEAD...origin/${tdiBranch.name} --count`, path.join(_paths.repo, _paths.tdi));
43
- return tdiBranch;
1
+ const execGitCommand = require('./exec-git-command');
2
+ const path = require('path');
3
+
4
+ module.exports = function getTdiBranch(toBranchName) {
5
+ const tdiBranch = {};
6
+ // Fetch all
7
+ _info(`Fetch TDI submodule`);
8
+ const cmdFetch = execGitCommand('fetch -pf --all', path.join(_paths.repo, _paths.tdi));
9
+ if (cmdFetch.error) _warn(`Fetch failed\n${cmdFetch.error}`);
10
+
11
+ let toBranch;
12
+ if (toBranchName) {
13
+ // Check if specified branch exists; we will update to this branch
14
+ toBranch = String(toBranchName).replace(/(?:release\/)?(\d+(?:\.[\dxt]+)*)/, `release/$1`);
15
+ const branchExists = execGitCommand(`branch --remote`, path.join(_paths.repo, _paths.tdi)).match(`origin/${toBranch}`);
16
+ if (!branchExists) _error(`TDI branch "${toBranch}" does not exist. Note that TCT can only update to a release branch.`);
17
+ }
18
+
19
+ // Get remote release branches containing TDI HEAD commit
20
+ const releaseBranches = execGitCommand(`branch --all --contains ${_git.commitTdi.local().hash}`, path.join(_paths.repo, _paths.tdi)).match(/remotes\/origin\/release\/[^\s]+/gsm);
21
+ if (!releaseBranches || releaseBranches.error) _error(`Could not retrieve TDI release branches`);
22
+
23
+ // Get the first possible branch; prefer release/5.1 over release/5.2:
24
+ releaseBranches.sort((a, b) => a > b ? 1 : -1);
25
+
26
+ // Set branch name of firstBranch without 'remotes/origin/'
27
+ tdiBranch.name = releaseBranches[0].replace(/remotes\/origin\//g, '');
28
+
29
+ // In case of branch switch set from.name to the old branch and name to the new branch
30
+ if (toBranch) {
31
+ if (tdiBranch.name > toBranch) _error(`You cannot downgrade to a lower release branch with TCT.`);
32
+ tdiBranch.from = {name: tdiBranch.name};
33
+ tdiBranch.name = toBranch;
34
+
35
+ const branchHash = execGitCommand(`rev-parse origin/${toBranch}`, path.join(_paths.repo, _paths.tdi));
36
+ const commonAncestorHash = execGitCommand(`merge-base ${_git.commitTdi.local().hash} ${branchHash}`, path.join(_paths.repo, _paths.tdi));
37
+ const commonAncestorDate = execGitCommand(`show ${commonAncestorHash} --no-patch --format=%cd --date=iso-strict `, path.join(_paths.repo, _paths.tdi), ['date']).date;
38
+ tdiBranch.commonAncestor = {date: new Date(commonAncestorDate)};
39
+ }
40
+
41
+ // Get number of commits behind
42
+ tdiBranch.commitsBehind = execGitCommand(`rev-list HEAD...origin/${tdiBranch.name} --count`, path.join(_paths.repo, _paths.tdi));
43
+ return tdiBranch;
44
44
  };
@@ -1,19 +1,19 @@
1
- // based on gulp-batch-replace
2
-
3
- const es = require('event-stream'), minimatch = require('minimatch'), istextorbinary = require('istextorbinary');
4
-
5
- const execReplace = (c, s, r) => Buffer.from(s instanceof RegExp ? String(c).replace(s, r) : String(c).split(s).join(r));
6
-
7
- module.exports = (arr) => {
8
- return es.map((file, callback) => {
9
- if(file.contents instanceof Buffer) {
10
- arr.forEach(e => {
11
- // exec if no glob is passed or if glob matches, and it's a text file
12
- if ((!e[2] || minimatch(file.path, e[2])) && istextorbinary.isText(file.path, file)) {
13
- file.contents = execReplace(file.contents, e[0], e[1]);
14
- }
15
- });
16
- }
17
- callback(null, file);
18
- });
19
- };
1
+ // based on gulp-batch-replace
2
+
3
+ const es = require('event-stream'), minimatch = require('minimatch'), istextorbinary = require('istextorbinary');
4
+
5
+ const execReplace = (c, s, r) => Buffer.from(s instanceof RegExp ? String(c).replace(s, r) : String(c).split(s).join(r));
6
+
7
+ module.exports = (arr) => {
8
+ return es.map((file, callback) => {
9
+ if(file.contents instanceof Buffer) {
10
+ arr.forEach(e => {
11
+ // exec if no glob is passed or if glob matches, and it's a text file
12
+ if ((!e[2] || minimatch(file.path, e[2])) && istextorbinary.isText(file.path, file)) {
13
+ file.contents = execReplace(file.contents, e[0], e[1]);
14
+ }
15
+ });
16
+ }
17
+ callback(null, file);
18
+ });
19
+ };
@@ -1,11 +1,11 @@
1
- // replacement for the official (but deprecated) gulp-simple-rename
2
- // kept same name because of usage in tdi
3
-
4
- const through2 = require('through2');
5
-
6
- module.exports = (fn) => {
7
- return through2.obj((file, enc, cb) => {
8
- file.path = fn(file.path);
9
- cb(null, file);
10
- });
11
- };
1
+ // replacement for the official (but deprecated) gulp-simple-rename
2
+ // kept same name because of usage in tdi
3
+
4
+ const through2 = require('through2');
5
+
6
+ module.exports = (fn) => {
7
+ return through2.obj((file, enc, cb) => {
8
+ file.path = fn(file.path);
9
+ cb(null, file);
10
+ });
11
+ };
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-control-regex */
2
+
1
3
  const styles = {bold: 1, underline: 4, black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37, lblack: 90, lred: 91, lgreen: 92, lyellow: 93, lblue: 94, lmagenta: 95, lcyan: 96, lwhite: 97};
2
4
 
3
5
  for (const name in styles ) {
@@ -17,7 +17,7 @@ const createSymlink = (t, p) => {
17
17
 
18
18
  const createSymlinks = () => {
19
19
  _info('Creating symlinks:');
20
- const src = _isPre51 ? 'sources' : 'src';
20
+ const src = _isPre51() ? 'sources' : 'src';
21
21
  createSymlink(src + '/config/cmscustom/tdi', 'config/cmscustom/tdi');
22
22
  globby
23
23
  .sync('config/cmscustom/!(tdi)/**/fonto')
@@ -30,15 +30,15 @@ const createSymlinks = () => {
30
30
  module.exports = function build (argv) {
31
31
 
32
32
  if (argv.init) {
33
- if (_isPre51) _error('This option only works when using branch release/5.1 and up.');
33
+ if (_isPre51()) _error('This option only works when using branch release/5.1 and up.');
34
34
 
35
- require(path.join(_paths.repo, _paths.tdi, 'tct/build/init'))(createSymlinks);
35
+ _modulesTdi.require('build/init')(createSymlinks);
36
36
  }
37
37
 
38
38
  if (argv.project) {
39
- if (_isPre51) _error('This option only works when using branch release/5.1 and up.');
39
+ if (_isPre51()) _error('This option only works when using branch release/5.1 and up.');
40
40
 
41
- const {projectNew, projectCopy} = require(path.join(_paths.repo, _paths.tdi, 'tct/build/project'));
41
+ const {projectNew, projectCopy} = _modulesTdi.require('build/project');
42
42
 
43
43
  inquirer
44
44
  .prompt([{