@@ -112,22 +112,30 @@ public function onPostCmdEvent(Event $event) {
112112 // Only install the scaffolding if drupal/core was installed,
113113 // AND there are no scaffolding files present.
114114 if (isset ($ this ->drupalCorePackage )) {
115- $ this ->downloadScaffold ();
115+ $ this ->downloadScaffold ($ event -> isDevMode () );
116116 // Generate the autoload.php file after generating the scaffold files.
117117 $ this ->generateAutoload ();
118118 }
119119 }
120120
121121 /**
122122 * Downloads drupal scaffold files for the current process.
123+ *
124+ * @param bool $dev
125+ * TRUE if dev packages are installed. FALSE otherwise.
123126 */
124- public function downloadScaffold () {
127+ public function downloadScaffold ($ dev = FALSE ) {
125128 $ drupalCorePackage = $ this ->getDrupalCorePackage ();
126129 $ webroot = realpath ($ this ->getWebRoot ());
127130
128- // Collect options, excludes and settings files.
131+ // Collect options, excludes, dev and settings files.
129132 $ options = $ this ->getOptions ();
130- $ files = array_diff ($ this ->getIncludes (), $ this ->getExcludes ());
133+ $ includes = $ this ->getIncludes ();
134+ // Check dev files if necessary.
135+ if ($ dev ) {
136+ $ includes = array_merge ($ includes , $ this ->getDev ());
137+ }
138+ $ files = array_diff ($ includes , $ this ->getExcludes ());
131139
132140 // Call any pre-scaffold scripts that may be defined.
133141 $ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -283,6 +291,15 @@ protected function getIncludes() {
283291 return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
284292 }
285293
294+ /**
295+ * Retrieve list of additional dev files from optional "extra" configuration.
296+ *
297+ * @return array
298+ */
299+ protected function getDev () {
300+ return $ this ->getNamedOptionList ('dev ' , 'getDevDefault ' );
301+ }
302+
286303 /**
287304 * Retrieve list of initial files from optional "extra" configuration.
288305 *
@@ -323,6 +340,7 @@ protected function getOptions() {
323340 'includes ' => [],
324341 'initial ' => [],
325342 'source ' => 'https://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
343+ 'dev ' => [],
326344 // Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
327345 ];
328346 return $ options ;
@@ -339,32 +357,48 @@ protected function getExcludesDefault() {
339357 * Holds default settings files list.
340358 */
341359 protected function getIncludesDefault () {
342- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
343- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
344- $ version = "$ major. $ minor " ;
345-
346360 /**
347361 * Files from 8.3.x
348362 *
349363 * @see https://cgit.drupalcode.org/drupal/tree/?h=8.3.x
350364 */
351365 $ common = [
352- '.csslintrc ' ,
353- '.editorconfig ' ,
354- '.eslintignore ' ,
355- '.gitattributes ' ,
356366 '.htaccess ' ,
357367 'index.php ' ,
358368 'robots.txt ' ,
359369 'sites/default/default.settings.php ' ,
360370 'sites/default/default.services.yml ' ,
361- 'sites/development.services.yml ' ,
362371 'sites/example.settings.local.php ' ,
363372 'sites/example.sites.php ' ,
364373 'update.php ' ,
365374 'web.config ' ,
366375 ];
367376
377+ return $ common ;
378+ }
379+
380+ /**
381+ * Holds default dev files list.
382+ */
383+ protected function getDevDefault () {
384+ $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
385+ list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
386+ $ version = "$ major. $ minor " ;
387+
388+ /**
389+ * Files from 8.3.x
390+ *
391+ * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
392+ */
393+ $ common = [
394+ '.csslintrc ' ,
395+ '.editorconfig ' ,
396+ '.eslintignore ' ,
397+ '.eslintrc.json ' ,
398+ '.gitattributes ' ,
399+ 'sites/development.services.yml ' ,
400+ ];
401+
368402 // Version specific variations.
369403 if (Semver::satisfies ($ version , '<8.3 ' )) {
370404 $ common [] = '.eslintrc ' ;
0 commit comments