@ehmicky/dev-tasks
Version:
Automated development tasks for my own projects
24 lines (17 loc) • 461 B
JavaScript
import spawn from"nano-spawn";
import{valid}from"semver";
export const printAutoChangelog=async()=>{
const{stdout:lastTag}=await spawn("git",["describe","--abbrev=0"]);
if(valid(lastTag)===null){
throw new TypeError("Could not find last git tag.")
}
const{stdout:changelog}=await spawn("git",[
"log",
"--pretty=format:* %s (%h)",
`${lastTag}..HEAD`]
);
if(changelog.trim()===""){
throw new TypeError("Empty changelog.")
}
console.log(changelog.trim())
};