@@ -133,22 +133,30 @@ public function onPostCmdEvent(Event $event) {
133133 // Only install the scaffolding if drupal/core was installed,
134134 // AND there are no scaffolding files present.
135135 if (isset ($ this ->drupalCorePackage )) {
136- $ this ->downloadScaffold ();
136+ $ this ->downloadScaffold ($ event -> isDevMode () );
137137 // Generate the autoload.php file after generating the scaffold files.
138138 $ this ->generateAutoload ();
139139 }
140140 }
141141
142142 /**
143143 * Downloads drupal scaffold files for the current process.
144+ *
145+ * @param bool $dev
146+ * TRUE if dev packages are installed. FALSE otherwise.
144147 */
145- public function downloadScaffold () {
148+ public function downloadScaffold ($ dev = FALSE ) {
146149 $ drupalCorePackage = $ this ->getDrupalCorePackage ();
147150 $ webroot = realpath ($ this ->getWebRoot ());
148151
149- // Collect options, excludes and settings files.
152+ // Collect options, excludes, dev and settings files.
150153 $ options = $ this ->getOptions ();
151- $ files = array_diff ($ this ->getIncludes (), $ this ->getExcludes ());
154+ $ includes = $ this ->getIncludes ();
155+ // Check dev files if necessary.
156+ if ($ dev ) {
157+ $ includes = array_merge ($ includes , $ this ->getDev ());
158+ }
159+ $ files = array_diff ($ includes , $ this ->getExcludes ());
152160
153161 // Call any pre-scaffold scripts that may be defined.
154162 $ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -304,6 +312,15 @@ protected function getIncludes() {
304312 return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
305313 }
306314
315+ /**
316+ * Retrieve list of additional dev files from optional "extra" configuration.
317+ *
318+ * @return array
319+ */
320+ protected function getDev () {
321+ return $ this ->getNamedOptionList ('dev ' , 'getDevDefault ' );
322+ }
323+
307324 /**
308325 * Retrieve list of initial files from optional "extra" configuration.
309326 *
@@ -343,6 +360,7 @@ protected function getOptions() {
343360 'excludes ' => [],
344361 'includes ' => [],
345362 'initial ' => [],
363+ 'dev ' => [],
346364 'source ' => 'https://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
347365 // Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
348366 ];
@@ -360,32 +378,48 @@ protected function getExcludesDefault() {
360378 * Holds default settings files list.
361379 */
362380 protected function getIncludesDefault () {
363- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
364- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
365- $ version = "$ major. $ minor " ;
366-
367381 /**
368382 * Files from 8.3.x
369383 *
370384 * @see https://cgit.drupalcode.org/drupal/tree/?h=8.3.x
371385 */
372386 $ common = [
373- '.csslintrc ' ,
374- '.editorconfig ' ,
375- '.eslintignore ' ,
376- '.gitattributes ' ,
377387 '.htaccess ' ,
378388 'index.php ' ,
379389 'robots.txt ' ,
380390 'sites/default/default.settings.php ' ,
381391 'sites/default/default.services.yml ' ,
382- 'sites/development.services.yml ' ,
383392 'sites/example.settings.local.php ' ,
384393 'sites/example.sites.php ' ,
385394 'update.php ' ,
386395 'web.config ' ,
387396 ];
388397
398+ return $ common ;
399+ }
400+
401+ /**
402+ * Holds default dev files list.
403+ */
404+ protected function getDevDefault () {
405+ $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
406+ list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
407+ $ version = "$ major. $ minor " ;
408+
409+ /**
410+ * Files from 8.3.x
411+ *
412+ * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
413+ */
414+ $ common = [
415+ '.csslintrc ' ,
416+ '.editorconfig ' ,
417+ '.eslintignore ' ,
418+ '.eslintrc.json ' ,
419+ '.gitattributes ' ,
420+ 'sites/development.services.yml ' ,
421+ ];
422+
389423 // Version specific variations.
390424 if (Semver::satisfies ($ version , '<8.3 ' )) {
391425 $ common [] = '.eslintrc ' ;
0 commit comments