{"id":13263,"library":"grunt-bump-build-git","title":"Grunt Bump Build Git","description":"This Grunt plugin, `grunt-bump-build-git` (current stable version 1.1.3), streamlines the release process for JavaScript projects. It integrates version bumping (following semver), project building via custom Grunt tasks, and Git operations (add, commit, tag) into a single, configurable step. It differentiates itself by providing a comprehensive, automated workflow for releases directly within the Grunt ecosystem, updating `package.json` and other specified JSON files with the new version. The plugin is designed for projects using Grunt `~0.4.2` or higher and runs on Node.js versions `0.8.0` and above. Its release cadence is tied to its maintenance, likely infrequent given its age and the current landscape of build tools, but it remains functional for legacy Grunt-based projects. It aims to reduce manual steps and potential errors during a project's release cycle.","status":"maintenance","version":"1.1.3","language":"javascript","source_language":"en","source_url":"git://github.com/blueimp/grunt-bump-build-git","tags":["javascript","grunt","gruntplugin","bump","build","git"],"install":[{"cmd":"npm install grunt-bump-build-git","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-bump-build-git","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-bump-build-git","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency for Grunt task runner.","package":"grunt","optional":false}],"imports":[{"note":"Grunt plugins are loaded via `grunt.loadNpmTasks` in the Gruntfile, not traditional ES module or CommonJS `require()` syntax.","wrong":"import gruntBumpBuildGit from 'grunt-bump-build-git';","symbol":"grunt.loadNpmTasks","correct":"grunt.loadNpmTasks('grunt-bump-build-git');"}],"quickstart":{"code":"module.exports = function (grunt) {\n  grunt.initConfig({\n    pkg: grunt.file.readJSON('package.json'), // Example for packageConfig\n    build: {\n      tasks: ['default'], // Tasks to run after bumping version\n      packageConfig: 'pkg', // Name of config object containing version\n      packages: '*.json', // JSON files to update\n      jsonSpace: 2, // Indentation for JSON files\n      gitAdd: '--all' // Command line arguments for 'git add'\n    },\n    // Define a simple default task for demonstration\n    default: {\n      // This task would typically run your build process\n      // For example, concat, uglify, cssmin, etc.\n      options: {\n        message: 'Running default build tasks...'\n      }\n    }\n  });\n\n  // Load the plugin's task.\n  grunt.loadNpmTasks('grunt-bump-build-git');\n\n  // Register a dummy default task if it's not defined\n  if (!grunt.task.exists('default')) {\n    grunt.registerTask('default', 'A dummy default task.', function() {\n      grunt.log.writeln(this.options().message);\n      // In a real project, this would trigger your actual build process\n    });\n  }\n\n  // To run:\n  // grunt build:patch:\"Release new patch version\"\n  // Or just grunt build to create a meta version (e.g., 1.2.3+build.TIMESTAMP)\n};","lang":"javascript","description":"This quickstart demonstrates how to configure and use the `grunt-bump-build-git` plugin within a Gruntfile to automate version bumping, running custom build tasks, and committing/tagging changes in Git."},"warnings":[{"fix":"Escape colons with a backslash, e.g., `grunt build:minor:\"Set visibility\\\\:true by default.\"`. Note the double backslash when used in a shell to ensure the backslash itself is passed.","message":"When specifying commit messages via the command line, colons (':') must be escaped with a backslash to be parsed correctly by Grunt.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Grunt in your project to at least `0.4.2` by running `npm install grunt@~0.4.2 --save-dev`.","message":"This plugin requires Grunt `~0.4.2` or newer. Using older versions of Grunt will prevent the plugin from loading or functioning correctly.","severity":"gotcha","affected_versions":"<0.4.2"},{"fix":"Ensure `git init` has been run in your project root. For automated environments (CI/CD), configure Git with appropriate credentials (e.g., deploy keys, personal access tokens) for the repository.","message":"Git operations will fail if the project directory is not a Git repository or if authentication issues prevent Git from performing actions like `add`, `commit`, or `tag`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify that all tasks listed in `build.tasks` are properly registered using `grunt.registerTask` or loaded via `grunt.loadNpmTasks` for third-party plugins.","message":"The custom tasks specified in the `build.tasks` option (e.g., `['default']`) must be defined and available in your Gruntfile, either directly or loaded from other Grunt plugins.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `grunt.loadNpmTasks('grunt-bump-build-git');` is present and correctly placed in your Gruntfile.js, and that your Gruntfile has no syntax errors.","cause":"The `grunt-bump-build-git` plugin's tasks have not been loaded or the Gruntfile has an error preventing it.","error":"Warning: Task \"build:patch\" not found. Use --force to continue."},{"fix":"Initialize a Git repository in your project's root directory by running `git init`.","cause":"The `grunt-bump-build-git` task attempts to perform Git operations (add, commit, tag) in a directory that is not a Git repository.","error":"fatal: not a git repository (or any of the parent directories): .git"},{"fix":"Adjust the file permissions for the affected JSON files (e.g., `chmod 644 package.json`) or run Grunt with elevated privileges if appropriate for your environment.","cause":"The Grunt process lacks the necessary file system permissions to modify `package.json` or other JSON files specified in `build.packages`.","error":"Warning: Unable to write \"package.json\" file (Error: EACCES: permission denied, open 'package.json')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}