@@ -88,22 +88,30 @@ public function onPostCmdEvent(\Composer\Script\Event $event) {
88
88
// Only install the scaffolding if drupal/core was installed,
89
89
// AND there are no scaffolding files present.
90
90
if (isset ($ this ->drupalCorePackage )) {
91
- $ this ->downloadScaffold ();
91
+ $ this ->downloadScaffold ($ event -> isDevMode () );
92
92
// Generate the autoload.php file after generating the scaffold files.
93
93
$ this ->generateAutoload ();
94
94
}
95
95
}
96
96
97
97
/**
98
98
* Downloads drupal scaffold files for the current process.
99
+ *
100
+ * @param bool $dev
101
+ * TRUE if dev packages are installed. FALSE otherwise.
99
102
*/
100
- public function downloadScaffold () {
103
+ public function downloadScaffold ($ dev = FALSE ) {
101
104
$ drupalCorePackage = $ this ->getDrupalCorePackage ();
102
105
$ webroot = realpath ($ this ->getWebRoot ());
103
106
104
- // Collect options, excludes and settings files.
107
+ // Collect options, excludes, dev and settings files.
105
108
$ 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 ());
107
115
108
116
// Call any pre-scaffold scripts that may be defined.
109
117
$ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -258,6 +266,15 @@ protected function getIncludes() {
258
266
return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
259
267
}
260
268
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
+
261
278
/**
262
279
* Retrieve list of initial files from optional "extra" configuration.
263
280
*
@@ -297,6 +314,7 @@ protected function getOptions() {
297
314
'excludes ' => [],
298
315
'includes ' => [],
299
316
'initial ' => [],
317
+ 'dev ' => [],
300
318
'source ' => 'http://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
301
319
// Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
302
320
];
@@ -314,33 +332,48 @@ protected function getExcludesDefault() {
314
332
* Holds default settings files list.
315
333
*/
316
334
protected function getIncludesDefault () {
317
- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
318
- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
319
- $ version = "$ major. $ minor " ;
320
-
321
335
/**
322
336
* Files from 8.3.x
323
337
*
324
338
* @see http://cgit.drupalcode.org/drupal/tree/?h=8.3.x
325
339
*/
326
340
$ common = [
327
- '.csslintrc ' ,
328
- '.editorconfig ' ,
329
- '.eslintignore ' ,
330
- '.eslintrc.json ' ,
331
- '.gitattributes ' ,
332
341
'.htaccess ' ,
333
342
'index.php ' ,
334
343
'robots.txt ' ,
335
344
'sites/default/default.settings.php ' ,
336
345
'sites/default/default.services.yml ' ,
337
- 'sites/development.services.yml ' ,
338
346
'sites/example.settings.local.php ' ,
339
347
'sites/example.sites.php ' ,
340
348
'update.php ' ,
341
349
'web.config '
342
350
];
343
351
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
+
344
377
// Version specific variations.
345
378
switch ($ version ) {
346
379
case '8.0 ' :
0 commit comments