@tangelo/tangelo-configuration-toolkit 1.11.1 → 1.12.0
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 +46 -0
- package/.pre-commit-config.yaml +36 -0
- package/README.md +66 -66
- package/bin/index.js +2 -2
- package/index.js +26 -13
- package/package.json +1 -1
- package/src/cli.js +111 -111
- package/src/lib/exec-git-command.js +5 -5
- package/src/lib/get-repoconfig.js +23 -23
- package/src/lib/gulp-batch-replace-with-filter.js +19 -19
- package/src/lib/gulp-resolve-includes.js +14 -14
- package/src/lib/gulp-sftp.js +25 -25
- package/src/lib/gulp-simple-rename.js +11 -11
- package/src/lib/package-update-check.js +12 -12
- package/src/lib/style-string-getters.js +2 -2
- package/src/lib/worker-with-spinner.js +3 -3
- package/src/modules/build/index.js +56 -56
- package/src/modules/build/oxygen.js +165 -159
- package/src/modules/deploy/config.js +13 -13
- package/src/modules/deploy/execute.js +74 -74
- package/src/modules/deploy/index.js +23 -23
- package/src/modules/deploy/srcset.js +16 -16
- package/src/modules/fonto/commands.js +125 -150
- package/src/modules/fonto/index.js +61 -28
- package/src/modules/git/index.js +39 -37
- package/src/modules/migrate/index.js +61 -61
- package/src/modules/migrate/steps.js +9 -5
- package/src/modules/sql/index.js +39 -39
- package/src/modules/version/index.js +164 -173
- package/tct-workspace.code-workspace +0 -7
|
@@ -1,174 +1,165 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
module.exports = function version (argv) {
|
|
168
|
-
_info(`Version information of this git repository\n`)
|
|
169
|
-
|
|
170
|
-
getGitInfo(argv);
|
|
171
|
-
getFileExtractInfo(argv);
|
|
172
|
-
getServerInfo(argv);
|
|
173
|
-
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const globby = require('globby');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const {Table} = require('console-table-printer');
|
|
5
|
+
const execGitCommand = require('../../lib/exec-git-command');
|
|
6
|
+
const c = require('../deploy/config');
|
|
7
|
+
const {remote} = require('../deploy/execute');
|
|
8
|
+
|
|
9
|
+
const getGitInfo = () => {
|
|
10
|
+
// Version info TDI submodule
|
|
11
|
+
const branchInfo = [];
|
|
12
|
+
const gitSubmoduleInfo = new Table({
|
|
13
|
+
columns: [
|
|
14
|
+
{name: 'property', title: 'TDI - submodule', alignment: 'left'},
|
|
15
|
+
{name: 'value', alignment: 'left'}
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Fetch all
|
|
20
|
+
execGitCommand('fetch -pf --all', path.join(_paths.repo, _paths.tdi));
|
|
21
|
+
|
|
22
|
+
// Get branches containing TDI HEAD commit
|
|
23
|
+
const releaseBranches = execGitCommand(`branch --all --contains ${_git.commitTdi.local().hash}`, path.join(_paths.repo, _paths.tdi)).match(/release\/[^\s]+/gsm);
|
|
24
|
+
if (releaseBranches) {
|
|
25
|
+
releaseBranches.forEach(b => {
|
|
26
|
+
// Get number of commits behind
|
|
27
|
+
const count = execGitCommand(`rev-list HEAD...origin/${b} --count`, path.join(_paths.repo, _paths.tdi));
|
|
28
|
+
// _info(`debug: [${b}]:${count}`);
|
|
29
|
+
// Push number of commits behind to branchInfo
|
|
30
|
+
branchInfo.push({name: b, commitsBehind: count});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Get the first possible branch; prefer release/5.1 over release/5.2:
|
|
35
|
+
const firstBranch = branchInfo.sort((a, b) => a.name > b.name ? 1 : -1)[0];
|
|
36
|
+
|
|
37
|
+
// Create table rows for TDI submodule info
|
|
38
|
+
gitSubmoduleInfo.addRow({
|
|
39
|
+
property: 'Commit date',
|
|
40
|
+
value: _git.commitTdi.local().date.toLocaleDateString('en-gb', {day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit'})
|
|
41
|
+
});
|
|
42
|
+
if (firstBranch) {
|
|
43
|
+
gitSubmoduleInfo.addRow({
|
|
44
|
+
property: 'Branch',
|
|
45
|
+
value: firstBranch.name
|
|
46
|
+
});
|
|
47
|
+
gitSubmoduleInfo.addRow({
|
|
48
|
+
property: 'Commits behind',
|
|
49
|
+
value: firstBranch.commitsBehind
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
gitSubmoduleInfo.addRow({
|
|
53
|
+
property: 'Branch could not be determined',
|
|
54
|
+
value: ''
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Print TDI submodule info
|
|
59
|
+
gitSubmoduleInfo.printTable();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getFileExtractInfo = (argv) => {
|
|
63
|
+
// version info miscellaneous
|
|
64
|
+
const sorting = argv.find.toString().includes('sort-type') ? 'type' : 'project';
|
|
65
|
+
const projects = new Set;
|
|
66
|
+
const types = new Set;
|
|
67
|
+
const versionInfoConfigPath = path.join(_paths.repo, _paths.tdi, 'tct/version/versionInfo.js');
|
|
68
|
+
const versionInfo = new Table({
|
|
69
|
+
columns: [
|
|
70
|
+
{name: 'path', alignment: 'left'},
|
|
71
|
+
{name: 'type', alignment: 'left'},
|
|
72
|
+
{name: 'version', alignment: 'left'},
|
|
73
|
+
{name: 'sort'}
|
|
74
|
+
],
|
|
75
|
+
disabledColumns: ['sort'],
|
|
76
|
+
sort: (a, b) => a.sort.toLowerCase() > b.sort.toLowerCase() ? 1 : -1
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
if (fs.existsSync(versionInfoConfigPath)) {
|
|
80
|
+
const config = require(versionInfoConfigPath);
|
|
81
|
+
|
|
82
|
+
config.forEach(v => {
|
|
83
|
+
const location = path.join(_paths.repo, v.glob);
|
|
84
|
+
|
|
85
|
+
globby
|
|
86
|
+
.sync(location)
|
|
87
|
+
.forEach(f => {
|
|
88
|
+
const filePathExtract = f.match(/.*(?<path>(cmscustom|site-stylesheets)\/(?<customer>[^/]*)\/(?<project>[^/]*)\/.*)/);
|
|
89
|
+
const path = filePathExtract.groups.path ? filePathExtract.groups.path : '';
|
|
90
|
+
const project = filePathExtract.groups.project ? filePathExtract.groups.project : '';
|
|
91
|
+
|
|
92
|
+
const fileContent = fs.readFileSync(f).toString();
|
|
93
|
+
v.extracts.forEach(e => {
|
|
94
|
+
const extract = fileContent.match(e.regex);
|
|
95
|
+
if (extract) {
|
|
96
|
+
projects.add(project); // Store the projects where versioninfo is found
|
|
97
|
+
types.add(e.type); // Store the types for which versioninfo is found
|
|
98
|
+
versionInfo.addRow({ // Create row with version information to output
|
|
99
|
+
path,
|
|
100
|
+
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
|
|
101
|
+
type: e.type,
|
|
102
|
+
version: extract.groups.version
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (sorting=='project') {
|
|
110
|
+
// For projects containing version information
|
|
111
|
+
projects.forEach(p => {
|
|
112
|
+
versionInfo.addRow({ // Add empty row after project
|
|
113
|
+
path: '',
|
|
114
|
+
sort: `${p}_3`,
|
|
115
|
+
type: '',
|
|
116
|
+
version: ''
|
|
117
|
+
});
|
|
118
|
+
versionInfo.addRow({ // Add row with project name
|
|
119
|
+
path: `-- ${p}:`,
|
|
120
|
+
sort: `${p}_1`,
|
|
121
|
+
type: '',
|
|
122
|
+
version: ''
|
|
123
|
+
}, {
|
|
124
|
+
color: 'yellow'
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
} else
|
|
128
|
+
if (sorting=='type') {
|
|
129
|
+
types.forEach(t => {
|
|
130
|
+
versionInfo.addRow({ // Add empty row after type
|
|
131
|
+
path: '',
|
|
132
|
+
sort: `${t}_3`,
|
|
133
|
+
type: '',
|
|
134
|
+
version: ''
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
versionInfo.printTable();
|
|
139
|
+
} else {
|
|
140
|
+
_warn('Version info of miscellaneous items cannot be extracted:\nCannot find required files in TDI submodule. Try updating TDI submodule.');
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const getServerInfo = (argv) => {
|
|
145
|
+
// Remote server info
|
|
146
|
+
// common setup
|
|
147
|
+
_write();
|
|
148
|
+
c.setServer(argv.server);
|
|
149
|
+
|
|
150
|
+
if (!c.envDev) {
|
|
151
|
+
_info(`Remote version info for '${c.server.ftpConfig.host}':\n`);
|
|
152
|
+
remote.add('sudo ~root/scripts/version.sh', '').process();
|
|
153
|
+
} else {
|
|
154
|
+
_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.');
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
module.exports = function version (argv) {
|
|
159
|
+
_info('Version information of this git repository\n');
|
|
160
|
+
|
|
161
|
+
getGitInfo(argv);
|
|
162
|
+
getFileExtractInfo(argv);
|
|
163
|
+
getServerInfo(argv);
|
|
164
|
+
|
|
174
165
|
};
|