Add commit hash to footer for deployment verification
- Display git commit hash in footer to track deployed version - Create cross-platform build script to inject commit hash - Update build process to include version information 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3cc65c3a1e
commit
f6ddce9290
5 changed files with 65 additions and 3 deletions
|
@ -12,7 +12,12 @@
|
||||||
"Bash(git push:*)",
|
"Bash(git push:*)",
|
||||||
"Bash(git commit:*)",
|
"Bash(git commit:*)",
|
||||||
"Bash(git pull:*)",
|
"Bash(git pull:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(git push:*)",
|
||||||
|
"Bash(git reset:*)",
|
||||||
|
"Bash(git checkout:*)",
|
||||||
|
"WebFetch(domain:cheatingchelsea.com)",
|
||||||
|
"Bash(npm install:*)"
|
||||||
],
|
],
|
||||||
"deny": []
|
"deny": []
|
||||||
}
|
}
|
||||||
|
|
20
package-lock.json
generated
20
package-lock.json
generated
|
@ -58,6 +58,7 @@
|
||||||
"@types/react-dom": "^18",
|
"@types/react-dom": "^18",
|
||||||
"aws-cdk-lib": "^2.189.1",
|
"aws-cdk-lib": "^2.189.1",
|
||||||
"constructs": "^10.4.2",
|
"constructs": "^10.4.2",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"esbuild": "^0.25.5",
|
"esbuild": "^0.25.5",
|
||||||
"eslint": "^9.30.0",
|
"eslint": "^9.30.0",
|
||||||
"eslint-config-next": "15.3.4",
|
"eslint-config-next": "15.3.4",
|
||||||
|
@ -5633,6 +5634,25 @@
|
||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cross-env": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cross-spawn": "^7.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"cross-env": "src/bin/cross-env.js",
|
||||||
|
"cross-env-shell": "src/bin/cross-env-shell.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.14",
|
||||||
|
"npm": ">=6",
|
||||||
|
"yarn": ">=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.6",
|
"version": "7.0.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
"dev": "next dev --turbopack -p 9002",
|
"dev": "next dev --turbopack -p 9002",
|
||||||
"genkit:dev": "genkit start -- tsx src/ai/dev.ts",
|
"genkit:dev": "genkit start -- tsx src/ai/dev.ts",
|
||||||
"genkit:watch": "genkit start -- tsx --watch src/ai/dev.ts",
|
"genkit:watch": "genkit start -- tsx --watch src/ai/dev.ts",
|
||||||
"build": "next build",
|
"build": "node scripts/set-git-commit.js && next build",
|
||||||
"build:static": "next build",
|
"build:static": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"deploy:s3": "npm run build:static && aws s3 sync out/ s3://$S3_BUCKET_NAME --delete",
|
"deploy:s3": "npm run build && aws s3 sync out/ s3://$S3_BUCKET_NAME --delete",
|
||||||
"create-s3-bucket": "node scripts/create-s3-bucket.js",
|
"create-s3-bucket": "node scripts/create-s3-bucket.js",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
|
@ -66,6 +66,7 @@
|
||||||
"@types/react-dom": "^18",
|
"@types/react-dom": "^18",
|
||||||
"aws-cdk-lib": "^2.189.1",
|
"aws-cdk-lib": "^2.189.1",
|
||||||
"constructs": "^10.4.2",
|
"constructs": "^10.4.2",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"esbuild": "^0.25.5",
|
"esbuild": "^0.25.5",
|
||||||
"eslint": "^9.30.0",
|
"eslint": "^9.30.0",
|
||||||
"eslint-config-next": "15.3.4",
|
"eslint-config-next": "15.3.4",
|
||||||
|
|
33
scripts/set-git-commit.js
Normal file
33
scripts/set-git-commit.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Get the short commit hash
|
||||||
|
const gitCommit = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
|
|
||||||
|
// Create .env.local file with the commit hash
|
||||||
|
const envContent = `NEXT_PUBLIC_GIT_COMMIT=${gitCommit}\n`;
|
||||||
|
const envPath = path.join(process.cwd(), '.env.local');
|
||||||
|
|
||||||
|
// Read existing .env.local if it exists
|
||||||
|
let existingContent = '';
|
||||||
|
if (fs.existsSync(envPath)) {
|
||||||
|
existingContent = fs.readFileSync(envPath, 'utf8');
|
||||||
|
// Remove any existing NEXT_PUBLIC_GIT_COMMIT line
|
||||||
|
existingContent = existingContent.split('\n')
|
||||||
|
.filter(line => !line.startsWith('NEXT_PUBLIC_GIT_COMMIT='))
|
||||||
|
.join('\n');
|
||||||
|
if (existingContent && !existingContent.endsWith('\n')) {
|
||||||
|
existingContent += '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the updated content
|
||||||
|
fs.writeFileSync(envPath, existingContent + envContent);
|
||||||
|
|
||||||
|
console.log(`Git commit hash set: ${gitCommit}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error setting git commit:', error.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
|
@ -29,6 +29,9 @@ export function Footer() {
|
||||||
and is not affiliated with or endorsed by Kristen Jacobs.
|
and is not affiliated with or endorsed by Kristen Jacobs.
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-2">© {new Date().getFullYear()} Cheating Chelsea Exposed. All Rights Reserved.</p>
|
<p className="mt-2">© {new Date().getFullYear()} Cheating Chelsea Exposed. All Rights Reserved.</p>
|
||||||
|
<p className="mt-1 text-xs text-muted-foreground/50">
|
||||||
|
Build: {process.env.NEXT_PUBLIC_GIT_COMMIT || 'development'}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue