mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	
		
			
	
	
		
			25 lines
		
	
	
		
			521 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			521 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 = { | ||
|  |     buildDate: "${getBuildDate()}", | ||
|  |     buildRevision: "${getGitRevision()}" | ||
|  | }; | ||
|  | `;
 | ||
|  | 
 | ||
|  | fs.writeFileSync("src/services/build.ts", output); |