Added update checker
This commit is contained in:
16
scripts/gen-version.js
Normal file
16
scripts/gen-version.js
Normal 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
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user