Update package.json and version.json
This commit is contained in:
42
version.js
Normal file
42
version.js
Normal file
@ -0,0 +1,42 @@
|
||||
// build-and-push.js
|
||||
const { exec, writeFile } = require('child_process')
|
||||
const fs = require('fs')
|
||||
|
||||
function setVersion(version) {
|
||||
var packageFile = require('./package.json')
|
||||
packageFile = {
|
||||
...packageFile,
|
||||
version: version
|
||||
}
|
||||
const packageJsonPath = './package.json'
|
||||
fs.writeFile(packageJsonPath, JSON.stringify(packageFile), (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing package.json', err)
|
||||
return
|
||||
}
|
||||
console.log('package.json updated successfully')
|
||||
|
||||
const versionData = {
|
||||
version: version
|
||||
}
|
||||
const versionJsonPath = './public/version.json'
|
||||
|
||||
fs.writeFile(versionJsonPath, JSON.stringify(versionData), (err) => {
|
||||
if (err) {
|
||||
console.error('Error writing version.json', err)
|
||||
return
|
||||
}
|
||||
console.log('version.json updated successfully')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Ambil argumen versi dari command line
|
||||
const version = process.argv[2]
|
||||
|
||||
if (!version) {
|
||||
console.error('Usage: node version.js <version>')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
setVersion(version)
|
Reference in New Issue
Block a user