Skip to content

Instantly share code, notes, and snippets.

@psenger
Last active August 19, 2021 22:27
Show Gist options
  • Save psenger/f2fde8783f70a541f10453ac9395cc8b to your computer and use it in GitHub Desktop.
Save psenger/f2fde8783f70a541f10453ac9395cc8b to your computer and use it in GitHub Desktop.
[How to generate a GIT Hash Version for APIS and Programs] #git
.gen-version.js
import { build } from '../.gen-version.js'
console.log(build);
git rev-parse --short HEAD
{
"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