A Grunt task wrapper for composer to allow custom tasks to be configured to run composer as needed.
Installing the plugin:
npm install grunt-composer --save-dev
Loading the plugin via JavaScript:
grunt.loadNpmTasks('grunt-composer');
Then you should use the grunt.initConfig()
function inside your Gruntfile like below:
grunt.initConfig({
composer : {
options : {
usePhp: true,
phpArgs: {
someArg: 'custom'
},
flags: ['arg'],
cwd: 'packages/build',
composerLocation: '/usr/bin/composer'
}
}
})
Type: Boolean
Default value: false
This tells the plugin to execute php #{composerLocation}
Type: Array
This is an array of custom Composer CLI args, such as no-dev
.
Note: This is bypassed if there are command options.
Type: Object
This is an object which you should use to send -D arguments to the php binary.
Type: String
This is the working directory, normally where the composer.json is located.
Type: String
Defaut value: composer
The binary to use for composer if not installed globally.
If options.cwd
is present, relative paths for options.coposerLocation
are relative to that directory.
The first argument passed to the composer task becomes the command to run. Arguments are passed to tasks in Grunt by separating them via a colon, :
.
grunt composer:update
Is equivalent to:
composer update
Any arguments passed to the composer task after the command will get converted into options for the command.
grunt composer:install:no-dev
Is equivalent to:
composer install --no-dev