A babel plugin that generate and insert git information into the files during compilation.
Use yarn:
yarn add babel-plugin-git-info --dev
or npm:
npm install babel-plugin-git-info --save-dev
Without options:
{
"plugins": [
"babel-plugin-git-info"
]
}
With options:
{
"plugins": [
["babel-plugin-git-info", { "hashLength": 10 } ]
]
}
babel --plugins babel-plugin-git-info script.js
require("@babel/core").transform("code", {
plugins: ["babel-plugin-git-info"]
});
number
, defaults to -1
, which means to remain the full length of commit hash.