Skip to content
Open
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: 3 additions & 3 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ module.exports = function(grunt) {
if (grunt.file.exists('./composer.lock') && grunt.config.get(['composer', 'install'])) {
if (grunt.config.get(['composer', 'drupal-scaffold'])) {
// Manually run `composer drupal-scaffold` since this is only automatically run on update.
tasksDefault.unshift('composer:drupal-scaffold');
tasksDefault.unshift('composer:drupal-scaffold:drupal-scaffold');
}
// Run `composer install` if there is already a lock file. Updates should be explicit once this file exists.
tasksDefault.unshift('composer:install');
tasksDefault.unshift('composer:install:install');
} else if (grunt.config.get(['composer', 'update'])) {
// Run `composer update` if no lock file exists. This forces `composer drupal-scaffold` to run.
tasksDefault.unshift('composer:update');
tasksDefault.unshift('composer:update:update');
}

if (grunt.task.exists('compile-theme')) {
Expand Down
37 changes: 20 additions & 17 deletions tasks/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,31 @@ module.exports = function(grunt) {
* exists in the project directory.
*/
if (require('fs').existsSync('./composer.json')) {
grunt.loadNpmTasks('grunt-composer');
var Help = require('../lib/help')(grunt);

grunt.config(['composer', 'install'], {
options: {
flags: [
'no-interaction',
'no-progress',
'prefer-dist'
]
}
});
grunt.config(['composer', 'update'], {
options: {
flags: [
'no-interaction',
'no-progress',
'prefer-dist'
]
grunt.config('composer', {
install: {
options: {
flags: [
'no-interaction',
'no-progress',
'prefer-dist'
]
}
},
update: {
options: {
flags: [
'no-interaction',
'no-progress',
'prefer-dist'
]
}
}
});

grunt.loadNpmTasks('grunt-composer');

// Add the drupal-scaffold task if it is defined in the `composer.json`.
var composer = JSON.parse(require('fs').readFileSync('./composer.json', 'utf8'));
if (typeof composer.scripts !== 'undefined' && 'drupal-scaffold' in composer.scripts) {
Expand Down
8 changes: 4 additions & 4 deletions tasks/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(grunt) {
// Remove the original file if we moved it.
grunt.file.delete(destPath + '/composer.json');
// Change working directory for later `composer install`.
grunt.config(['composer'], {
grunt.config(['composer', 'install'], {
options: {
flags: ['no-dev'],
cwd: destComposer
Expand Down Expand Up @@ -106,15 +106,15 @@ module.exports = function(grunt) {
return pattern.startsWith('composer');
})) {
tasks.push('packageRewriteComposer');
grunt.config(['composer'], {
grunt.config(['composer', 'install'], {
options: {
flags: ['no-dev'],
cwd: destPath
}
});
tasks.push('composer:install');
tasks.push('composer:install:install');
grunt.config(['composer', 'drupal-scaffold'], {});
tasks.push('composer:drupal-scaffold');
tasks.push('composer:drupal-scaffold:drupal-scaffold');
}

if (this.args[0] && this.args[0] === 'compress') {
Expand Down