mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 20:49:14 +00:00
add constants to version updater
This commit is contained in:
@@ -18,15 +18,24 @@ const getCurrentVersion = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateInFile = (filePath, oldVersion, newVersion) => {
|
||||||
|
const originalFile = fs.readFileSync(filePath);
|
||||||
|
const newFile = originalFile.toString().replaceAll(oldVersion, newVersion);
|
||||||
|
|
||||||
|
fs.writeFileSync(filePath, newFile);
|
||||||
|
};
|
||||||
|
|
||||||
const updateVersion = async (oldVersion, newVersion) => {
|
const updateVersion = async (oldVersion, newVersion) => {
|
||||||
const readmePath = '../../README.md';
|
const filesToUpdate = [
|
||||||
|
'../../src/util/Constants.js',
|
||||||
|
'../../README.md',
|
||||||
|
];
|
||||||
|
|
||||||
const readme = fs.readFileSync(readmePath);
|
for (const file of filesToUpdate) {
|
||||||
const newReadme = readme.toString().replaceAll(oldVersion, newVersion);
|
updateInFile(file, oldVersion, newVersion);
|
||||||
|
}
|
||||||
|
|
||||||
fs.writeFileSync(readmePath, newReadme);
|
|
||||||
fs.writeFileSync('./.version', newVersion);
|
fs.writeFileSync('./.version', newVersion);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user