@docupace/pipeline 1.0.77 → 1.0.79

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.
Files changed (69) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/README.md +135 -135
  3. package/bin/azuread_update_callbacks_for_app.sh +58 -58
  4. package/bin/next-changeset-validate.sh +8 -8
  5. package/bitbucket-pipelines.yml +59 -59
  6. package/eslint.config.js +49 -49
  7. package/jest.config.js +15 -15
  8. package/next/changeset.sh +75 -75
  9. package/next/copy.sh +34 -34
  10. package/next/deploy.sh +40 -40
  11. package/next/execute.sh +123 -123
  12. package/next/sonar.sh +23 -23
  13. package/package.json +1 -1
  14. package/src/auth0/alias.js +79 -79
  15. package/src/auth0/alias.test.js +172 -172
  16. package/src/auth0/cli.js +82 -82
  17. package/src/auth0/configure.js +902 -902
  18. package/src/auth0/configure.test.js +167 -167
  19. package/src/auth0/export.js +48 -48
  20. package/src/auth0/export.test.js +103 -103
  21. package/src/auth0/metadata.js +141 -141
  22. package/src/auth0/metadata.test.js +186 -186
  23. package/src/auth0/vault.js +60 -60
  24. package/src/auth0/vault.test.js +134 -134
  25. package/src/changeset/changelog-wiki.js +328 -328
  26. package/src/changeset/changeset-config.js +34 -34
  27. package/src/changeset/cli.js +237 -237
  28. package/src/changeset/create.js +215 -215
  29. package/src/changeset/package-util.js +87 -87
  30. package/src/changeset/util.js +43 -43
  31. package/src/changeset/validate.js +91 -91
  32. package/src/changeset/version.js +102 -102
  33. package/src/jenkins/setParams.groovy +58 -58
  34. package/src/lib/merge-driver.js +204 -204
  35. package/src/merge/cli-merge-all.js +507 -507
  36. package/src/merge/cli-merge.js +492 -492
  37. package/src/merge/cli-resolve.js +399 -399
  38. package/src/merge/cli.js +38 -38
  39. package/src/merge/merge-changelog.js +87 -87
  40. package/src/merge/merge-package.js +106 -106
  41. package/src/merge/merge-types.js +82 -82
  42. package/src/merge/pr.js +231 -231
  43. package/src/micro/deploy-microservice.js +153 -0
  44. package/src/micro/{ms-publish.js → publish-ms.js} +8 -6
  45. package/src/next/alias.js +53 -53
  46. package/src/next/apache.js +81 -81
  47. package/src/next/cli.js +10 -1
  48. package/src/next/config.js +137 -137
  49. package/src/next/connect.js +226 -226
  50. package/src/next/copy.js +61 -61
  51. package/src/next/deploy.js +666 -633
  52. package/src/next/git-to-semver.js +79 -79
  53. package/src/next/haproxy.js +76 -76
  54. package/src/next/jenkins.js +123 -123
  55. package/src/next/jira.js +84 -84
  56. package/src/next/logger.js +17 -17
  57. package/src/next/pipline.js +114 -114
  58. package/src/next/publish.js +71 -71
  59. package/src/next/pull.js +7 -7
  60. package/src/next/sonar.js +23 -23
  61. package/src/next/test.js +5 -5
  62. package/src/next/util.js +95 -93
  63. package/src/next/vault.js +45 -45
  64. package/terraform/apply.sh +37 -37
  65. package/terraform/init.sh +72 -72
  66. package/terraform/plan.sh +76 -76
  67. package/terraform/validate.sh +17 -17
  68. package/src/micro/cli.js +0 -71
  69. package/src/micro/ms-deploy.js +0 -271
@@ -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;