mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			527 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			527 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import child_process from "child_process";
 | 
						|
import fs from "fs";
 | 
						|
 | 
						|
function getBuildDate() {
 | 
						|
    const now = new Date();
 | 
						|
    now.setMilliseconds(0);
 | 
						|
    return now
 | 
						|
        .toISOString()
 | 
						|
        .replace(".000", "");
 | 
						|
}
 | 
						|
 | 
						|
function getGitRevision() {
 | 
						|
    return child_process.execSync('git log -1 --format="%H"')
 | 
						|
        .toString("utf-8")
 | 
						|
        .trimEnd();
 | 
						|
}
 | 
						|
 | 
						|
const output = `\
 | 
						|
export default {
 | 
						|
    buildDate: "${getBuildDate()}",
 | 
						|
    buildRevision: "${getGitRevision()}"
 | 
						|
};
 | 
						|
`;
 | 
						|
 | 
						|
fs.writeFileSync("src/services/build.ts", output); |