Files
ofvp_Server/.github/ChangeVersion.js
T
2021-10-14 21:23:28 -03:00

13 lines
580 B
JavaScript

#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const packageJsonPath = path.resolve(__dirname, "..", "package.json");
const Package_JSon = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
const run_ID = process.env.RunID || Math.random().toString().slice(-14) + Math.random().toString().slice(-14);
Package_JSon.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
fs.writeFileSync(packageJsonPath, JSON.stringify(Package_JSon, null, 2));
console.log((JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))).version);