/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/grunt-bump@0.8.0/tasks/bump.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var semver=require("semver"),exec=require("child_process").exec;module.exports=function(e){var t="Increment the version, commit, tag and push.";e.registerTask("bump",t,(function(t,n){var i=this.options({bumpVersion:!0,commit:!0,commitFiles:["package.json"],commitMessage:"Release v%VERSION%",createTag:!0,dryRun:!1,files:["package.json"],gitCommitOptions:"",gitDescribeOptions:"--tags --always --abbrev=1 --dirty=-d",globalReplace:!1,prereleaseName:!1,metadata:"",push:!0,pushTo:"upstream",regExp:!1,setVersion:!1,tagMessage:"Version %VERSION%",tagName:"v%VERSION%",updateConfigs:[],versionType:!1});"bump-only"!==t&&"commit-only"!==t||(n=t,t=""),t=t||i.versionType;var o,a,r=e.option("dry-run")||i.dryRun,s=e.option("setversion")||i.setVersion;s&&!semver.valid(s)&&(s=!1);var u=i.regExp||new RegExp("(['|\"]?version['|\"]?[ ]*:[ ]*['|\"]?)(\\d+\\.\\d+\\.\\d+(-"+i.prereleaseName+"\\.\\d+)?(-\\d+)?)[\\d||A-a|.|-]*(['|\"]?)","i");i.globalReplace&&(u=new RegExp(u.source,"gi"));var g=this.async(),m=[],p=function(){if(!m.length)return e.config.set("bump.version",o),g();m.shift()()},c=function(e,t){e&&m.push(t)};r&&e.log.writeln("Running grunt-bump in dry mode!"),"bump-only"===n&&(e.verbose.writeln("Only incrementing the version."),i.commit=!1,i.createTag=!1,i.push=!1),"commit-only"===n&&(e.verbose.writeln("Only committing/tagging/pushing."),i.bumpVersion=!1),c(i.bumpVersion&&"git"===t,(function(){exec("git describe "+i.gitDescribeOptions,(function(t,n){t&&e.fatal("Can not get a version number using `git describe`"),a=n.trim(),p()}))})),c(i.bumpVersion,(function(){e.file.expand(i.files).forEach((function(n,g){var m=null,p=e.file.read(n).replace(u,(function(n,o,r,u,g,p){var c="git"===t?"prerelease":t;return m=s||semver.inc(r,c||"patch",a||i.prereleaseName),i.metadata&&(/^([0-9a-zA-Z-]+\.{0,1})*$/.test(i.metadata)||e.fatal("Metadata can only contain letters, numbers, dashes (-) and dots (.)"),m+="+"+i.metadata),o+m+(p||"")}));m||e.fatal("Can not find a version to bump in "+n);var c="Version bumped to "+m+" (in "+n+")";r?e.log.ok("bump-dry: "+c):(e.file.write(n,p),e.log.ok(c)),o?o!==m&&e.warn("Bumping multiple files with different versions!"):o=m;var l=i.updateConfigs[g];if(l){var f=e.config(l);if(!f)return e.warn('Can not update "'+l+'" config, it does not exist!');f.version=m,e.config(l,f),e.log.ok(l+"'s version updated")}})),p()})),c(!i.bumpVersion,(function(){var t=e.config.get("bump.version");o=t||(i.updateConfigs.length?e.config(i.updateConfigs[0]).version:e.file.readJSON(i.files[0]).version),p()})),c(i.commit,(function(){var t=i.commitMessage.replace("%VERSION%",o),n="git commit "+i.gitCommitOptions+" "+i.commitFiles.join(" ");n+=' -m "'+t+'"',r?(e.log.ok("bump-dry: "+n),p()):exec(n,(function(n,i,o){n&&e.fatal("Can not create the commit:\n  "+o),e.log.ok('Committed as "'+t+'"'),p()}))})),c(i.createTag,(function(){var t=i.tagName.replace("%VERSION%",o),n=i.tagMessage.replace("%VERSION%",o),a="git tag -a "+t+' -m "'+n+'"';r?(e.log.ok("bump-dry: "+a),p()):exec(a,(function(n,i,o){n&&e.fatal("Can not create the tag:\n  "+o),e.log.ok('Tagged as "'+t+'"'),p()}))})),c(i.push,(function(){var t;if("git"===i.push&&!i.pushTo)return t="git push",void(r?(e.log.ok("bump-dry: "+t),p()):exec(t,(function(t,n,i){t&&e.fatal("Can not push to the git default settings:\n "+i),e.log.ok("Pushed to the git default settings"),p()})));exec("git rev-parse --abbrev-ref HEAD",(function(n,a,s){if(n&&e.fatal("Can not get ref for HEAD:\n"+s),t=[],!0!==i.push&&"branch"!==i.push||t.push("git push "+i.pushTo+" "+a.trim()),i.createTag&&(!0===i.push||"tag"===i.push)){var u=i.tagName.replace("%VERSION%",o);t.push("git push "+i.pushTo+" "+u)}t=t.join(" && "),r?(e.log.ok("bump-dry: "+t),p()):exec(t,(function(t,n,o){t&&e.fatal("Can not push to "+i.pushTo+":\n  "+o),e.log.ok("Pushed to "+i.pushTo),p()}))}))})),p()})),t="Increment the version only.",e.registerTask("bump-only",t,(function(t){e.task.run("bump:"+(t||"")+":bump-only")})),t="Commit, tag, push without incrementing the version.",e.registerTask("bump-commit",t,"bump::commit-only")};
//# sourceMappingURL=/sm/52b4be205244e43a4b2563290c188b190d3bd1e004986f507c1b8368e437c809.map