@tangelo/tangelo-configuration-toolkit 1.16.0 → 1.17.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/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -88,7 +88,7 @@ module.exports = function cli () {
|
|
|
88
88
|
builder: {
|
|
89
89
|
execute: {alias: 'e', desc: 'Execute migration'},
|
|
90
90
|
dry: {alias: 'd', desc: 'Dry run (does not persist changes)'},
|
|
91
|
-
filter: {alias: 'f', desc: 'Pass glob filter (only used for applicable steps)'
|
|
91
|
+
filter: {alias: 'f', desc: 'Pass glob filter (only used for applicable steps)'}
|
|
92
92
|
},
|
|
93
93
|
handler: require('./modules/migrate')
|
|
94
94
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
const del = require('del');
|
|
1
2
|
const {exec} = require('child_process');
|
|
2
3
|
const fs = require('fs-extra');
|
|
4
|
+
const globby = require('globby');
|
|
3
5
|
const gulp = require('gulp');
|
|
4
6
|
const g_print = require('gulp-print');
|
|
5
7
|
const path = require('path');
|
|
@@ -219,15 +221,27 @@ module.exports = {
|
|
|
219
221
|
;
|
|
220
222
|
|
|
221
223
|
_info(`Ensure ${messagesFile} exists:`);
|
|
222
|
-
if (!fs.existsSync(messagesFile)) fs.outputJsonSync(messagesFile, []
|
|
224
|
+
if (!fs.existsSync(messagesFile)) fs.outputJsonSync(messagesFile, []);
|
|
225
|
+
_write('Done.\n');
|
|
226
|
+
|
|
227
|
+
_info('Make temporary copies of json files:');
|
|
228
|
+
const attrCfgTmpFiles = globby.sync('packages/*/src/!(messages.|operations-)*.json');
|
|
229
|
+
attrCfgTmpFiles.forEach((p, i, a) => {
|
|
230
|
+
_write(p);
|
|
231
|
+
a[i] = path.join(path.dirname(p), 'operations-' + path.basename(p));
|
|
232
|
+
fs.copyFileSync(p, a[i]);
|
|
233
|
+
});
|
|
234
|
+
_write();
|
|
223
235
|
|
|
224
236
|
return cmdExec(`${fdt} localization extract ${templateFile} --paths ` + packagesDirs)
|
|
225
237
|
.then(() => cmdExec(`${fdt} localization update ${messagesFile} ${templateFile}`))
|
|
238
|
+
.then(() => fs.readFile(messagesFile, {encoding: 'UTF-8'}))
|
|
239
|
+
.then(data => fs.outputFile(messagesFile, data.replace(/src\/operations-_/g, 'src/_'))) // remove "operations-" prefix from meta[.file]
|
|
226
240
|
.then(() => {
|
|
227
|
-
_info('
|
|
228
|
-
|
|
229
|
-
_write('Done.\n');
|
|
241
|
+
_info('Cleanup temp files:');
|
|
242
|
+
return del([templateFile, ...attrCfgTmpFiles]);
|
|
230
243
|
})
|
|
244
|
+
.then(() => _write('Done.\n'))
|
|
231
245
|
.then(() => [fdt])
|
|
232
246
|
;
|
|
233
247
|
},
|
package/src/modules/git/index.js
CHANGED
|
@@ -130,6 +130,7 @@ module.exports = function git (argv) {
|
|
|
130
130
|
const updateSubmoduleMsg = execGitCommand(`submodule update --remote`, _paths.repo);
|
|
131
131
|
if (updateSubmoduleMsg.error && !tdiFromDateCustom) _error(`Update submodule failed\n${updateSubmoduleMsg.error}`);
|
|
132
132
|
|
|
133
|
+
const tdiDateBeforeUpdate = _git.commitTdi.local().date;
|
|
133
134
|
// update local TDI commit data
|
|
134
135
|
_git.commitTdi.local(true);
|
|
135
136
|
|
|
@@ -138,7 +139,7 @@ module.exports = function git (argv) {
|
|
|
138
139
|
// tdiMigrationFilePath should exist in latest commits of releases 5.3+; As we updated to the latest version this should work
|
|
139
140
|
const migrations = _modulesTdi.require('git/tdiCommitsRequiringMigration.js');
|
|
140
141
|
if (migrations) {
|
|
141
|
-
const fromTdiDate = tdiFromDateCustom ? new Date(tdiFromDateCustom) : (tdiBranch.commonAncestor) ? tdiBranch.commonAncestor.date:
|
|
142
|
+
const fromTdiDate = tdiFromDateCustom ? new Date(tdiFromDateCustom) : (tdiBranch.commonAncestor) ? tdiBranch.commonAncestor.date: tdiDateBeforeUpdate;
|
|
142
143
|
const toTdiDate = tdiToDateCustom ? new Date(tdiToDateCustom) : new Date();
|
|
143
144
|
|
|
144
145
|
_info(`TDI commits requiring migration between ${_formatDate(fromTdiDate)} and ${_formatDate(toTdiDate)}`);
|
|
@@ -6,8 +6,6 @@ const path = require('path');
|
|
|
6
6
|
module.exports = function migrate (argv) {
|
|
7
7
|
if (_isPre51()) _error('This command only works when using branch release/5.1 and up.');
|
|
8
8
|
|
|
9
|
-
let filter = path.join(_paths.apply, argv.filter).toFws(); // Default set filter with filter added to the command argument -f
|
|
10
|
-
|
|
11
9
|
const scripts =
|
|
12
10
|
globby
|
|
13
11
|
.sync(_paths.tdi + '/tct/migrate/*.js')
|
|
@@ -37,12 +35,12 @@ module.exports = function migrate (argv) {
|
|
|
37
35
|
when: !(cmdlScript) // Only show choice for migration when no script is set in commandline
|
|
38
36
|
}, {
|
|
39
37
|
message: 'Choose filter: ', name: 'filter', type: 'list', pageSize: 5, loop: false,
|
|
40
|
-
choices: [{name: `- All`, value:
|
|
41
|
-
when: argv.filter
|
|
38
|
+
choices: [{name: `- All`, value: '**'}, {name: '- Choose active projects', value: 'projects'}],
|
|
39
|
+
when: !argv.filter // Only show this message if no custom filter was added to the command argument -f
|
|
42
40
|
}, {
|
|
43
41
|
message: 'Choose active projects: ', name: 'projects', type: 'checkbox', validate: v => !!v[0],
|
|
44
42
|
choices: _repoconfig.map(p => ({name: `${p.customer_name} ${p.project_name}`, value: p})),
|
|
45
|
-
when:
|
|
43
|
+
when: a => a.filter === 'projects' // Only show this message if 'Choose active projects' was chosen previously
|
|
46
44
|
}])
|
|
47
45
|
.then(a => {
|
|
48
46
|
_write();
|
|
@@ -53,6 +51,8 @@ module.exports = function migrate (argv) {
|
|
|
53
51
|
a.script = cmdlScript.value;
|
|
54
52
|
}
|
|
55
53
|
|
|
54
|
+
let filter = path.join(_paths.apply, argv.filter).toFws(); // Default set filter with filter added to the command argument -f
|
|
55
|
+
|
|
56
56
|
if (a.filter === 'projects' && _repoconfig.length > a.projects.length) {
|
|
57
57
|
// push paths of chosen active documents to projectFolders (only if not all projects are chosen)
|
|
58
58
|
const projectFolders = [];
|