feat(reliability): WhatsApp Web version caching (#1847)
* feat: use specific whatsapp web version * add constants to version updater * configurable caches * rename * typings * rm extraneous export * missing from the rename * rm version resolver * match readme version * use try-catch * only persist if cache miss
This commit is contained in:
parent
915763a8d0
commit
8ae0c0d484
9 changed files with 197 additions and 9 deletions
|
|
@ -18,15 +18,24 @@ const getCurrentVersion = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const updateVersion = async (oldVersion, newVersion) => {
|
||||
const readmePath = '../../README.md';
|
||||
|
||||
const readme = fs.readFileSync(readmePath);
|
||||
const newReadme = readme.toString().replaceAll(oldVersion, newVersion);
|
||||
const updateInFile = (filePath, oldVersion, newVersion) => {
|
||||
const originalFile = fs.readFileSync(filePath);
|
||||
const newFile = originalFile.toString().replaceAll(oldVersion, newVersion);
|
||||
|
||||
fs.writeFileSync(readmePath, newReadme);
|
||||
fs.writeFileSync('./.version', newVersion);
|
||||
|
||||
fs.writeFileSync(filePath, newFile);
|
||||
};
|
||||
|
||||
const updateVersion = async (oldVersion, newVersion) => {
|
||||
const filesToUpdate = [
|
||||
'../../src/util/Constants.js',
|
||||
'../../README.md',
|
||||
];
|
||||
|
||||
for (const file of filesToUpdate) {
|
||||
updateInFile(file, oldVersion, newVersion);
|
||||
}
|
||||
|
||||
fs.writeFileSync('./.version', newVersion);
|
||||
};
|
||||
|
||||
(async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue