zephyr-xpack-internal
Version:
Xpack internals for Zephyr
28 lines (27 loc) • 649 B
JavaScript
import "node:module";
import { execSync } from "node:child_process";
let gitSha;
try {
gitSha = execSync('git rev-parse HEAD', {
encoding: 'utf8',
stdio: [
'pipe',
'pipe',
'pipe'
]
}).toString().trim();
} catch {
gitSha = void 0;
}
const computeVersionStrategy = (stats, arg)=>{
switch(arg){
case 'gitSha':
return gitSha;
case 'buildHash':
return stats.hash;
default:
return arg ? arg.toString() : gitSha;
}
};
export { computeVersionStrategy, gitSha };
//# sourceMappingURL=compute-version-strategy.mjs.map