@tangelo/tangelo-configuration-toolkit 1.22.1 → 1.23.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangelo/tangelo-configuration-toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.0.0"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"gulp-filter": "^7.0.0",
|
|
37
37
|
"gulp-plumber": "^1.2.1",
|
|
38
38
|
"gulp-print": "^5.0.2",
|
|
39
|
-
"gulp-sass": "^
|
|
39
|
+
"gulp-sass": "^6.0.0",
|
|
40
40
|
"gulp-sourcemaps": "^3.0.0",
|
|
41
41
|
"inquirer": "^8.2.0",
|
|
42
42
|
"istextorbinary": "^6.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"object-assign-deep": "^0.4.0",
|
|
46
46
|
"p-limit": "^3.1.0",
|
|
47
47
|
"replace-in-file": "^6.3.2",
|
|
48
|
-
"sass": "^1.
|
|
48
|
+
"sass": "^1.79.0",
|
|
49
49
|
"saxon-js": "^2.5.0",
|
|
50
50
|
"ssh2-sftp-client": "^9.1.0",
|
|
51
51
|
"through2": "^4.0.2",
|
package/src/cli.js
CHANGED
|
@@ -34,7 +34,8 @@ module.exports = function cli () {
|
|
|
34
34
|
init: {alias: 'i', desc: 'Create repository content structure', conflicts: ['p', 's', 'c']},
|
|
35
35
|
project: {alias: 'p', desc: 'Create project configuration', conflicts: ['i', 's', 'c']},
|
|
36
36
|
symlinks: {alias: 's', desc: 'Recreate symlinks to TDI', conflicts: ['p', 'i', 'c']},
|
|
37
|
-
oxygen: {alias: 'x', desc: 'Create or update oXygen project file (.xpr)', conflicts: ['p', 'i', 'c']}
|
|
37
|
+
oxygen: {alias: 'x', desc: 'Create or update oXygen project file (.xpr)', conflicts: ['p', 'i', 'c']},
|
|
38
|
+
file: {alias: 'f', desc: '[hidden] Use preset answers from appconfig', requiresArg: true, hidden: !_devmode}
|
|
38
39
|
},
|
|
39
40
|
handler: require('./modules/build')
|
|
40
41
|
})
|
|
@@ -7,8 +7,8 @@ module.exports = function getRepoconfig(repoPath) {
|
|
|
7
7
|
return globby
|
|
8
8
|
.sync('database/config/**/txd_document_types.sql', {cwd: repoPath, absolute: true})
|
|
9
9
|
.map(p => {
|
|
10
|
-
const dtSqlInsert = fs.readFileSync(p).toString().match(/select(.*?)from/s)[1];
|
|
11
|
-
const ntSqlInsert = fs.readFileSync(p.replace('txd_document_types', 'txd_node_types')).toString().match(/select(.*?)from/s)[1];
|
|
10
|
+
const dtSqlInsert = fs.readFileSync(p).toString().match(/select(.*?)from(?=\s+dual)/s)[1];
|
|
11
|
+
const ntSqlInsert = fs.readFileSync(p.replace('txd_document_types', 'txd_node_types')).toString().match(/select(.*?)from(?=\s+dual)/s)[1];
|
|
12
12
|
|
|
13
13
|
const dtDisplayName = dtSqlInsert.match(/'([^']+)' display_name/)[1];
|
|
14
14
|
const ntName = ntSqlInsert.match(/'([^']+)' name/)[1];
|
package/src/lib/tcl-config.js
CHANGED
|
@@ -3,7 +3,7 @@ const globby = require('globby');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const sass = require('sass');
|
|
5
5
|
const SaxonJS = require('saxon-js');
|
|
6
|
-
|
|
6
|
+
const url = require('url');
|
|
7
7
|
|
|
8
8
|
module.exports = class TclConfig {
|
|
9
9
|
|
|
@@ -37,8 +37,8 @@ module.exports = class TclConfig {
|
|
|
37
37
|
static #transformJsonToCss(tclFilePathRel, json, moduleName) {
|
|
38
38
|
this.#jsonToScssFile ??= _modulesTdi.require(this.#JSON_TO_SCSS_FILE_PATH, {message: false});
|
|
39
39
|
const scss = this.#jsonToScssFile(json.project, moduleName);
|
|
40
|
-
const
|
|
41
|
-
return sass.compileString(scss, {url, style: 'compressed'}).css;
|
|
40
|
+
const fileUrl = url.pathToFileURL(tclFilePathRel);
|
|
41
|
+
return sass.compileString(scss, {url: fileUrl, style: 'compressed'}).css;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
static #addCssImportToHtml(dir) {
|
|
@@ -37,13 +37,13 @@ module.exports = function build (argv) {
|
|
|
37
37
|
|
|
38
38
|
if ((argv.init || argv.project) && _isPre51()) _error('This option only works when using branch release/5.1 and up.');
|
|
39
39
|
|
|
40
|
-
const predefinedAnswers =
|
|
40
|
+
const predefinedAnswers = argv.file ? _appconfig.build?.[argv.file] : undefined;
|
|
41
41
|
// if not chosen to use predefined values by passing "file", erase the "build" property for old TDI commits
|
|
42
42
|
_appconfig.build = predefinedAnswers;
|
|
43
43
|
|
|
44
44
|
if (argv.init) _modulesTdi.require('build/init')(createSymlinks, predefinedAnswers);
|
|
45
45
|
|
|
46
|
-
if (argv.project
|
|
46
|
+
if (argv.project && argv.file) _modulesTdi.require('build/project').projectNew(createSymlinks, _repoconfig[0], predefinedAnswers);
|
|
47
47
|
else if (argv.project) {
|
|
48
48
|
inquirer
|
|
49
49
|
.prompt([{
|
|
@@ -51,8 +51,8 @@ function setServer (searchString) {
|
|
|
51
51
|
if (!(port && parallel && username)) _error('Config is incomplete!');
|
|
52
52
|
this.server.ftpConfig = {
|
|
53
53
|
host, port, parallel, username,
|
|
54
|
-
agent: process.platform === 'win32' ? '
|
|
55
|
-
agentForward:
|
|
54
|
+
agent: process.env.SSH_AUTH_SOCK ?? process.platform === 'win32' ? '\\\\.\\pipe\\openssh-ssh-agent' : undefined,
|
|
55
|
+
agentForward: true,
|
|
56
56
|
readyTimeout: 15000,
|
|
57
57
|
retries: 1
|
|
58
58
|
};
|
|
@@ -10,7 +10,7 @@ const c = require('./config');
|
|
|
10
10
|
const s = require('./srcset');
|
|
11
11
|
const inquirer = require('inquirer');
|
|
12
12
|
|
|
13
|
-
const checkDeployment = async
|
|
13
|
+
const checkDeployment = async ftpConfig => {
|
|
14
14
|
const deployToDevServer = /\.dev\./.test( ftpConfig?.host );
|
|
15
15
|
const deployToTestServer = /\.t(e)?st\./.test( ftpConfig?.host );
|
|
16
16
|
const deployToProdServer = c?.deliveryPack || !( deployToDevServer || deployToTestServer );
|
|
@@ -39,7 +39,7 @@ const checkDeployment = async (ftpConfig) => {
|
|
|
39
39
|
_error(`You're not deploying from the most recent commit in branch "${_git.commitLocal().branch}"! Update your repository: ${'tct git --update-repo'.cyan}`);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// Ask for continuation of deployment for production
|
|
42
|
+
// Ask for continuation of deployment for production environments only; and only if not deploying from a prd branch or when there exist uncommitted changes
|
|
43
43
|
if ( (!isPrdBranch || _git.hasUncommittedFiles()) && deployToProdServer &&
|
|
44
44
|
!( await inquirer.prompt(
|
|
45
45
|
{type: 'confirm', message: 'Are you sure you want to continue?', name: 'confirm', default: false}
|
|
@@ -58,9 +58,10 @@ module.exports = async function deploy (argv) {
|
|
|
58
58
|
c.prepareForCopy(argv.filter);
|
|
59
59
|
const {ftpConfig, remotedir} = c.server;
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (!argv.test && ftpConfig) { // only perform deployment checks when actually transferring to remote server
|
|
62
|
+
const deploy = await checkDeployment(ftpConfig);
|
|
63
|
+
if (deploy?.cancel) return;
|
|
64
|
+
}
|
|
64
65
|
|
|
65
66
|
if (ftpConfig) {
|
|
66
67
|
const logPath = path.join(remotedir, 'log/deployments.log').toFws;
|
|
@@ -68,7 +69,7 @@ module.exports = async function deploy (argv) {
|
|
|
68
69
|
|
|
69
70
|
ftpConfig.eventPut = file => {
|
|
70
71
|
_write(file.destination.replace(remotedir, ''));
|
|
71
|
-
if (path.extname(file.destination)
|
|
72
|
+
if (path.extname(file.destination)==='.sh')
|
|
72
73
|
re.add('chmod 755 '+file.destination, 'Permissions set: '+file.destination);
|
|
73
74
|
else if (file.destination.match(/cmscustom.*hce.*config.xml/))
|
|
74
75
|
re.add('touch '+c.getRemotePath('hce/hce-config.xml'), 'Touched: '+c.getRemotePath('hce/hce-config.xml'));
|
|
@@ -134,7 +135,7 @@ module.exports = async function deploy (argv) {
|
|
|
134
135
|
gulp.watch(c.transferPatterns)
|
|
135
136
|
.on('all', (event, filepath) => {
|
|
136
137
|
|
|
137
|
-
if ((event
|
|
138
|
+
if ((event==='add' || event==='change') && (
|
|
138
139
|
// within fonto, transfer build files only, but also schema files, because
|
|
139
140
|
// the "dist" folder isn't watched properly: it does not detect "assets" anymore after building once
|
|
140
141
|
!/cmscustom.+fonto[\\/]/.test(filepath) ||
|
|
@@ -146,7 +147,7 @@ module.exports = async function deploy (argv) {
|
|
|
146
147
|
transfers.add(filepath);
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
else if (event
|
|
150
|
+
else if (event==='unlink' && !/fonto/.test(filepath)) { // ignore fonto files
|
|
150
151
|
s.removeFromCache(filepath);
|
|
151
152
|
|
|
152
153
|
if (!path.parse(filepath).base.match(/\.scss/)) {
|
|
@@ -171,14 +172,14 @@ function deployLogInfo (watch, filter, files, action) {
|
|
|
171
172
|
|
|
172
173
|
let logline = `${timestamp} ${action.padEnd(5)} [${user}] [${branch}:${hash.substring(0, 7)}${uncommittedChanges}] [${filter}]`;
|
|
173
174
|
|
|
174
|
-
if (action
|
|
175
|
+
if (action === 'START') {
|
|
175
176
|
if (uncommittedChanges) {
|
|
176
177
|
const uncommittedChanges = _git.status().replace(/\?\?/g, ' U').split('\n');
|
|
177
178
|
logline += '\n Uncommitted changes:\n ' + uncommittedChanges.join('\n ');
|
|
178
179
|
}
|
|
179
180
|
const filepaths = files.map(({destination}) => destination);
|
|
180
181
|
logline += `\n Transferring ${filepaths.length} file${filepaths.length > 1 ? 's' : ''}`;
|
|
181
|
-
if (watch || filepaths.length
|
|
182
|
+
if (watch || filepaths.length === 1) logline += ':\n ' + filepaths.join('\n ');
|
|
182
183
|
else logline += ' in dir:\n ' + getCommonPath(filepaths);
|
|
183
184
|
}
|
|
184
185
|
return logline.replace(/"/g, '\\"');
|
package/src/modules/git/index.js
CHANGED
|
@@ -194,6 +194,7 @@ function updateSubmodule({dates = [], updateSubmodule: releaseBranchName}) {
|
|
|
194
194
|
// update submodule
|
|
195
195
|
const updateSubmoduleMsg = execGitCommand(`submodule update --remote`, _paths.repo);
|
|
196
196
|
if (updateSubmoduleMsg.error) _error(`Update submodule failed\n${updateSubmoduleMsg.error}`);
|
|
197
|
+
execGitCommand(`add tangelo-default-implementation`, _paths.repo);
|
|
197
198
|
_info(`TDI submodule updated:\n${updateSubmoduleMsg}\n`);
|
|
198
199
|
}
|
|
199
200
|
|