@tangelo/tangelo-configuration-toolkit 1.13.0 → 1.14.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/.eslintrc.js +1 -0
- package/LICENSE.md +1 -1
- package/README.md +67 -67
- package/bin/index.js +2 -2
- package/bitbucket-pipelines.yml +32 -0
- package/index.js +4 -1
- package/package.json +4 -1
- package/src/cli.js +10 -5
- package/src/lib/exec-git-command.js +4 -3
- package/src/lib/get-repoconfig.js +1 -1
- package/src/lib/get-tdi-branch.js +46 -0
- package/src/lib/gulp-batch-replace-with-filter.js +19 -19
- package/src/lib/gulp-resolve-includes.js +3 -2
- package/src/lib/gulp-simple-rename.js +11 -11
- package/src/lib/package-update-check.js +15 -14
- package/src/lib/style-string-getters.js +1 -1
- package/src/modules/build/index.js +1 -1
- package/src/modules/build/oxygen.js +167 -167
- package/src/modules/deploy/config.js +1 -1
- package/src/modules/deploy/execute.js +5 -5
- package/src/modules/deploy/index.js +1 -1
- package/src/modules/fonto/commands.js +41 -41
- package/src/modules/fonto/index.js +22 -22
- package/src/modules/git/index.js +96 -1
- package/src/modules/info/index.js +201 -202
- package/src/modules/migrate/index.js +1 -1
- package/src/modules/migrate/steps.js +4 -2
- package/src/modules/sql/index.js +2 -2
package/src/modules/git/index.js
CHANGED
|
@@ -2,7 +2,10 @@ const {execSync, spawn} = require('child_process');
|
|
|
2
2
|
const {chdir} = require('process');
|
|
3
3
|
const inquirer = require('inquirer');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const fs = require('fs-extra');
|
|
5
6
|
|
|
7
|
+
const execGitCommand = require('../../lib/exec-git-command');
|
|
8
|
+
const getTdiBranch = require('../../lib/get-tdi-branch');
|
|
6
9
|
|
|
7
10
|
const cmdExec = commands => new Promise(resolve => {
|
|
8
11
|
let promise = new Promise(resolve => resolve());
|
|
@@ -21,7 +24,7 @@ const cmdExec = commands => new Promise(resolve => {
|
|
|
21
24
|
cp.stdout.on('data', log);
|
|
22
25
|
cp.stderr.setEncoding('utf8');
|
|
23
26
|
cp.stderr.on('data', log);
|
|
24
|
-
cp.on('close',
|
|
27
|
+
cp.on('close', () => {
|
|
25
28
|
if (!a[i+1] || a[i+1][1]) _write();
|
|
26
29
|
resolve();
|
|
27
30
|
});
|
|
@@ -33,6 +36,8 @@ const cmdExec = commands => new Promise(resolve => {
|
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
|
|
39
|
+
const tdiMigrationFilePath = path.join(_paths.repo, _paths.tdi, 'tct/git/tdiCommitsRequiringMigration.js');
|
|
40
|
+
|
|
36
41
|
module.exports = function git (argv) {
|
|
37
42
|
|
|
38
43
|
if (argv.init) {
|
|
@@ -112,4 +117,94 @@ module.exports = function git (argv) {
|
|
|
112
117
|
throw e;
|
|
113
118
|
});
|
|
114
119
|
}
|
|
120
|
+
|
|
121
|
+
if (argv.update) {
|
|
122
|
+
const [update, tdiFromDateCustom, tdiToDateCustom] = `${argv.update}`.split(/\s/);
|
|
123
|
+
|
|
124
|
+
if (update === `tdi`) {
|
|
125
|
+
|
|
126
|
+
const tdiBranch = getTdiBranch(argv.branch);
|
|
127
|
+
const tdiBranchUpgrade = tdiBranch.from ? (tdiBranch.from.name < tdiBranch.name) : false;
|
|
128
|
+
|
|
129
|
+
if (tdiBranchUpgrade) _info(`Current branch '${tdiBranch.from.name}' will be updated to '${tdiBranch.name}'\nCommon ancestor will be used in selecting TDI commits requiring migration: ${_formatDate(tdiBranch.commonAncestor.date)}`);
|
|
130
|
+
_info(`Branch ${tdiBranch.name} is ${tdiBranch.commitsBehind} commits behind.`);
|
|
131
|
+
|
|
132
|
+
// Set branch in .gitmodules file; This ensures submodule update will follow this branch to the latest commit
|
|
133
|
+
const setBranch = execGitCommand(`submodule set-branch -b ${tdiBranch.name} tangelo-default-implementation`, _paths.repo);
|
|
134
|
+
if (setBranch.error) _error(`Set branch failed: ${setBranch.error}`);
|
|
135
|
+
|
|
136
|
+
if (tdiBranch.commitsBehind > 0 || tdiFromDateCustom) {
|
|
137
|
+
// update submodule
|
|
138
|
+
const updateSubmoduleMsg = execGitCommand(`submodule update --remote`, _paths.repo);
|
|
139
|
+
if (updateSubmoduleMsg.error && !tdiFromDateCustom) _error(`Update submodule failed\n${updateSubmoduleMsg.error}`);
|
|
140
|
+
|
|
141
|
+
if (!tdiFromDateCustom) _info(`TDI submodule updated:\n${updateSubmoduleMsg}`);
|
|
142
|
+
|
|
143
|
+
// tdiMigrationFilePath should exist in latest commits of releases 5.3+; As we updated to the latest version this should work
|
|
144
|
+
if (fs.existsSync(tdiMigrationFilePath)) {
|
|
145
|
+
const migrations = require(tdiMigrationFilePath);
|
|
146
|
+
const fromTdiDate = tdiFromDateCustom ? new Date(tdiFromDateCustom) : (tdiBranch.commonAncestor) ? tdiBranch.commonAncestor.date: _git.commitTdi.local().date;
|
|
147
|
+
const toTdiDate = tdiToDateCustom ? new Date(tdiToDateCustom) : new Date(execGitCommand(`log -1 --format=%cd --date=iso-strict`, path.join(_paths.repo, _paths.tdi), ['date']).date);
|
|
148
|
+
|
|
149
|
+
_info(`TDI commits requiring migration between ${_formatDate(fromTdiDate)} and ${_formatDate(toTdiDate)}`);
|
|
150
|
+
// Filter the migrations that should be applied/considered; Also display older releases migrations
|
|
151
|
+
const migrationsFiltered = migrations
|
|
152
|
+
.filter((m) => m.releases.find((r) => {
|
|
153
|
+
const time = new Date(r.date).getTime();
|
|
154
|
+
return ((tdiBranchUpgrade)
|
|
155
|
+
? `release/${r.release}` == tdiBranch.name || (tdiBranch.from.name <= `release/${r.release}` && `release/${r.release}` < tdiBranch.name && (fromTdiDate.getTime() < time && time < toTdiDate.getTime()))
|
|
156
|
+
: `release/${r.release}` == tdiBranch.name && (fromTdiDate.getTime() < time && time < toTdiDate.getTime())
|
|
157
|
+
);
|
|
158
|
+
})
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
let relevantMigrationCount = 0;
|
|
162
|
+
// Apply callback for migrations
|
|
163
|
+
migrationsFiltered
|
|
164
|
+
.forEach((m) => {
|
|
165
|
+
const date = _formatDate(new Date(m.releases.filter((r) => tdiBranch.name >= `release/${r.release}`)[0].date));
|
|
166
|
+
relevantMigrationCount += (m.callback(date, relevantMigrationCount+1)) === 1 ? 1 : 0;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Output message based on whether or not migrations are required
|
|
170
|
+
if (migrationsFiltered.length === 0) {
|
|
171
|
+
_write(`-- No commits require migrations --`);
|
|
172
|
+
} else {
|
|
173
|
+
_info(`\n${relevantMigrationCount} relevant migration(s) out of ${migrationsFiltered.length} migration(s) are shown.`);
|
|
174
|
+
_info(`See confluence page 'TDI commits requiring migration' for more detailed information`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
} else {
|
|
178
|
+
_error(`Cannot find required files in TDI submodule.`);
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
_info(`Your TDI submodule is already up to date`);
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
if (argv.branch) _warn(`Branch argument '${argv.branch}' is ignored for a repository update.`);
|
|
185
|
+
|
|
186
|
+
// Fetch all
|
|
187
|
+
_info(`Fetch all`);
|
|
188
|
+
const cmdFetch = execGitCommand('fetch -pf --all', path.join(_paths.repo));
|
|
189
|
+
if (cmdFetch.error) _warn(`Fetch failed\n${cmdFetch.error}`);
|
|
190
|
+
|
|
191
|
+
// pull repo
|
|
192
|
+
_info(`Pull repository`);
|
|
193
|
+
const cmdPull = execGitCommand(`pull`, _paths.repo);
|
|
194
|
+
if (cmdPull.error) _warn(`Pull failed\n${cmdPull.error}`);
|
|
195
|
+
|
|
196
|
+
_info(`Checked out at commit:`);
|
|
197
|
+
const repoLog = execGitCommand(`log -1 --format=%D;%H;%cd --date=iso-strict`, _paths.repo, ['tags', 'hash', 'date']);
|
|
198
|
+
_write(`${_formatDate(repoLog.date)} - ${repoLog.tags} - ${repoLog.hash}`);
|
|
199
|
+
|
|
200
|
+
_info(`Retrieve submodules that belong to this repo-commit`); // update submodule recursively (set to version that belongs to repo)
|
|
201
|
+
_write(execGitCommand(`submodule update --recursive`, path.join(_paths.repo)));
|
|
202
|
+
_info(`Submodule checked out at commit:`);
|
|
203
|
+
const tdiLog = execGitCommand(`log -1 --format=%D;%H;%cd --date=iso-strict`, path.join(_paths.repo, _paths.tdi), ['tags', 'hash', 'date']);
|
|
204
|
+
_write(`${_formatDate(tdiLog.date)} - ${tdiLog.tags} - ${tdiLog.hash}`);
|
|
205
|
+
const tdiBranch = getTdiBranch();
|
|
206
|
+
|
|
207
|
+
_info(`\nTDI branch ${tdiBranch.name} is ${tdiBranch.commitsBehind} commits behind.\nUpdate TDI to latest version with 'tct g -u tdi'`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
115
210
|
};
|
|
@@ -1,202 +1,201 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const globby = require('globby');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const {Table} = require('console-table-printer');
|
|
5
|
-
|
|
6
|
-
const execGitCommand = require('../../lib/exec-git-command');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{name: '
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{name: '
|
|
65
|
-
{name: '
|
|
66
|
-
{name: '
|
|
67
|
-
|
|
68
|
-
],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{name: '
|
|
163
|
-
{name: '
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
};
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const globby = require('globby');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const {Table} = require('console-table-printer');
|
|
5
|
+
|
|
6
|
+
const execGitCommand = require('../../lib/exec-git-command');
|
|
7
|
+
const getTdiBranch = require('../../lib/get-tdi-branch');
|
|
8
|
+
const c = require('../deploy/config');
|
|
9
|
+
const {remote} = require('../deploy/execute');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const getGitInfo = () => {
|
|
13
|
+
// Version info TDI submodule
|
|
14
|
+
const gitSubmoduleInfo = new Table({
|
|
15
|
+
columns: [
|
|
16
|
+
{name: 'property', title: 'TDI - submodule', alignment: 'left'},
|
|
17
|
+
{name: 'value', alignment: 'left'}
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Fetch all
|
|
22
|
+
const cmdFetch = execGitCommand('fetch -pf --all', path.join(_paths.repo, _paths.tdi));
|
|
23
|
+
if (cmdFetch.error) _warn(`Fetch failed\n${cmdFetch.error}`);
|
|
24
|
+
|
|
25
|
+
// Set branch name of firstBranch without 'remotes/origin/'
|
|
26
|
+
const tdiBranch = getTdiBranch();
|
|
27
|
+
|
|
28
|
+
// Get number of commits behind
|
|
29
|
+
tdiBranch.commitsBehind = execGitCommand(`rev-list HEAD...origin/${tdiBranch.name} --count`, path.join(_paths.repo, _paths.tdi));
|
|
30
|
+
|
|
31
|
+
// Create table rows for TDI submodule info
|
|
32
|
+
gitSubmoduleInfo.addRow({
|
|
33
|
+
property: 'Commit date',
|
|
34
|
+
value: _formatDate(_git.commitTdi.local().date)
|
|
35
|
+
});
|
|
36
|
+
if (tdiBranch) {
|
|
37
|
+
gitSubmoduleInfo.addRow({
|
|
38
|
+
property: 'Branch',
|
|
39
|
+
value: tdiBranch.name
|
|
40
|
+
});
|
|
41
|
+
gitSubmoduleInfo.addRow({
|
|
42
|
+
property: 'Commits behind',
|
|
43
|
+
value: tdiBranch.commitsBehind
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
gitSubmoduleInfo.addRow({
|
|
47
|
+
property: 'Branch could not be determined',
|
|
48
|
+
value: ''
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Print TDI submodule info
|
|
53
|
+
gitSubmoduleInfo.printTable();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getFileExtractInfo = (sorting) => {
|
|
57
|
+
// version info miscellaneous
|
|
58
|
+
const projects = new Set;
|
|
59
|
+
const types = new Set;
|
|
60
|
+
const versionInfoConfigPath = path.join(_paths.repo, _paths.tdi, 'tct/version/versionInfo.js');
|
|
61
|
+
const versionInfo = new Table({
|
|
62
|
+
columns: [
|
|
63
|
+
{name: 'path', alignment: 'left'},
|
|
64
|
+
{name: 'type', alignment: 'left'},
|
|
65
|
+
{name: 'version', alignment: 'left'},
|
|
66
|
+
{name: 'sort'}
|
|
67
|
+
],
|
|
68
|
+
disabledColumns: ['sort'],
|
|
69
|
+
sort: (a, b) => a.sort.toLowerCase() > b.sort.toLowerCase() ? 1 : -1
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (fs.existsSync(versionInfoConfigPath)) {
|
|
73
|
+
const config = require(versionInfoConfigPath);
|
|
74
|
+
|
|
75
|
+
config.forEach(v => {
|
|
76
|
+
const location = path.join(_paths.repo, v.glob);
|
|
77
|
+
|
|
78
|
+
globby
|
|
79
|
+
.sync(location)
|
|
80
|
+
.forEach(f => {
|
|
81
|
+
const filePathExtract = f.match(/.*(?<path>(cmscustom|site-stylesheets)\/(?<customer>[^/]*)\/(?<project>[^/]*)\/.*)/);
|
|
82
|
+
const path = filePathExtract.groups.path || '';
|
|
83
|
+
const project = filePathExtract.groups.project || '';
|
|
84
|
+
|
|
85
|
+
const fileContent = fs.readFileSync(f).toString();
|
|
86
|
+
v.extracts.forEach(e => {
|
|
87
|
+
const extract = fileContent.match(e.regex);
|
|
88
|
+
if (extract) {
|
|
89
|
+
projects.add(project); // Store the projects where versioninfo is found
|
|
90
|
+
types.add(e.type); // Store the types for which versioninfo is found
|
|
91
|
+
versionInfo.addRow({ // Create row with version information to output
|
|
92
|
+
path,
|
|
93
|
+
sort: `${sorting=='project' ? project : e.type}_2${sorting=='project' ? e.type : extract.groups.version}`, // Output is sorted on project or type: '_2' ensures it is rendered after the empty row and the row with the project name
|
|
94
|
+
type: e.type,
|
|
95
|
+
version: extract.groups.version
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (sorting=='project') {
|
|
103
|
+
// For projects containing version information
|
|
104
|
+
projects.forEach(p => {
|
|
105
|
+
versionInfo.addRow({ // Add empty row after project
|
|
106
|
+
path: '',
|
|
107
|
+
sort: `${p}_3`,
|
|
108
|
+
type: '',
|
|
109
|
+
version: ''
|
|
110
|
+
});
|
|
111
|
+
versionInfo.addRow({ // Add row with project name
|
|
112
|
+
path: `-- ${p}:`,
|
|
113
|
+
sort: `${p}_1`,
|
|
114
|
+
type: '',
|
|
115
|
+
version: ''
|
|
116
|
+
}, {
|
|
117
|
+
color: 'yellow'
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else if (sorting=='type') {
|
|
122
|
+
types.forEach(t => {
|
|
123
|
+
versionInfo.addRow({ // Add empty row after type
|
|
124
|
+
path: '',
|
|
125
|
+
sort: `${t}_3`,
|
|
126
|
+
type: '',
|
|
127
|
+
version: ''
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
versionInfo.printTable();
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
_warn('Version info of miscellaneous items cannot be extracted:\nCannot find required files in TDI submodule. Try updating TDI submodule.');
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const getServerInfo = (server) => {
|
|
139
|
+
// Remote server info
|
|
140
|
+
// common setup
|
|
141
|
+
_write();
|
|
142
|
+
c.setServer(server);
|
|
143
|
+
|
|
144
|
+
if (!c.envDev) {
|
|
145
|
+
_info(`Remote version info for '${c.server.ftpConfig.host}':\n`);
|
|
146
|
+
remote.add('sudo ~root/scripts/version.sh', '').process();
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
_info('For development environments no server version information is available. Check rancher / database for this information.\nAdd the --server option with a non-dev environment to see version information for that server.');
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
module.exports = function info (argv) {
|
|
155
|
+
|
|
156
|
+
if (argv.doctypes) {
|
|
157
|
+
_info('Document type information for this git repository\n');
|
|
158
|
+
|
|
159
|
+
const doctypesInfo = new Table({
|
|
160
|
+
columns: [
|
|
161
|
+
{name: 'id', alignment: 'right'},
|
|
162
|
+
{name: 'name', alignment: 'left'},
|
|
163
|
+
{name: 'paths', alignment: 'left'}
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
globby
|
|
168
|
+
.sync(_paths.repo + '/database/config/**/txd_document_types.sql')
|
|
169
|
+
.forEach((p, i, a) => {
|
|
170
|
+
fs.readFileSync(p).toString().match(/select([\s\S]+?)from\s+dual/gmi)
|
|
171
|
+
.forEach((dtRow, i, a) => {
|
|
172
|
+
const ntSqlInsert = fs.readFileSync(p.replace('txd_document_types', 'txd_node_types')).toString().match(/select(.*?)from\s+dual/s)[1];
|
|
173
|
+
const id = dtRow.match(/(\d+) id/)?.[1];
|
|
174
|
+
const name = dtRow.match(/'([^']+)' display_name/)?.[1];
|
|
175
|
+
const dbPath = p.match(/(database\/config\/(:?.*)\/)txd_document_types.sql/i)?.[1];
|
|
176
|
+
const prPath = ntSqlInsert.match(/'([^']+)' xsl_prep_inc/)[1].replace('prepare_xincludes.xsl', '');
|
|
177
|
+
|
|
178
|
+
doctypesInfo.addRows([
|
|
179
|
+
{id, name, paths: 'config/cmscustom/'+ prPath},
|
|
180
|
+
{paths: dbPath}
|
|
181
|
+
]);
|
|
182
|
+
|
|
183
|
+
if (i!==a.length-1) doctypesInfo.addRow({});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (i!==a.length-1) doctypesInfo.addRow({});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
doctypesInfo.printTable();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (argv.versions) {
|
|
194
|
+
_info('Version information for this git repository\n');
|
|
195
|
+
|
|
196
|
+
getGitInfo();
|
|
197
|
+
getFileExtractInfo(argv.versions);
|
|
198
|
+
getServerInfo(argv.server);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
};
|
|
@@ -62,7 +62,7 @@ module.exports = function migrate (argv) {
|
|
|
62
62
|
if (p.path_dbconfig.join('/') != p.path_cmscustom.join('/')) projectFolders.push(p.path_cmscustom.join('/'));
|
|
63
63
|
});
|
|
64
64
|
// Set filter to chosen active documents
|
|
65
|
-
filter = projectFolders.length
|
|
65
|
+
filter = projectFolders.length === 1 ? `**/${projectFolders}/**` : `**/{${projectFolders.join(',')}}/**`;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
_info(`Filter applied: ${filter}`);
|
|
@@ -52,9 +52,11 @@ module.exports = function steps (step, dry, filter) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
let filesModCount = 0;
|
|
55
|
-
|
|
55
|
+
let maxRepeat = 20;
|
|
56
|
+
for (let i=0; i<maxRepeat && r.files[0]; i++) { // execute repeatedly for modified files only (with safety limit of 20)
|
|
56
57
|
r.files = rif.sync(r).filter(f => f.hasChanged).map(f => f.file);
|
|
57
|
-
if (i
|
|
58
|
+
if (i===0) filesModCount = r.files.length; // save count only after first run (after this only subsets are processed)
|
|
59
|
+
if (i===maxRepeat-1 && r.files[0]) _warn(`Repeated replacement stopped by safety limit - check file changes for too many content occurrences`);
|
|
58
60
|
if (dry) break;
|
|
59
61
|
}
|
|
60
62
|
|
package/src/modules/sql/index.js
CHANGED
|
@@ -18,9 +18,9 @@ const checkLog = (logFilePath, remove=true) => {
|
|
|
18
18
|
if (fs.existsSync(logFilePath)) {
|
|
19
19
|
const logFile = fs.readFileSync(logFilePath).toString();
|
|
20
20
|
// Check for ORA- error messages
|
|
21
|
-
if (logFile.match(
|
|
21
|
+
if (logFile.match(/ORA-/g)) {
|
|
22
22
|
// Select each ORA- error message and up to 6 lines before (the lines before may not contain ORA- themselves)
|
|
23
|
-
const errors = logFile.match(
|
|
23
|
+
const errors = logFile.match(/(?:(?![^\n]*ORA-)[^\n]*\n){0,6}ORA-[^\n\r]*/gms);
|
|
24
24
|
_info(`${errors.length} error(s) during SQL script:\n`);
|
|
25
25
|
// Print each error + lines before:
|
|
26
26
|
errors.forEach((e, i) => {
|