refactor: updated vite config to inject add version metadata into the app on build (#841)
* refactor: removes commit.json and used vite.config to load these variables * updated precommit hook * updated the pre start script * updated the workflows
This commit is contained in:
@@ -1,4 +1,18 @@
|
||||
const { commit } = require('./app/commit.json');
|
||||
const { execSync } =require('child_process');
|
||||
|
||||
// Get git hash with fallback
|
||||
const getGitHash = () => {
|
||||
try {
|
||||
return execSync('git rev-parse --short HEAD').toString().trim();
|
||||
} catch {
|
||||
return 'no-git-info';
|
||||
}
|
||||
};
|
||||
|
||||
let commitJson = {
|
||||
hash: JSON.stringify(getGitHash()),
|
||||
version: JSON.stringify(process.env.npm_package_version),
|
||||
};
|
||||
|
||||
console.log(`
|
||||
★═══════════════════════════════════════★
|
||||
@@ -6,6 +20,7 @@ console.log(`
|
||||
⚡️ Welcome ⚡️
|
||||
★═══════════════════════════════════════★
|
||||
`);
|
||||
console.log('📍 Current Commit Version:', commit);
|
||||
console.log(' Please wait until the URL appears here')
|
||||
console.log('★═══════════════════════════════════════★');
|
||||
console.log('📍 Current Version Tag:', `v${commitJson.version}`);
|
||||
console.log('📍 Current Commit Version:', commitJson.hash);
|
||||
console.log(' Please wait until the URL appears here');
|
||||
console.log('★═══════════════════════════════════════★');
|
||||
|
||||
Reference in New Issue
Block a user