Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ module.exports = function(grunt) {
tasksDefault.push('scaffold');

if (grunt.file.exists('./composer.lock') && grunt.config.get(['composer', 'install'])) {
// Manually run `composer drupal-scaffold` since this is only automatically run on update.
tasksDefault.unshift('composer:drupal-scaffold');
if (grunt.task.exists('composer:drupal-scaffold')) {
// Manually run `composer drupal-scaffold` since this is only automatically run on update.
tasksDefault.unshift('composer:drupal-scaffold');
}
// Run `composer install` if there is already a lock file. Updates should be explicit once this file exists.
tasksDefault.unshift('composer:install');
} else if (grunt.config.get(['composer', 'update'])) {
Expand Down
8 changes: 6 additions & 2 deletions tasks/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = function(grunt) {
* Dynamically adds a Composer install task if a composer.json file
* exists in the project directory.
*/

if (require('fs').existsSync('./composer.json')) {
grunt.loadNpmTasks('grunt-composer');
var Help = require('../lib/help')(grunt);
Expand All @@ -28,7 +27,12 @@ module.exports = function(grunt) {
]
}
});
grunt.config(['composer', 'drupal-scaffold'], {});

// Add the drupal-scaffold task if it is defined in the `composer.json`.
var composer = require('fs').readFileSync('./composer.json', 'utf8');
if (typeof composer.scripts !== 'undefined' && 'drupal-scaffold' in composer.scripts) {
grunt.config(['composer', 'drupal-scaffold'], {});
}

Help.add({
task: 'composer',
Expand Down