Skip to content

Commit

Permalink
update_version: ulu-version
Browse files Browse the repository at this point in the history
  • Loading branch information
iower committed Nov 30, 2023
1 parent f7aecd2 commit 3a38289
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions .ulu-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
17 changes: 14 additions & 3 deletions deploy/update_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,28 @@ const ROOT_PATH = `${path.dirname(__filename)}/..`;
const PATCH_VERSION_PATH = `${ROOT_PATH}/.patch-version`;
const PACKAGE_JSON_PATH = `${ROOT_PATH}/package.json`;
const VERSION_TXT_PATH = `${ROOT_PATH}/public/version.txt`;
const ULU_VERSION_PATH = `${ROOT_PATH}/.ulu-version`;

// This patch value is used to override the one from package.json
const currentPatch = fs.existsSync(PATCH_VERSION_PATH) ? Number(fs.readFileSync(PATCH_VERSION_PATH, 'utf-8')) : -1;
// ulu: custom versioning
// const currentPatch = fs.existsSync(PATCH_VERSION_PATH) ? Number(fs.readFileSync(PATCH_VERSION_PATH, 'utf-8')) : -1;
const currentPatch = fs.existsSync(PATCH_VERSION_PATH) ? Number(fs.readFileSync(PATCH_VERSION_PATH, 'utf-8')) : 0;
const packageJsonContent = fs.readFileSync(PACKAGE_JSON_PATH, 'utf-8');
const currentVersion = JSON.parse(packageJsonContent).version;
const [major, minor] = currentVersion.split('.');

const newPatch = currentPatch + 1;
const newVersion = [major, minor, newPatch].join('.');
const uluVersion = fs.existsSync(ULU_VERSION_PATH) ? Number(fs.readFileSync(ULU_VERSION_PATH, 'utf-8')) : 0;
const newUluVersion = uluVersion + 1;

// ulu: custom versioning
// const newPatch = currentPatch + 1;
const newPatch = currentPatch;
// const newVersion = [major, minor, newPatch].join('.');
const newVersion = [major, minor, newPatch].join('.') + '-' + newUluVersion;
// ulu: custom versioning
const newPackageJsonContent = packageJsonContent.replace(`"version": "${currentVersion}"`, `"version": "${newVersion}"`);

fs.writeFileSync(PATCH_VERSION_PATH, String(newPatch), 'utf-8');
fs.writeFileSync(PACKAGE_JSON_PATH, newPackageJsonContent, 'utf-8');
fs.writeFileSync(VERSION_TXT_PATH, newVersion, 'utf-8');
fs.writeFileSync(ULU_VERSION_PATH, String(newUluVersion), 'utf-8');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "telegram-t",
"version": "10.0.21+2",
"version": "10.0.21-1",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.21
10.0.21-1

0 comments on commit 3a38289

Please sign in to comment.