@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,160 +1,166 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const globby = require('globby');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const SaxonJS = require('saxon-js');
|
|
5
|
-
|
|
6
|
-
const spConfigPath = path.join(_paths.repo, _paths.tdi, 'tct/build/oxygen/stylesheetPaths.json');
|
|
7
|
-
const sefFilePath = path.join(_paths.repo, _paths.tdi, 'tct/build/oxygen/createProjectFile.sef.json');
|
|
8
|
-
const cmscustomPath = 'config/cmscustom/';
|
|
9
|
-
const siteStylesheetsPath = 'config/txp/site-stylesheets/';
|
|
10
|
-
|
|
11
|
-
const masterFiles = new Set;
|
|
12
|
-
const transformationScenarios = [];
|
|
13
|
-
|
|
14
|
-
const createProjectFile = (config) => {
|
|
15
|
-
_info('Initializing xpr file(s):');
|
|
16
|
-
const xprFiles = globby.sync(`*.xpr`);
|
|
17
|
-
|
|
18
|
-
// Copy xpr file from TDI if it does not exists yet;
|
|
19
|
-
if (xprFiles[0]) _write(`Found: ${xprFiles.join(', ')}`);
|
|
20
|
-
else {
|
|
21
|
-
const customers = new Set;
|
|
22
|
-
_repoconfig.forEach(p => customers.add(p.customer_name));
|
|
23
|
-
xprFiles.push([...customers].join(' - ') + '.xpr');
|
|
24
|
-
fs.copySync(path.join(_paths.repo,'tangelo-default-implementation/src/[customer].xpr'), path.join(_paths.repo, xprFiles[0]));
|
|
25
|
-
_write(`Created: '${xprFiles[0]}'`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Search for transformationScenarios/masterfiles based on TDI submodule oxygenProjectFile config
|
|
29
|
-
_info('\nSearching for transformationScenarios/masterfiles');
|
|
30
|
-
config.oxygenProjectFile.forEach(
|
|
31
|
-
pf => {
|
|
32
|
-
// Collect transformation scenarios and add them to the transformationScenarios array; add individual stylesheets to the masterFiles set.
|
|
33
|
-
if (pf.transformation) getTransformations(pf.transformation);
|
|
34
|
-
// Add files to the masterfiles set.
|
|
35
|
-
else if (pf.masterfile) getMasterfiles(pf.masterfile);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// update all .xpr files with collected transformation scenarios and masterfiles.
|
|
40
|
-
transformXprFile(xprFiles);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const getTransformations = (config) => {
|
|
44
|
-
_repoconfig.forEach(rc => {
|
|
45
|
-
// get pathname of customer/project
|
|
46
|
-
const [customerPath, projectPath] = config.location == 'database' ? rc.path_dbconfig : rc.path_cmscustom;
|
|
47
|
-
|
|
48
|
-
// set pathname of customer/project in location glob-expression
|
|
49
|
-
const location = path.join(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
globby
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// extract baseStrings from file
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
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
|
-
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const globby = require('globby');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const SaxonJS = require('saxon-js');
|
|
5
|
+
|
|
6
|
+
const spConfigPath = path.join(_paths.repo, _paths.tdi, 'tct/build/oxygen/stylesheetPaths.json');
|
|
7
|
+
const sefFilePath = path.join(_paths.repo, _paths.tdi, 'tct/build/oxygen/createProjectFile.sef.json');
|
|
8
|
+
const cmscustomPath = 'config/cmscustom/';
|
|
9
|
+
const siteStylesheetsPath = 'config/txp/site-stylesheets/';
|
|
10
|
+
|
|
11
|
+
const masterFiles = new Set;
|
|
12
|
+
const transformationScenarios = [];
|
|
13
|
+
|
|
14
|
+
const createProjectFile = (config) => {
|
|
15
|
+
_info('Initializing xpr file(s):');
|
|
16
|
+
const xprFiles = globby.sync(`*.xpr`);
|
|
17
|
+
|
|
18
|
+
// Copy xpr file from TDI if it does not exists yet;
|
|
19
|
+
if (xprFiles[0]) _write(`Found: ${xprFiles.join(', ')}`);
|
|
20
|
+
else {
|
|
21
|
+
const customers = new Set;
|
|
22
|
+
_repoconfig.forEach(p => customers.add(p.customer_name));
|
|
23
|
+
xprFiles.push([...customers].join(' - ') + '.xpr');
|
|
24
|
+
fs.copySync(path.join(_paths.repo, 'tangelo-default-implementation/src/[customer].xpr'), path.join(_paths.repo, xprFiles[0]));
|
|
25
|
+
_write(`Created: '${xprFiles[0]}'`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Search for transformationScenarios/masterfiles based on TDI submodule oxygenProjectFile config
|
|
29
|
+
_info('\nSearching for transformationScenarios/masterfiles');
|
|
30
|
+
config.oxygenProjectFile.forEach(
|
|
31
|
+
pf => {
|
|
32
|
+
// Collect transformation scenarios and add them to the transformationScenarios array; add individual stylesheets to the masterFiles set.
|
|
33
|
+
if (pf.transformation) getTransformations(pf.transformation);
|
|
34
|
+
// Add files to the masterfiles set.
|
|
35
|
+
else if (pf.masterfile) getMasterfiles(pf.masterfile);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// update all .xpr files with collected transformation scenarios and masterfiles.
|
|
40
|
+
transformXprFile(xprFiles);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getTransformations = (config) => {
|
|
44
|
+
_repoconfig.forEach(rc => {
|
|
45
|
+
// get pathname of customer/project
|
|
46
|
+
const [customerPath, projectPath] = config.location == 'database' ? rc.path_dbconfig : rc.path_cmscustom;
|
|
47
|
+
|
|
48
|
+
// set pathname of customer/project in location glob-expression
|
|
49
|
+
const location = path.join(
|
|
50
|
+
_paths.repo,
|
|
51
|
+
config.files.replace(/\[customer\]/, customerPath).replace(/\[project\]/, projectPath)
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
globby
|
|
55
|
+
.sync(`${location}`)
|
|
56
|
+
.forEach(f => {
|
|
57
|
+
// extract baseStrings from file
|
|
58
|
+
const fileString = fs.readFileSync(f).toString();
|
|
59
|
+
const baseStrings = fileString.match(RegExp(config.extracts.base, 'gm'));
|
|
60
|
+
|
|
61
|
+
if (fileString.replace(/\s|^prompt\s.*$/gm,'')!=='') {
|
|
62
|
+
if (baseStrings) {
|
|
63
|
+
baseStrings.forEach(s => {
|
|
64
|
+
// extract type, name, files info from baseString
|
|
65
|
+
const type = config.extracts.type ? s.match(RegExp(config.extracts.type))[1] : config.values.type;
|
|
66
|
+
const name = config.extracts.name ? s.match(RegExp(config.extracts.name))[1] : config.values.name;
|
|
67
|
+
const files = s.match(RegExp(config.extracts.files))[1];
|
|
68
|
+
|
|
69
|
+
// Add transformation scenario to the transformationScenario array
|
|
70
|
+
transformationScenarios.push({
|
|
71
|
+
name: `${type}: ${name} (${rc.customer_name}, ${rc.project_name})`, // note that in createProjectFile.xsl a regex is added that matches scenarios based on this name. This to preserve manually added scenarios.
|
|
72
|
+
transformationScenario: files,
|
|
73
|
+
location: config.location == 'txp' ? siteStylesheetsPath : cmscustomPath
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Add each non-tdi stylesheet in transformation scenario to the masterFiles set
|
|
77
|
+
files.split(',').forEach(f => {
|
|
78
|
+
const filePath = `${config.location == 'txp' ? siteStylesheetsPath : cmscustomPath}${f}`;
|
|
79
|
+
if (!f.startsWith('tdi')) masterFiles.add(filePath);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
_write(`No transformation scenarios found in ${f} for '${config.extracts.base}'`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
const getMasterfiles = (config) => {
|
|
93
|
+
globby
|
|
94
|
+
.sync(`${path.join(_paths.repo, config.files)}`)
|
|
95
|
+
.forEach(cf => {
|
|
96
|
+
// Check if masterfile should be extracted from file
|
|
97
|
+
const fileString = fs.readFileSync(cf).toString();
|
|
98
|
+
if (fileString.replace(/\s|^prompt\s.*$/gm,'')!=='') {
|
|
99
|
+
if (config.extracts) {
|
|
100
|
+
// extract baseStrings from file
|
|
101
|
+
const baseStrings = fileString.match(RegExp(config.extracts.base, 'gm'));
|
|
102
|
+
|
|
103
|
+
if (baseStrings) {
|
|
104
|
+
baseStrings.forEach(s => {
|
|
105
|
+
// extract (comma-separated) list of masterfiles
|
|
106
|
+
const filesString = s.match(RegExp(config.extracts.files))[1];
|
|
107
|
+
if (!filesString) _error(`No masterfiles found in '${s}' for '${config.extracts.files}'`);
|
|
108
|
+
|
|
109
|
+
// Add each non-tdi masterfile to the masterFiles set
|
|
110
|
+
filesString.split(',').forEach(f => {
|
|
111
|
+
if (!f.startsWith('tdi')){
|
|
112
|
+
const filePath = `${config.location == 'txp' ? siteStylesheetsPath : cmscustomPath}${f}`;
|
|
113
|
+
masterFiles.add(filePath);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
_write(`No masterfiles found in ${cf} for '${config.extracts.base}'`);
|
|
119
|
+
}
|
|
120
|
+
} else { // Add synced file to masterfiles; strip path from c:/... hence it starts with config/cmscustom or config/txp/site-stylesheets
|
|
121
|
+
const filePath = config.location == 'txp' ? `${siteStylesheetsPath}${cf.split(siteStylesheetsPath)[1]}` : `${cmscustomPath}${cf.split(cmscustomPath)[1]}`;
|
|
122
|
+
masterFiles.add(filePath);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const transformXprFile = (xprFiles) => {
|
|
130
|
+
_info('\nUpdating xpr file(s):');
|
|
131
|
+
// create with: xslt3 -t -xsl:createProjectFile.xsl -export:createProjectFile.sef.json v -nogo'
|
|
132
|
+
|
|
133
|
+
xprFiles
|
|
134
|
+
.forEach(xprFile => {
|
|
135
|
+
// Transform xpr; add masterfiles and transformationScenarios as parameters of the stylesheet
|
|
136
|
+
_write(`${xprFile}\n`);
|
|
137
|
+
SaxonJS.transform({
|
|
138
|
+
stylesheetText: fs.readFileSync(sefFilePath),
|
|
139
|
+
stylesheetBaseURI: 'createProjectFile.sef.json',
|
|
140
|
+
sourceFileName: path.join(_paths.repo, xprFile),
|
|
141
|
+
destination: 'serialized',
|
|
142
|
+
stylesheetParams: {
|
|
143
|
+
'masterfiles': [...masterFiles],
|
|
144
|
+
'Q{}transformationScenarios': transformationScenarios
|
|
145
|
+
}
|
|
146
|
+
}, 'async')
|
|
147
|
+
.then(output => {
|
|
148
|
+
// Write result of transformation to xpr file
|
|
149
|
+
fs.writeFileSync(path.join(_paths.repo, xprFile), output.principalResult);
|
|
150
|
+
})
|
|
151
|
+
.catch(e => _warn(`Failed to update: ${xprFile}\n ${e}`));
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
module.exports = function oxygen () {
|
|
157
|
+
// _info(`Set projects transformation scenarios and masterfiles in oXygen project file...`);
|
|
158
|
+
// _info(`- Will try to preserve manually added entries in the transformation scenarios and masterfiles`);
|
|
159
|
+
// _info(`- Will remove non existing masterfiles or masterfiles that start with a '_'\n`);
|
|
160
|
+
|
|
161
|
+
if (!fs.existsSync(spConfigPath) || !fs.existsSync(sefFilePath)) {
|
|
162
|
+
_error(`Cannot find required files in TDI submodule. Try updating TDI submodule.`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
createProjectFile(require(spConfigPath));
|
|
160
166
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const fs = require('fs-extra')
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
2
|
const objMerge = require('object-assign-deep');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
|
|
@@ -81,11 +81,11 @@ module.exports = {
|
|
|
81
81
|
|
|
82
82
|
this.giPatterns = !fs.existsSync('.gitignore') ? [] :
|
|
83
83
|
fs.readFileSync('.gitignore').toString()
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
.trim()
|
|
85
|
+
.replace(/^#.+/gm, '') // remove comments
|
|
86
|
+
.split(/\s+/) // split on lines
|
|
87
|
+
.filter(p => !p.match(/^database\/|\/tdi|\/fonto/)) // filter paths that should be copied
|
|
88
|
+
.map(p => '!' + (p.match(/^config/) ? p : '**/' + p.split('**/').pop()) + (p.match(/\/$/) ? '**' : '')) // negate expressions, remove base dir, suffix folders with **
|
|
89
89
|
;
|
|
90
90
|
|
|
91
91
|
let transferPattern = path.join(_paths.apply, filter).toFws();
|
|
@@ -110,11 +110,11 @@ module.exports = {
|
|
|
110
110
|
if (this.deliveryPack && transferPattern.includes(_paths.tdi)) this.transferPatterns.push(`${_paths.tdi}/src/database/create*.sql`); // create(_exists).sql is called by tdi install
|
|
111
111
|
|
|
112
112
|
// add time parameters to all xopus requests to overcome cache
|
|
113
|
-
const ts = new Date().toISOString().replace(/-|:/g, '').substring(0,15);
|
|
113
|
+
const ts = new Date().toISOString().replace(/-|:/g, '').substring(0, 15);
|
|
114
114
|
this.replaceStrings = [
|
|
115
|
-
[/((xsd|xsl|src|iconsrc)="[^"?]+)"/g
|
|
116
|
-
[/(schemaLocation="[^"?]+)"/g
|
|
117
|
-
[/(href="[^"?]+.xsl)"/g
|
|
115
|
+
[/((xsd|xsl|src|iconsrc)="[^"?]+)"/g, `$1?_=${ts}"`, '**/xopus/xml/*'],
|
|
116
|
+
[/(schemaLocation="[^"?]+)"/g, `$1?_=${ts}"`, '**/xopus/xsd/*'],
|
|
117
|
+
[/(href="[^"?]+.xsl)"/g, `$1?_=${ts}"`, '**/xopus/xsl/*']
|
|
118
118
|
];
|
|
119
119
|
// depending on env, enable debug mode and change track functionality
|
|
120
120
|
if (this.envDev) {
|
|
@@ -129,14 +129,14 @@ module.exports = {
|
|
|
129
129
|
}
|
|
130
130
|
else this.replaceStrings.push(['debugMode>true', 'debugMode>false', '**/xopus/xml/*']);
|
|
131
131
|
|
|
132
|
-
_info(`Branch: ${_git.commitLocal.branch}`);
|
|
132
|
+
_info(`Branch: ${_git.commitLocal().branch}`);
|
|
133
133
|
_info(`Source: ${path.join(process.cwd(), transferPattern)}`);
|
|
134
134
|
_info(`Server: ${ftpConfig.host ? `${ftpConfig.host}:${ftpConfig.port}` : 'local'}`);
|
|
135
135
|
_info(`Target: ${this.getRemotePath(transferPattern)}`);
|
|
136
136
|
_write();
|
|
137
137
|
|
|
138
|
-
if (_git.commitLocal.date < _git.commitRemote.date) {
|
|
139
|
-
_warn(`You're not deploying from the most recent git commit!\n`)
|
|
138
|
+
if (_git.commitLocal().date < _git.commitRemote().date) {
|
|
139
|
+
_warn(`You're not deploying from the most recent git commit!\n`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -25,8 +25,8 @@ const s = require('./srcset');
|
|
|
25
25
|
|
|
26
26
|
const remote = {
|
|
27
27
|
queue: [],
|
|
28
|
-
add(cmd,msg) {
|
|
29
|
-
if (!this.queue.find(e => e[0]==cmd)) this.queue.push([cmd,msg]);
|
|
28
|
+
add(cmd, msg) {
|
|
29
|
+
if (!this.queue.find(e => e[0]==cmd)) this.queue.push([cmd, msg]);
|
|
30
30
|
return this;
|
|
31
31
|
},
|
|
32
32
|
do(sshI) {
|
|
@@ -38,25 +38,25 @@ const remote = {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// execute each command from the queue in batches
|
|
41
|
-
this.queue.filter((e,i) => i < executing).forEach(()=>{
|
|
41
|
+
this.queue.filter((e, i) => i < executing).forEach(()=>{
|
|
42
42
|
const command = this.queue.shift();
|
|
43
43
|
|
|
44
44
|
sshI.execCommand(command[0])
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
.then(result => {
|
|
46
|
+
if (result.stderr) _warn(result.stderr);
|
|
47
|
+
else if (command[1] === '') _write(result.stdout);
|
|
48
|
+
else _info(command[1] || command[0], true);
|
|
49
|
+
|
|
50
|
+
executing--;
|
|
51
|
+
if (executing==0) this.do(sshI);
|
|
52
|
+
})
|
|
53
|
+
.catch(err => {
|
|
54
|
+
_warn(`Server aborted connection. Retrying.`);
|
|
55
|
+
this.queue.unshift(command);
|
|
56
|
+
|
|
57
|
+
executing--;
|
|
58
|
+
if (executing==0) this.do(sshI);
|
|
59
|
+
});
|
|
60
60
|
});
|
|
61
61
|
},
|
|
62
62
|
process() {
|
|
@@ -64,14 +64,14 @@ const remote = {
|
|
|
64
64
|
|
|
65
65
|
const sshI = new NodeSSH();
|
|
66
66
|
sshI.connect(c.server.ftpConfig) // set up connection once
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
.then(() => {
|
|
68
|
+
this.do(sshI);
|
|
69
|
+
})
|
|
70
|
+
.catch(err => {
|
|
71
|
+
if (err.code=='ECONNRESET' || err.code=='ECONNABORTED') _warn(`Server aborted connection. Retrying.`);
|
|
72
|
+
else _warn(err);
|
|
73
|
+
this.process(); // retry set up connection
|
|
74
|
+
});
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
|
|
@@ -81,7 +81,7 @@ const createDeliveryPack = () => { // create install scripts if necessary, zip o
|
|
|
81
81
|
const dbiPs1 = [];
|
|
82
82
|
|
|
83
83
|
globby.sync('**/database/**/*install.sql', {cwd: c.server.remotedir}).forEach(p => { // add install-script calls and make sure tdi comes first
|
|
84
|
-
const [dir, file] = p.match(/(.+)\/([
|
|
84
|
+
const [dir, file] = p.match(/(.+)\/([^/]+)$/).slice(1);
|
|
85
85
|
if (/config.*\/..._install/.test(p)) dbiSql.push(`@${p}`);
|
|
86
86
|
else if (dir.endsWith('tdi')) dbiPs1.unshift(`cd $cwd/${dir}`, `sqlplus /nolog "@${file}"`);
|
|
87
87
|
else dbiPs1.push(`cd $cwd/${dir}`, `sqlplus /nolog "@${file}"`);
|
|
@@ -133,12 +133,12 @@ const transfer = (paths, lrServer) => {
|
|
|
133
133
|
const prPath = 'config\\'+file.relative.replace(/fonto.+$/, '');
|
|
134
134
|
if (fontoPaths.outdated.includes(prPath)) return false;
|
|
135
135
|
if (fontoPaths.uptodate.includes(prPath)) return true;
|
|
136
|
-
if (file.relative.match(/fonto[
|
|
136
|
+
if (file.relative.match(/fonto[\\/]dist/)) {
|
|
137
137
|
const paths = `${prPath}\\fonto ${prPath}\\schema ${_paths.tdi}`; // only check paths containing fonto sources
|
|
138
|
-
const lastFontoCommit = execGitCommand(`log -1 --format=%ae;%cd --date=iso-strict origin/${_git.commitLocal.branch} ${paths}`, _paths.repo, ['author', 'date']);
|
|
138
|
+
const lastFontoCommit = execGitCommand(`log -1 --format=%ae;%cd --date=iso-strict origin/${_git.commitLocal().branch} ${paths}`, _paths.repo, ['author', 'date']);
|
|
139
139
|
if (
|
|
140
|
-
lastFontoCommit.author != _git.user &&
|
|
141
|
-
(lastFontoCommit.date > _git.commitLocal.date || lastFontoCommit.date > fs.statSync(file.relative).mtime)
|
|
140
|
+
lastFontoCommit.author != _git.user() &&
|
|
141
|
+
(lastFontoCommit.date > _git.commitLocal().date || lastFontoCommit.date > fs.statSync(file.relative).mtime)
|
|
142
142
|
) {
|
|
143
143
|
fontoPaths.outdated.push(prPath);
|
|
144
144
|
return false;
|
|
@@ -153,50 +153,50 @@ const transfer = (paths, lrServer) => {
|
|
|
153
153
|
|
|
154
154
|
_info('Start transferring', true);
|
|
155
155
|
|
|
156
|
-
gulp.src(srcset, {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
156
|
+
gulp.src(srcset, {base: '.', follow: true, allowEmpty: true})
|
|
157
|
+
.pipe(g_plumber()) // catch errors in plugins so watch doesnt break
|
|
158
|
+
.pipe(removeOutdatedFontoBuild)
|
|
159
|
+
.pipe(xpsF)
|
|
160
|
+
.pipe(g_resolveIncl())
|
|
161
|
+
.pipe(xpsF.restore)
|
|
162
|
+
.pipe(jsF)
|
|
163
|
+
.pipe(g_sourcemaps.init())
|
|
164
|
+
.pipe(g_babel({presets: [[babel_pe, {modules: false}]], comments: false, minified: true})) // function must be executed here, otherwise second execution during watch fails
|
|
165
|
+
.pipe(g_sourcemaps.write('.'))
|
|
166
|
+
.pipe(jsF.restore)
|
|
167
|
+
.pipe(sassF)
|
|
168
|
+
.pipe(g_sourcemaps.init())
|
|
169
|
+
.pipe(g_sass().on('error', g_sass.logError))
|
|
170
|
+
.pipe(g_sourcemaps.write('.'))
|
|
171
|
+
.pipe(sassF.restore)
|
|
172
|
+
.pipe(shF)
|
|
173
|
+
.pipe(g_eol('\n'))
|
|
174
|
+
.pipe(shF.restore)
|
|
175
|
+
.pipe(g_plumber.stop())
|
|
176
|
+
.pipe(g_replace(c.replaceStrings))
|
|
177
|
+
.pipe(through2.obj((file, enc, cb) => {
|
|
178
|
+
file.originalRelativePath = file.relative; // original path needed for sftp.fastPut
|
|
179
|
+
file.path = file.path.replace(/(fonto).(?:dev|dist|packages.sx-shell-.+src)(.+)/, '$1$2'); // change destination path for fonto build files
|
|
180
|
+
if (!file.relative.endsWith('.map')) files.push(file.relative); // collect all file paths in array for livereload
|
|
181
|
+
cb(null, file);
|
|
182
|
+
}))
|
|
183
|
+
.pipe(g_print.default())
|
|
184
|
+
.pipe(c.localTransfer ? gulp.dest(c.server.remotedir) : g_sftp(c.server.ftpConfig, c.server.remotedir))
|
|
185
|
+
.on('end', () => {
|
|
186
|
+
_info('Finished transferring\n', true);
|
|
187
|
+
if (fontoPaths.outdated[0]) _warn(`Fonto build files in the following folders were outdated and therefore skipped:\n ${fontoPaths.outdated.map(v => v.slice(0, -1)).join('\n ')}`);
|
|
188
|
+
|
|
189
|
+
remote.process();
|
|
190
|
+
|
|
191
|
+
if (lrServer) { // reload specific resources if files are all image or css, else reload page
|
|
192
|
+
const reloadPage = !files.every(f => /.(css|jpe?g|png|gif)$/i.test(f));
|
|
193
|
+
lrServer.changed({params: {files: reloadPage ? ['page'] : files}});
|
|
194
|
+
_info(`${reloadPage ? 'Page' : 'Resources'} reloaded\n`);
|
|
195
|
+
}
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
197
|
+
if (c.deliveryPack) createDeliveryPack();
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
module.exports = {remote, transfer};
|