@@ -112,22 +112,30 @@ public function onPostCmdEvent(Event $event) {
112
112
// Only install the scaffolding if drupal/core was installed,
113
113
// AND there are no scaffolding files present.
114
114
if (isset ($ this ->drupalCorePackage )) {
115
- $ this ->downloadScaffold ();
115
+ $ this ->downloadScaffold ($ event -> isDevMode () );
116
116
// Generate the autoload.php file after generating the scaffold files.
117
117
$ this ->generateAutoload ();
118
118
}
119
119
}
120
120
121
121
/**
122
122
* Downloads drupal scaffold files for the current process.
123
+ *
124
+ * @param bool $dev
125
+ * TRUE if dev packages are installed. FALSE otherwise.
123
126
*/
124
- public function downloadScaffold () {
127
+ public function downloadScaffold ($ dev = FALSE ) {
125
128
$ drupalCorePackage = $ this ->getDrupalCorePackage ();
126
129
$ webroot = realpath ($ this ->getWebRoot ());
127
130
128
- // Collect options, excludes and settings files.
131
+ // Collect options, excludes, dev and settings files.
129
132
$ 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 ());
131
139
132
140
// Call any pre-scaffold scripts that may be defined.
133
141
$ dispatcher = new EventDispatcher ($ this ->composer , $ this ->io );
@@ -283,6 +291,15 @@ protected function getIncludes() {
283
291
return $ this ->getNamedOptionList ('includes ' , 'getIncludesDefault ' );
284
292
}
285
293
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
+
286
303
/**
287
304
* Retrieve list of initial files from optional "extra" configuration.
288
305
*
@@ -322,6 +339,7 @@ protected function getOptions() {
322
339
'excludes ' => [],
323
340
'includes ' => [],
324
341
'initial ' => [],
342
+ 'dev ' => [],
325
343
'source ' => 'https://cgit.drupalcode.org/drupal/plain/{path}?h={version} ' ,
326
344
// Github: https://raw.githubusercontent.com/drupal/drupal/{version}/{path}
327
345
];
@@ -339,32 +357,48 @@ protected function getExcludesDefault() {
339
357
* Holds default settings files list.
340
358
*/
341
359
protected function getIncludesDefault () {
342
- $ version = $ this ->getDrupalCoreVersion ($ this ->getDrupalCorePackage ());
343
- list ($ major , $ minor ) = explode ('. ' , $ version , 3 );
344
- $ version = "$ major. $ minor " ;
345
-
346
360
/**
347
361
* Files from 8.3.x
348
362
*
349
363
* @see https://cgit.drupalcode.org/drupal/tree/?h=8.3.x
350
364
*/
351
365
$ common = [
352
- '.csslintrc ' ,
353
- '.editorconfig ' ,
354
- '.eslintignore ' ,
355
- '.gitattributes ' ,
356
366
'.htaccess ' ,
357
367
'index.php ' ,
358
368
'robots.txt ' ,
359
369
'sites/default/default.settings.php ' ,
360
370
'sites/default/default.services.yml ' ,
361
- 'sites/development.services.yml ' ,
362
371
'sites/example.settings.local.php ' ,
363
372
'sites/example.sites.php ' ,
364
373
'update.php ' ,
365
374
'web.config ' ,
366
375
];
367
376
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
+
368
402
// Version specific variations.
369
403
if (Semver::satisfies ($ version , '<8.3 ' )) {
370
404
$ common [] = '.eslintrc ' ;
0 commit comments