cob-cli 2.39.4 → 2.39.6
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.
|
@@ -222,10 +222,12 @@ function copyAndMerge(customizationRepoName, source, substitutions = {}) {
|
|
|
222
222
|
console.log(error.map((e) => e.message).join("\n"))
|
|
223
223
|
} else {
|
|
224
224
|
// Only run this on the last call
|
|
225
|
-
for
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
//Allow a little time for file to be written to disk
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
for(let file of filesToMerge) {
|
|
228
|
+
mergeFiles(customizationRepoName, file)
|
|
229
|
+
}
|
|
230
|
+
}, 200)
|
|
229
231
|
}
|
|
230
232
|
}
|
|
231
233
|
)
|
|
@@ -246,27 +248,24 @@ function mergeFiles(block,mergeFile) {
|
|
|
246
248
|
console.log(" Creating " + prodFile);
|
|
247
249
|
fs.closeSync(fs.openSync(prodFile, "w"));
|
|
248
250
|
} else {
|
|
249
|
-
fs.open(prodFile, "a+",(err, fd) => {
|
|
250
|
-
fs.fdatasync(fd /*, optional callback here */);
|
|
251
|
-
})
|
|
252
251
|
console.log(" Merging " + prodFile + " " + block);
|
|
253
252
|
}
|
|
254
253
|
let prodFileContent = fs.readFileSync(prodFile).toString();
|
|
255
254
|
let mergeFileContent = fs.readFileSync(mergeFile).toString();
|
|
256
255
|
// With comments we support JS, CSS, GROOVY
|
|
257
|
-
let startStr = "/* COB-CLI START " + blockMark + "
|
|
256
|
+
let startStr = "/* COB-CLI START " + blockMark + " */";
|
|
258
257
|
let endStr = "\n/* COB-CLI END " + blockMark + " */";
|
|
259
258
|
|
|
260
259
|
if (prodFileContent.indexOf(startStr) < 0) {
|
|
261
260
|
// If previous customization does not exist
|
|
262
|
-
prodFileContent = startStr + mergeFileContent + endStr + "\n" + prodFileContent;
|
|
261
|
+
prodFileContent = startStr + "\n" + mergeFileContent + endStr + "\n" + prodFileContent;
|
|
263
262
|
} else {
|
|
264
263
|
// If previous customization exists
|
|
265
264
|
let beforeMerge = prodFileContent.indexOf(startStr);
|
|
266
265
|
let afterMerge = prodFileContent.indexOf(endStr) + endStr.length;
|
|
267
266
|
prodFileContent =
|
|
268
267
|
prodFileContent.substring(0, beforeMerge) +
|
|
269
|
-
startStr +
|
|
268
|
+
startStr + "\n" +
|
|
270
269
|
mergeFileContent +
|
|
271
270
|
endStr +
|
|
272
271
|
prodFileContent.substring(afterMerge);
|
package/package.json
CHANGED