![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
grunt-heroku-build-api
Advanced tools
Upload your app to Heroku using the Build and Source Endpoints of the Platform API and the power of Grunt.
Upload your app to Heroku using the Build and Source Endpoints of the Platform API and the power of Grunt.
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-heroku-build-api --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-heroku-build-api');
In your project's Gruntfile, add a section named heroku_build_api
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
heroku_build_api: {
your_target: {
options: {
heroku_auth_token: // Heroku Platform API Authorization Token
heroku_app: // The name of the heroku app to deploy to,
source_url: // Optional url to a source .tar.gz file suitable for use by the Build Endpoint
source_tar: // Optional filename of the source.tar.gz that can be uploaded to the Build Endpoint
version: // Optional version string to pass to the Heroku Platform API Build Endpoint.
},
files: [] // the files array you know and love, to specify which files to compress into a .tar.gz file
},
},
})
You must provide options.heroku_auth_token, options.heroku_app and some specification of source (see below). If any of these are missing, the task will fail with an error.
If options.source_url exists, files and options.source_tar will be ignored. The Build Endpoint of the Platform API will be called with options.source_url as a parameter.
If you provide options.source_tar, and if it is a .tar.gz (or .tgz) file, it will be uploaded to the Sources Endpoint, built by the Build Endpoint and deployed to the app specified by options.heroku_app.
If you don't provide options.source_url or options.source_tar, the files specified by files will be tarred and gzipped and the resulting source tarball will be uploaded to the Sources Endpoint and building and deployment will go from there.
Type: String
Default value: ''
A Heroku Platform API Authorization Token. You can run
heroku auth:token
from the command line to generate this value. It can also be found on your Heroku Account page. It is required to use the API. See Heroku's Platform API docs for more information.
You can optionally leave this empty and set the HEROKU_API_KEY environment variable or (preferred) a setting in the .netrc instead. It's still also backwards compatible with older versions and will look for the HEROKU_AUTH_TOKEN environment variable, as well.
Type: String
Default value: ''
The name of the Heroku app to deploy to. Also required.
Type: String
Default value: ''
An optional path to a source .tar.gz (or .tgz) tarball that can be uploaded to the Sources Endpoint.
Type: String
Default value: ''
An optional URL to a source .tar.gz (or .tgz) tarball somewhere on the interwebs that can be handed to the Build Endpoint.
Type: String
A string that you can use to track different versions of builds. It's not used by the Platform API. More informaiton can be found under "Creating builds" at [Building and Releasing using the Platform API] (https://devcenter.heroku.com/articles/build-and-release-using-the-api#creating-builds)
Type: Array
The same files array you are used to with Grunt. Use it to specify which files and directories to compress into a source .tar.gz file that will then be uploaded, built, and deployed to your app.
In this example, the default options are used to do something with whatever. So if the testing
file has the content
Testing
and the 123
file had the content 1 2 3
, the generated result would be Testing, 1 2 3.
grunt.initConfig({
heroku_build_api: {
options: {},
files: {
'dest/default_options': ['src/testing', 'src/123'],
},
},
})
In this example, custom options are used to do something else with whatever else. So if the testing
file has the content Testing
and the 123
file had the content 1 2 3
, the generated result in this case would be Testing: 1 2 3 !!!
grunt.initConfig({
heroku_build_api: {
options: {
separator: ': ',
punctuation: ' !!!',
},
files: {
'dest/default_options': ['src/testing', 'src/123'],
},
},
})
In lieu of a formal styleguide, take care to maintain the existing coding style. I loosely follow Google's JavaScript style guide, so you can't go wrong there. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2015 Brad Ledbetter. Licensed under the MIT license.
FAQs
Upload your app to Heroku using the Build and Source Endpoints of the Platform API and the power of Grunt.
The npm package grunt-heroku-build-api receives a total of 1 weekly downloads. As such, grunt-heroku-build-api popularity was classified as not popular.
We found that grunt-heroku-build-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.