Last active
August 19, 2021 22:27
-
-
Save psenger/f2fde8783f70a541f10453ac9395cc8b to your computer and use it in GitHub Desktop.
[How to generate a GIT Hash Version for APIS and Programs] #git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gen-version.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { build } from '../.gen-version.js' | |
console.log(build); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rev-parse --short HEAD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"prebuild": "npm run gen-version", | |
"gen-version": "cat > .gen-version.js <<EOF \nexport const build = { gitHubHash: '`git rev-parse --short HEAD`', timeStamp:'`date`' };\nEOF" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment