Added update checker

This commit is contained in:
RemixDev
2022-01-13 01:33:29 +01:00
parent 018b008915
commit b9e2fd298e
9 changed files with 152 additions and 71 deletions

16
scripts/gen-version.js Normal file
View File

@@ -0,0 +1,16 @@
const { execSync } = require('child_process')
function generateVersion(){
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth()+1;
const day = now.getDate();
const commitsNumber = String(execSync('git rev-list --count HEAD')).trim()
const commitHash = String(execSync('git rev-parse --short=10 HEAD')).trim()
return `${year}.${month}.${day}-r${commitsNumber}.${commitHash}`
}
console.log(generateVersion())
module.exports = generateVersion

View File

@@ -1,17 +1,5 @@
const { execSync } = require('child_process')
const fs = require('fs')
function generateVersion(){
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth()+1;
const day = now.getDate();
const commitsNumber = String(execSync('git rev-list --count HEAD')).trim()
const commitHash = String(execSync('git rev-parse --short=10 HEAD')).trim()
return `${year}.${month}.${day}-r${commitsNumber}.${commitHash}`
}
const generateVersion = require('./gen-version.js')
let package = JSON.parse(fs.readFileSync('package.json'))
package.version = generateVersion()