Skip to content

Commit

Permalink
remove spaces that were causing mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
anyoussefinia committed Oct 18, 2024
1 parent fece78a commit 2a56aca
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions services/ui-src/remove-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ const removeVersionFromFiles = (dir) => {
console.log(`Original content of ${file}:`);
console.log(data); // Log original content

// Replace the exact version string
const oldVersion = 'Bn.VERSION = "4.17.21"';
const newVersion = 'Bn.VERSION = "NEW_VERSION"'; // Change this to your desired new version

const result = data.replace(oldVersion, newVersion);
// Replace the version pattern only if it matches the Bn.VERSION line
const regex = /(Bn\.VERSION=")(4\.\d{2}\.\d{2})(")/;
const result = data.replace(regex, 'Bn.VERSION=""');

if (data !== result) {
console.log(`Updated content of ${file}:`);
console.log(result); // Log updated content
} else {
console.log(`No matching version found in ${file}`);
console.log(`No version found in ${file}`);
}

// Write the modified content back to the file
fs.writeFile(filePath, result, 'utf8', (err) => {
if (err) {
console.error("Error writing file:", err);
} else {
console.log(`Version updated in ${file}`);
console.log(`Version removed from ${file}`);
}
});
});
Expand Down

0 comments on commit 2a56aca

Please sign in to comment.