Do not use git to get version number

This commit is contained in:
KernelDeimos
2024-04-11 13:57:29 -04:00
parent 9ab3e3ccd8
commit e3d238f897
2 changed files with 4 additions and 12 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@heyputer/backend",
"version": "1.0.0",
"version": "2.0.2",
"description": "Backend/Kernel for Puter",
"main": "exports.js",
"scripts": {
@@ -60,27 +60,19 @@ class PuterVersionService extends AdvancedBase {
}
get_version () {
let git_version;
let deploy_timestamp;
if ( this.config.env === 'dev' ) {
// get commit hash from git
git_version = this.modules._exec('git describe --tags', {
cwd: this.modules._path.join(__dirname, '../../'),
encoding: 'utf8',
}).trim();
deploy_timestamp = Date.now();
} else {
// get git version from file
const path = this.modules._path.join(__dirname, '../../git_version');
git_version = this.modules.fs.readFileSync(path, 'utf8').trim();
deploy_timestamp = Number.parseInt((this.modules.fs.readFileSync(
this.modules._path.join(__dirname, '../../deploy_timestamp'),
'utf8'
)).trim());
}
const version = process.env.npm_package_version ||
require('../../package.json').version;
return {
version: git_version,
version,
environment: this.config.env,
location: this.config.server_id,
deploy_timestamp,