@docupace/pipeline 1.0.77 → 1.0.78
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/.prettierrc.cjs +12 -12
- package/README.md +135 -135
- package/bin/azuread_update_callbacks_for_app.sh +58 -58
- package/bin/next-changeset-validate.sh +8 -8
- package/bitbucket-pipelines.yml +59 -59
- package/eslint.config.js +49 -49
- package/jest.config.js +15 -15
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +123 -123
- package/next/sonar.sh +23 -23
- package/package.json +1 -1
- package/src/auth0/alias.js +79 -79
- package/src/auth0/alias.test.js +172 -172
- package/src/auth0/cli.js +82 -82
- package/src/auth0/configure.js +902 -902
- package/src/auth0/configure.test.js +167 -167
- package/src/auth0/export.js +48 -48
- package/src/auth0/export.test.js +103 -103
- package/src/auth0/metadata.js +141 -141
- package/src/auth0/metadata.test.js +186 -186
- package/src/auth0/vault.js +60 -60
- package/src/auth0/vault.test.js +134 -134
- package/src/changeset/changelog-wiki.js +328 -328
- package/src/changeset/changeset-config.js +34 -34
- package/src/changeset/cli.js +237 -237
- package/src/changeset/create.js +215 -215
- package/src/changeset/package-util.js +87 -87
- package/src/changeset/util.js +43 -43
- package/src/changeset/validate.js +91 -91
- package/src/changeset/version.js +102 -102
- package/src/jenkins/setParams.groovy +58 -58
- package/src/lib/merge-driver.js +204 -204
- package/src/merge/cli-merge-all.js +507 -507
- package/src/merge/cli-merge.js +492 -492
- package/src/merge/cli-resolve.js +399 -399
- package/src/merge/cli.js +38 -38
- package/src/merge/merge-changelog.js +87 -87
- package/src/merge/merge-package.js +106 -106
- package/src/merge/merge-types.js +82 -82
- package/src/merge/pr.js +231 -231
- package/src/micro/deploy-microservice.js +153 -0
- package/src/micro/{ms-publish.js → publish-ms.js} +8 -6
- package/src/next/alias.js +53 -53
- package/src/next/apache.js +81 -81
- package/src/next/cli.js +10 -1
- package/src/next/config.js +137 -137
- package/src/next/connect.js +226 -226
- package/src/next/copy.js +61 -61
- package/src/next/deploy.js +633 -633
- package/src/next/git-to-semver.js +79 -79
- package/src/next/haproxy.js +76 -76
- package/src/next/jenkins.js +123 -123
- package/src/next/jira.js +84 -84
- package/src/next/logger.js +17 -17
- package/src/next/pipline.js +114 -114
- package/src/next/publish.js +71 -71
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/src/next/test.js +5 -5
- package/src/next/util.js +95 -93
- package/src/next/vault.js +45 -45
- package/terraform/apply.sh +37 -37
- package/terraform/init.sh +72 -72
- package/terraform/plan.sh +76 -76
- package/terraform/validate.sh +17 -17
- package/src/micro/cli.js +0 -71
- package/src/micro/ms-deploy.js +0 -271
package/src/lib/merge-driver.js
CHANGED
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { execSync } from 'child_process';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
// Get __dirname equivalent in ESM
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Default merge logic function - can be overridden
|
|
14
|
-
* @param {string} headContent - The content from HEAD (current branch)
|
|
15
|
-
* @param {string} branchContent - The content from the incoming branch
|
|
16
|
-
* @returns {string} - The merged content
|
|
17
|
-
* @throws {Error} - If the conflict cannot be automatically merged
|
|
18
|
-
*/
|
|
19
|
-
export function defaultMergeLogic(headContent, branchContent) {
|
|
20
|
-
// Default implementation - throws error
|
|
21
|
-
// Users should provide their own implementation
|
|
22
|
-
throw new Error(
|
|
23
|
-
'No merge logic provided - please pass a custom merge function',
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Main merge driver function
|
|
29
|
-
* @param {string} filePath - Path to the file with conflicts
|
|
30
|
-
* @param {Function} customMergeLogic - Custom merge function (optional)
|
|
31
|
-
* @returns {Promise<{success: boolean, totalConflicts: number, resolvedConflicts: number, hasUnresolvedConflicts: boolean}>}
|
|
32
|
-
*/
|
|
33
|
-
export async function mergeDriver(filePath, customMergeLogic = null) {
|
|
34
|
-
// Use provided merge logic or fall back to default
|
|
35
|
-
const mergeLogic = customMergeLogic || defaultMergeLogic;
|
|
36
|
-
|
|
37
|
-
if (!filePath) {
|
|
38
|
-
throw new Error('File path is required');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Check if file exists
|
|
42
|
-
if (!fs.existsSync(filePath)) {
|
|
43
|
-
throw new Error(`File not found: ${filePath}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
console.log(`Processing conflicts in: ${filePath}`);
|
|
47
|
-
|
|
48
|
-
// Read the file content
|
|
49
|
-
let fileContent;
|
|
50
|
-
try {
|
|
51
|
-
fileContent = fs.readFileSync(filePath, 'utf8');
|
|
52
|
-
} catch (error) {
|
|
53
|
-
throw new Error(`Error reading file: ${error.message}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Split content into lines for processing
|
|
57
|
-
const lines = fileContent.split('\n');
|
|
58
|
-
const resultLines = [];
|
|
59
|
-
|
|
60
|
-
// Track merge state
|
|
61
|
-
let hasUnresolvedConflicts = false;
|
|
62
|
-
let totalConflicts = 0;
|
|
63
|
-
let resolvedConflicts = 0;
|
|
64
|
-
|
|
65
|
-
// State variables for parsing
|
|
66
|
-
let inConflict = false;
|
|
67
|
-
let headLines = [];
|
|
68
|
-
let branchLines = [];
|
|
69
|
-
let currentSection = null; // 'head' or 'branch'
|
|
70
|
-
|
|
71
|
-
// Process each line
|
|
72
|
-
for (let i = 0; i < lines.length; i++) {
|
|
73
|
-
const line = lines[i];
|
|
74
|
-
|
|
75
|
-
if (line.startsWith('<<<<<<<')) {
|
|
76
|
-
// Start of conflict marker
|
|
77
|
-
inConflict = true;
|
|
78
|
-
currentSection = 'head';
|
|
79
|
-
headLines = [];
|
|
80
|
-
branchLines = [];
|
|
81
|
-
totalConflicts++;
|
|
82
|
-
} else if (inConflict && line.startsWith('=======')) {
|
|
83
|
-
// Middle of conflict - switch from HEAD to branch
|
|
84
|
-
currentSection = 'branch';
|
|
85
|
-
} else if (inConflict && line.startsWith('>>>>>>>')) {
|
|
86
|
-
// End of conflict marker - attempt to merge
|
|
87
|
-
const headContent = headLines.join('\n');
|
|
88
|
-
const branchContent = branchLines.join('\n');
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
// Call custom merge logic
|
|
92
|
-
const mergedContent = mergeLogic(headContent, branchContent);
|
|
93
|
-
|
|
94
|
-
// Add merged content to result
|
|
95
|
-
if (mergedContent !== null && mergedContent !== undefined) {
|
|
96
|
-
resultLines.push(mergedContent);
|
|
97
|
-
resolvedConflicts++;
|
|
98
|
-
console.log(`✓ Resolved conflict #${totalConflicts}`);
|
|
99
|
-
}
|
|
100
|
-
} catch (error) {
|
|
101
|
-
// Cannot merge this conflict - keep original conflict markers
|
|
102
|
-
hasUnresolvedConflicts = true;
|
|
103
|
-
|
|
104
|
-
console.log(
|
|
105
|
-
`✗ Could not resolve conflict #${totalConflicts}: ${error.message}`,
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
// Preserve the original conflict
|
|
109
|
-
resultLines.push(`<<<<<<< HEAD`);
|
|
110
|
-
resultLines.push(headContent);
|
|
111
|
-
resultLines.push('=======');
|
|
112
|
-
resultLines.push(branchContent);
|
|
113
|
-
resultLines.push(`>>>>>>> branch`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Reset conflict state
|
|
117
|
-
inConflict = false;
|
|
118
|
-
currentSection = null;
|
|
119
|
-
headLines = [];
|
|
120
|
-
branchLines = [];
|
|
121
|
-
} else if (inConflict) {
|
|
122
|
-
// Inside conflict - collect lines
|
|
123
|
-
if (currentSection === 'head') {
|
|
124
|
-
headLines.push(line);
|
|
125
|
-
} else if (currentSection === 'branch') {
|
|
126
|
-
branchLines.push(line);
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
// Normal line outside of conflict
|
|
130
|
-
resultLines.push(line);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Write the result back to the file
|
|
135
|
-
const resultContent = resultLines.join('\n');
|
|
136
|
-
try {
|
|
137
|
-
fs.writeFileSync(filePath, resultContent, 'utf8');
|
|
138
|
-
console.log(`\nFile updated: ${filePath}`);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
throw new Error(`Error writing file: ${error.message}`);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Summary
|
|
144
|
-
console.log('\n--- Merge Summary ---');
|
|
145
|
-
console.log(`Total conflicts found: ${totalConflicts}`);
|
|
146
|
-
console.log(`Conflicts resolved: ${resolvedConflicts}`);
|
|
147
|
-
console.log(`Conflicts remaining: ${totalConflicts - resolvedConflicts}`);
|
|
148
|
-
|
|
149
|
-
// If all conflicts were resolved, stage the file
|
|
150
|
-
if (!hasUnresolvedConflicts && totalConflicts > 0) {
|
|
151
|
-
try {
|
|
152
|
-
execSync(`git add "${filePath}"`, { stdio: 'inherit' });
|
|
153
|
-
console.log(
|
|
154
|
-
`\n✓ All conflicts resolved! File has been staged with 'git add'.`,
|
|
155
|
-
);
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error(`\nWarning: Could not stage file: ${error.message}`);
|
|
158
|
-
console.log('You may need to run "git add" manually.');
|
|
159
|
-
}
|
|
160
|
-
} else if (hasUnresolvedConflicts) {
|
|
161
|
-
console.log(`\n⚠ Some conflicts could not be resolved automatically.`);
|
|
162
|
-
console.log('Please review and resolve the remaining conflicts manually.');
|
|
163
|
-
} else if (totalConflicts === 0) {
|
|
164
|
-
console.log('\nNo conflicts found in the file.');
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Return result object for programmatic use
|
|
168
|
-
return {
|
|
169
|
-
success: !hasUnresolvedConflicts,
|
|
170
|
-
totalConflicts,
|
|
171
|
-
resolvedConflicts,
|
|
172
|
-
hasUnresolvedConflicts,
|
|
173
|
-
filePath,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Process multiple files with the same merge logic
|
|
179
|
-
* @param {string[]} filePaths - Array of file paths to process
|
|
180
|
-
* @param {Function} customMergeLogic - Custom merge function
|
|
181
|
-
* @returns {Promise<Array>} - Array of results for each file
|
|
182
|
-
*/
|
|
183
|
-
export async function mergeMultipleFiles(filePaths, customMergeLogic) {
|
|
184
|
-
const results = [];
|
|
185
|
-
|
|
186
|
-
for (const filePath of filePaths) {
|
|
187
|
-
try {
|
|
188
|
-
const result = await mergeDriver(filePath, customMergeLogic);
|
|
189
|
-
results.push(result);
|
|
190
|
-
} catch (error) {
|
|
191
|
-
console.error(`Error processing ${filePath}: ${error.message}`);
|
|
192
|
-
results.push({
|
|
193
|
-
success: false,
|
|
194
|
-
error: error.message,
|
|
195
|
-
filePath,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return results;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Default export for convenience
|
|
204
|
-
export default mergeDriver;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
// Get __dirname equivalent in ESM
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Default merge logic function - can be overridden
|
|
14
|
+
* @param {string} headContent - The content from HEAD (current branch)
|
|
15
|
+
* @param {string} branchContent - The content from the incoming branch
|
|
16
|
+
* @returns {string} - The merged content
|
|
17
|
+
* @throws {Error} - If the conflict cannot be automatically merged
|
|
18
|
+
*/
|
|
19
|
+
export function defaultMergeLogic(headContent, branchContent) {
|
|
20
|
+
// Default implementation - throws error
|
|
21
|
+
// Users should provide their own implementation
|
|
22
|
+
throw new Error(
|
|
23
|
+
'No merge logic provided - please pass a custom merge function',
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Main merge driver function
|
|
29
|
+
* @param {string} filePath - Path to the file with conflicts
|
|
30
|
+
* @param {Function} customMergeLogic - Custom merge function (optional)
|
|
31
|
+
* @returns {Promise<{success: boolean, totalConflicts: number, resolvedConflicts: number, hasUnresolvedConflicts: boolean}>}
|
|
32
|
+
*/
|
|
33
|
+
export async function mergeDriver(filePath, customMergeLogic = null) {
|
|
34
|
+
// Use provided merge logic or fall back to default
|
|
35
|
+
const mergeLogic = customMergeLogic || defaultMergeLogic;
|
|
36
|
+
|
|
37
|
+
if (!filePath) {
|
|
38
|
+
throw new Error('File path is required');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check if file exists
|
|
42
|
+
if (!fs.existsSync(filePath)) {
|
|
43
|
+
throw new Error(`File not found: ${filePath}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(`Processing conflicts in: ${filePath}`);
|
|
47
|
+
|
|
48
|
+
// Read the file content
|
|
49
|
+
let fileContent;
|
|
50
|
+
try {
|
|
51
|
+
fileContent = fs.readFileSync(filePath, 'utf8');
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw new Error(`Error reading file: ${error.message}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Split content into lines for processing
|
|
57
|
+
const lines = fileContent.split('\n');
|
|
58
|
+
const resultLines = [];
|
|
59
|
+
|
|
60
|
+
// Track merge state
|
|
61
|
+
let hasUnresolvedConflicts = false;
|
|
62
|
+
let totalConflicts = 0;
|
|
63
|
+
let resolvedConflicts = 0;
|
|
64
|
+
|
|
65
|
+
// State variables for parsing
|
|
66
|
+
let inConflict = false;
|
|
67
|
+
let headLines = [];
|
|
68
|
+
let branchLines = [];
|
|
69
|
+
let currentSection = null; // 'head' or 'branch'
|
|
70
|
+
|
|
71
|
+
// Process each line
|
|
72
|
+
for (let i = 0; i < lines.length; i++) {
|
|
73
|
+
const line = lines[i];
|
|
74
|
+
|
|
75
|
+
if (line.startsWith('<<<<<<<')) {
|
|
76
|
+
// Start of conflict marker
|
|
77
|
+
inConflict = true;
|
|
78
|
+
currentSection = 'head';
|
|
79
|
+
headLines = [];
|
|
80
|
+
branchLines = [];
|
|
81
|
+
totalConflicts++;
|
|
82
|
+
} else if (inConflict && line.startsWith('=======')) {
|
|
83
|
+
// Middle of conflict - switch from HEAD to branch
|
|
84
|
+
currentSection = 'branch';
|
|
85
|
+
} else if (inConflict && line.startsWith('>>>>>>>')) {
|
|
86
|
+
// End of conflict marker - attempt to merge
|
|
87
|
+
const headContent = headLines.join('\n');
|
|
88
|
+
const branchContent = branchLines.join('\n');
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
// Call custom merge logic
|
|
92
|
+
const mergedContent = mergeLogic(headContent, branchContent);
|
|
93
|
+
|
|
94
|
+
// Add merged content to result
|
|
95
|
+
if (mergedContent !== null && mergedContent !== undefined) {
|
|
96
|
+
resultLines.push(mergedContent);
|
|
97
|
+
resolvedConflicts++;
|
|
98
|
+
console.log(`✓ Resolved conflict #${totalConflicts}`);
|
|
99
|
+
}
|
|
100
|
+
} catch (error) {
|
|
101
|
+
// Cannot merge this conflict - keep original conflict markers
|
|
102
|
+
hasUnresolvedConflicts = true;
|
|
103
|
+
|
|
104
|
+
console.log(
|
|
105
|
+
`✗ Could not resolve conflict #${totalConflicts}: ${error.message}`,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Preserve the original conflict
|
|
109
|
+
resultLines.push(`<<<<<<< HEAD`);
|
|
110
|
+
resultLines.push(headContent);
|
|
111
|
+
resultLines.push('=======');
|
|
112
|
+
resultLines.push(branchContent);
|
|
113
|
+
resultLines.push(`>>>>>>> branch`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Reset conflict state
|
|
117
|
+
inConflict = false;
|
|
118
|
+
currentSection = null;
|
|
119
|
+
headLines = [];
|
|
120
|
+
branchLines = [];
|
|
121
|
+
} else if (inConflict) {
|
|
122
|
+
// Inside conflict - collect lines
|
|
123
|
+
if (currentSection === 'head') {
|
|
124
|
+
headLines.push(line);
|
|
125
|
+
} else if (currentSection === 'branch') {
|
|
126
|
+
branchLines.push(line);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
// Normal line outside of conflict
|
|
130
|
+
resultLines.push(line);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Write the result back to the file
|
|
135
|
+
const resultContent = resultLines.join('\n');
|
|
136
|
+
try {
|
|
137
|
+
fs.writeFileSync(filePath, resultContent, 'utf8');
|
|
138
|
+
console.log(`\nFile updated: ${filePath}`);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
throw new Error(`Error writing file: ${error.message}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Summary
|
|
144
|
+
console.log('\n--- Merge Summary ---');
|
|
145
|
+
console.log(`Total conflicts found: ${totalConflicts}`);
|
|
146
|
+
console.log(`Conflicts resolved: ${resolvedConflicts}`);
|
|
147
|
+
console.log(`Conflicts remaining: ${totalConflicts - resolvedConflicts}`);
|
|
148
|
+
|
|
149
|
+
// If all conflicts were resolved, stage the file
|
|
150
|
+
if (!hasUnresolvedConflicts && totalConflicts > 0) {
|
|
151
|
+
try {
|
|
152
|
+
execSync(`git add "${filePath}"`, { stdio: 'inherit' });
|
|
153
|
+
console.log(
|
|
154
|
+
`\n✓ All conflicts resolved! File has been staged with 'git add'.`,
|
|
155
|
+
);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error(`\nWarning: Could not stage file: ${error.message}`);
|
|
158
|
+
console.log('You may need to run "git add" manually.');
|
|
159
|
+
}
|
|
160
|
+
} else if (hasUnresolvedConflicts) {
|
|
161
|
+
console.log(`\n⚠ Some conflicts could not be resolved automatically.`);
|
|
162
|
+
console.log('Please review and resolve the remaining conflicts manually.');
|
|
163
|
+
} else if (totalConflicts === 0) {
|
|
164
|
+
console.log('\nNo conflicts found in the file.');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Return result object for programmatic use
|
|
168
|
+
return {
|
|
169
|
+
success: !hasUnresolvedConflicts,
|
|
170
|
+
totalConflicts,
|
|
171
|
+
resolvedConflicts,
|
|
172
|
+
hasUnresolvedConflicts,
|
|
173
|
+
filePath,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Process multiple files with the same merge logic
|
|
179
|
+
* @param {string[]} filePaths - Array of file paths to process
|
|
180
|
+
* @param {Function} customMergeLogic - Custom merge function
|
|
181
|
+
* @returns {Promise<Array>} - Array of results for each file
|
|
182
|
+
*/
|
|
183
|
+
export async function mergeMultipleFiles(filePaths, customMergeLogic) {
|
|
184
|
+
const results = [];
|
|
185
|
+
|
|
186
|
+
for (const filePath of filePaths) {
|
|
187
|
+
try {
|
|
188
|
+
const result = await mergeDriver(filePath, customMergeLogic);
|
|
189
|
+
results.push(result);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error(`Error processing ${filePath}: ${error.message}`);
|
|
192
|
+
results.push({
|
|
193
|
+
success: false,
|
|
194
|
+
error: error.message,
|
|
195
|
+
filePath,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return results;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Default export for convenience
|
|
204
|
+
export default mergeDriver;
|