@@ -89,22 +89,30 @@ public function onPostCmdEvent(\Composer\Script\Event $event) {
8989 // Only install the scaffolding if drupal/core was installed,
9090 // AND there are no scaffolding files present.
9191 if (isset ($ this ->drupalCorePackage )) {
92- $ this ->downloadScaffold ();
92+ $ this ->downloadScaffold ($ event -> isDevMode () );
9393 // Generate the autoload.php file after generating the scaffold files.
9494 $ this ->generateAutoload ();
9595 }
9696 }
9797
9898 /**
9999 * Downloads drupal scaffold files for the current process.
100+ *
101+ * @param bool $dev
102+ * TRUE if dev packages are installed. FALSE otherwise.
100103 */
101- public function downloadScaffold () {
104+ public function downloadScaffold ($ dev = FALSE ) {
102105 $ drupalCorePackage = $ this ->getDrupalCorePackage ();
103106 $ webroot = realpath ($ this ->getWebRoot ());
104107
105- // Collect options, excludes and settings files.
108+ // Collect options, excludes, dev and settings files.
106109 $ options = $ this ->getOptions ();
107- $ files = array_diff ($ this ->getIncludes (), $ this ->getExcludes ());
110+ $ includes = $ this ->getIncludes ();
111+ // Check dev files if necessary.
112+ if ($ dev ) {
113+ $ includes = array_merge ($ includes , $ this ->getDev ());
114+ }
115+ $ files = array_diff ($ includes , $ this ->getExcludes ());
108116
109117 // Call any pre-scaffold scripts that may be defined.
110118 $ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -259,6 +267,15 @@ protected function getIncludes() {
259267 return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
260268 }
261269
270+ /**
271+ * Retrieve list of additional dev files from optional "extra" configuration.
272+ *
273+ * @return array
274+ */
275+ protected function getDev () {
276+ return $ this ->getNamedOptionList ('dev ' , 'getDevDefault ' );
277+ }
278+
262279 /**
263280 * Retrieve list of initial files from optional "extra" configuration.
264281 *
@@ -298,6 +315,7 @@ protected function getOptions() {
298315 'excludes ' => [],
299316 'includes ' => [],
300317 'initial ' => [],
318+ 'dev ' => [],
301319 'source ' => 'http://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
302320 // Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
303321 ];
@@ -315,32 +333,48 @@ protected function getExcludesDefault() {
315333 * Holds default settings files list.
316334 */
317335 protected function getIncludesDefault () {
318- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
319- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
320- $ version = "$ major. $ minor " ;
321-
322336 /**
323337 * Files from 8.3.x
324338 *
325339 * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
326340 */
327341 $ common = [
328- '.csslintrc ' ,
329- '.editorconfig ' ,
330- '.eslintignore ' ,
331- '.gitattributes ' ,
332342 '.htaccess ' ,
333343 'index.php ' ,
334344 'robots.txt ' ,
335345 'sites/default/default.settings.php ' ,
336346 'sites/default/default.services.yml ' ,
337- 'sites/development.services.yml ' ,
338347 'sites/example.settings.local.php ' ,
339348 'sites/example.sites.php ' ,
340349 'update.php ' ,
341350 'web.config '
342351 ];
343352
353+ return $ common ;
354+ }
355+
356+ /**
357+ * Holds default dev files list.
358+ */
359+ protected function getDevDefault () {
360+ $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
361+ list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
362+ $ version = "$ major. $ minor " ;
363+
364+ /**
365+ * Files from 8.3.x
366+ *
367+ * @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
368+ */
369+ $ common = [
370+ '.csslintrc ' ,
371+ '.editorconfig ' ,
372+ '.eslintignore ' ,
373+ '.eslintrc.json ' ,
374+ '.gitattributes ' ,
375+ 'sites/development.services.yml ' ,
376+ ];
377+
344378 // Version specific variations.
345379 if (Semver::satisfies ($ version , '<8.3 ' )) {
346380 $ common [] = '.eslintrc ' ;
0 commit comments