File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,10 @@ module.exports = function(grunt) {
6060 tasksDefault . push ( 'scaffold' ) ;
6161
6262 if ( grunt . file . exists ( './composer.lock' ) && grunt . config . get ( [ 'composer' , 'install' ] ) ) {
63- // Manually run `composer drupal-scaffold` since this is only automatically run on update.
64- tasksDefault . unshift ( 'composer:drupal-scaffold' ) ;
63+ if ( grunt . task . exists ( 'composer:drupal-scaffold' ) ) {
64+ // Manually run `composer drupal-scaffold` since this is only automatically run on update.
65+ tasksDefault . unshift ( 'composer:drupal-scaffold' ) ;
66+ }
6567 // Run `composer install` if there is already a lock file. Updates should be explicit once this file exists.
6668 tasksDefault . unshift ( 'composer:install' ) ;
6769 } else if ( grunt . config . get ( [ 'composer' , 'update' ] ) ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ module.exports = function(grunt) {
55 * Dynamically adds a Composer install task if a composer.json file
66 * exists in the project directory.
77 */
8-
98 if ( require ( 'fs' ) . existsSync ( './composer.json' ) ) {
109 grunt . loadNpmTasks ( 'grunt-composer' ) ;
1110 var Help = require ( '../lib/help' ) ( grunt ) ;
@@ -28,7 +27,12 @@ module.exports = function(grunt) {
2827 ]
2928 }
3029 } ) ;
31- grunt . config ( [ 'composer' , 'drupal-scaffold' ] , { } ) ;
30+
31+ // Add the drupal-scaffold task if it is defined in the `composer.json`.
32+ var composer = require ( 'fs' ) . readFileSync ( './composer.json' , 'utf8' ) ;
33+ if ( typeof composer . scripts !== 'undefined' && 'drupal-scaffold' in composer . scripts ) {
34+ grunt . config ( [ 'composer' , 'drupal-scaffold' ] , { } ) ;
35+ }
3236
3337 Help . add ( {
3438 task : 'composer' ,
You can’t perform that action at this time.
0 commit comments