@@ -88,22 +88,30 @@ public function onPostCmdEvent(\Composer\Script\Event $event) {
8888 // Only install the scaffolding if drupal/core was installed,
8989 // AND there are no scaffolding files present.
9090 if (isset ($ this ->drupalCorePackage )) {
91- $ this ->downloadScaffold ();
91+ $ this ->downloadScaffold ($ event -> isDevMode () );
9292 // Generate the autoload.php file after generating the scaffold files.
9393 $ this ->generateAutoload ();
9494 }
9595 }
9696
9797 /**
9898 * Downloads drupal scaffold files for the current process.
99+ *
100+ * @param bool $dev
101+ * TRUE if dev packages are installed. FALSE otherwise.
99102 */
100- public function downloadScaffold () {
103+ public function downloadScaffold ($ dev = FALSE ) {
101104 $ drupalCorePackage = $ this ->getDrupalCorePackage ();
102105 $ webroot = realpath ($ this ->getWebRoot ());
103106
104- // Collect options, excludes and settings files.
107+ // Collect options, excludes, dev and settings files.
105108 $ options = $ this ->getOptions ();
106- $ files = array_diff ($ this ->getIncludes (), $ this ->getExcludes ());
109+ $ includes = $ this ->getIncludes ();
110+ // Check dev files if necessary.
111+ if ($ dev ) {
112+ $ includes = array_merge ($ includes , $ this ->getDev ());
113+ }
114+ $ files = array_diff ($ includes , $ this ->getExcludes ());
107115
108116 // Call any pre-scaffold scripts that may be defined.
109117 $ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -258,6 +266,15 @@ protected function getIncludes() {
258266 return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
259267 }
260268
269+ /**
270+ * Retrieve list of additional dev files from optional "extra" configuration.
271+ *
272+ * @return array
273+ */
274+ protected function getDev () {
275+ return $ this ->getNamedOptionList ('dev ' , 'getDevDefault ' );
276+ }
277+
261278 /**
262279 * Retrieve list of initial files from optional "extra" configuration.
263280 *
@@ -297,6 +314,7 @@ protected function getOptions() {
297314 'excludes ' => [],
298315 'includes ' => [],
299316 'initial ' => [],
317+ 'dev ' => [],
300318 'source ' => 'http://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
301319 // Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
302320 ];
@@ -314,33 +332,48 @@ protected function getExcludesDefault() {
314332 * Holds default settings files list.
315333 */
316334 protected function getIncludesDefault () {
317- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
318- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
319- $ version = "$ major. $ minor " ;
320-
321335 /**
322336 * Files from 8.3.x
323337 *
324338 * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
325339 */
326340 $ common = [
327- '.csslintrc ' ,
328- '.editorconfig ' ,
329- '.eslintignore ' ,
330- '.eslintrc.json ' ,
331- '.gitattributes ' ,
332341 '.htaccess ' ,
333342 'index.php ' ,
334343 'robots.txt ' ,
335344 'sites/default/default.settings.php ' ,
336345 'sites/default/default.services.yml ' ,
337- 'sites/development.services.yml ' ,
338346 'sites/example.settings.local.php ' ,
339347 'sites/example.sites.php ' ,
340348 'update.php ' ,
341349 'web.config '
342350 ];
343351
352+ return $ common ;
353+ }
354+
355+ /**
356+ * Holds default dev files list.
357+ */
358+ protected function getDevDefault () {
359+ $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
360+ list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
361+ $ version = "$ major. $ minor " ;
362+
363+ /**
364+ * Files from 8.3.x
365+ *
366+ * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
367+ */
368+ $ common = [
369+ '.csslintrc ' ,
370+ '.editorconfig ' ,
371+ '.eslintignore ' ,
372+ '.eslintrc.json ' ,
373+ '.gitattributes ' ,
374+ 'sites/development.services.yml '
375+ ];
376+
344377 // Version specific variations.
345378 switch ($ version ) {
346379 case '8.0 ' :
0 commit comments