diff --git a/.patch-version b/.patch-version deleted file mode 100644 index 410b14d2c..000000000 --- a/.patch-version +++ /dev/null @@ -1 +0,0 @@ -25 \ No newline at end of file diff --git a/deploy/update_version.js b/deploy/update_version.js deleted file mode 100644 index 81ac7919c..000000000 --- a/deploy/update_version.js +++ /dev/null @@ -1,21 +0,0 @@ -const path = require('path'); -const fs = require('fs'); - -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`; - -// 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; -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 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'); diff --git a/package.json b/package.json index 491eaec18..926bac6d6 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,13 @@ "build:staging": "cross-env APP_ENV=staging npm run build:dev", "build:mocked": "cross-env APP_ENV=test APP_MOCKED_CLIENT=1 npm run build:dev", "build:production": "webpack && bash ./deploy/copy_to_dist.sh", - "web:release:production": "npm run update_version && npm i && npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push", + "web:release:production": "npm i && npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push", "electron:dev": "npm run electron:webpack && IS_ELECTRON_BUILD=true concurrently -n main,renderer,electron \"npm run electron:webpack -- --watch\" \"npm run dev\" \"electronmon dist/electron\"", "electron:webpack": "cross-env APP_ENV=$ENV webpack --config ./webpack-electron.config.ts", "electron:build": "IS_ELECTRON_BUILD=true npm run build:$ENV && electron-builder install-app-deps && electron-rebuild && ENV=$ENV npm run electron:webpack", "electron:package": "npm run electron:build && npx rimraf dist-electron && electron-builder build --win --mac --linux --config src/electron/config.yml", "electron:package:staging": "ENV=staging npm run electron:package -- -p never", "electron:release:production": "ENV=production npm run electron:package -- -p always", - "update_version": "node ./deploy/update_version.js", "telegraph:update_changelog": "node ./dev/telegraphChangelog.js", "check": "tsc && stylelint \"**/*.{css,scss}\" && eslint . --ext .ts,.tsx,.js --ignore-pattern src/lib/gramjs", "check:fix": "npm run check -- --fix", @@ -32,7 +31,7 @@ "statoscope:validate-diff": "statoscope validate --input input.json --reference reference.json", "prepare": "husky install", "postinstall": "(cd dev/eslint-multitab && npm i)", - "postversion": "rm -rf .patch-version && npm run update_version" + "postversion": "echo $(node -p \"require('./package.json').version\") > public/version.txt && git commit --amend --no-verify --no-edit public/version.txt" }, "engines": { "node": "^18 || ^20",