Fixing commit in build
This commit is contained in:
parent
93a735193b
commit
8009c6a2ed
|
@ -53,7 +53,7 @@ async function main(){
|
|||
if(filepath.endsWith("git.js")){
|
||||
let commit = child_process.execSync("git rev-parse HEAD").toString()
|
||||
console.info(`Obtained commit ${commit} for the compilation`)
|
||||
await fs.promises.writeFile(newpath, terser.minify((await fs.promises.readFile(filepath, "utf8")).replace("{commit}", commit)).code, "utf8")
|
||||
await fs.promises.writeFile(newpath, terser.minify(fs.readFileSync(filepath, "utf8").replace(/"{commit}"/g, `"${commit.split("\n")[0]}"`)).code, "utf8")
|
||||
}else{
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import * as child_process from "child_process"
|
||||
|
||||
let commit_id = "{commit}"
|
||||
|
||||
const defaultString = Buffer.from([
|
||||
123, 99, 111,
|
||||
109, 109, 105,
|
||||
116, 125
|
||||
]).toString("utf8")
|
||||
export function getCommitID(){
|
||||
if(commit_id === "{" + "commit}"){
|
||||
if(commit_id === defaultString){
|
||||
try{
|
||||
return commit_id = child_process.execSync("git rev-parse HEAD").toString()
|
||||
}catch(e){
|
||||
|
|
Loading…
Reference in New Issue