Issue #3257134: Don't stage node_modules directories
Merged
requested to merge issue/automatic_updates-3257134:3257134-dont-stage-nodemodules-pathexcluder into 8.x-2.x
4 unresolved threads
Merge request reports
Activity
added 330 commits
-
577d5237...7aa0e075 - 328 commits from branch
project:8.x-2.x
- 1502b55c - Excluded node_modules directories
- 9085bbf0 - Added test coverage
-
577d5237...7aa0e075 - 328 commits from branch
5 use Drupal\package_manager\Event\PreApplyEvent; 6 use Drupal\package_manager\Event\PreCreateEvent; 7 use Drupal\package_manager\Event\StageEvent; 8 use Drupal\package_manager\PathLocator; 9 use Symfony\Component\EventDispatcher\EventSubscriberInterface; 10 use Symfony\Component\Finder\Finder; 11 12 /** 13 * Excludes node_modules files from staging areas. 14 * 15 * @internal 16 * This is an internal part of Package Manager and may be changed or removed 17 * at any time without warning. External code should not interact with this 18 * class. 19 */ 20 class NodeModuleExcluder implements EventSubscriberInterface { changed this line in version 2 of the diff
32 } 33 34 /** 35 * Excludes node_modules directory from staging operations. 36 * 37 * @param \Drupal\package_manager\Event\PreApplyEvent|\Drupal\package_manager\Event\PreCreateEvent $event 38 * The event object. 39 * 40 * @see \Drupal\package_manager\Event\ExcludedPathsTrait::excludePath() 41 */ 42 public function excludeNodeModulesFiles(StageEvent $event): void { 43 $finder = Finder::create() 44 ->in($this->pathLocator->getProjectRoot()) 45 ->directories() 46 ->name('.git') 47 ->name(['.git', 'node_modules']) changed this line in version 2 of the diff
25 } 26 27 /** 28 * Tests that certain paths are excluded from staging operations. 29 */ 30 public function testExcludedPaths(): void { 31 // In this test, we want to perform the actual staging operations so that we 32 // can be sure that files are staged as expected. 33 $this->setSetting('package_manager_bypass_composer_stager', FALSE); 34 // Ensure we have an up-to-date container. 35 $this->container = $this->container->get('kernel')->rebuildContainer(); 36 37 $active_dir = $this->container->get('package_manager.path_locator') 38 ->getProjectRoot(); 39 40 $stage = $this->createStage(); I don't think we should do it this way; let's just adjust the fake_site fixture to add a
node_modules
directory with anignore.txt
in it (there are examples already there).In fact, better yet, let's simulate both core and a module having Node dependencies. So we should add
core/node_modules/ignore.txt
, andmodules/example/node_modules/ignore.txt
and make sure they're both excluded.Edited by Adam G-Hchanged this line in version 5 of the diff
10 use Symfony\Component\Finder\Finder; 11 12 /** 13 * Excludes node_modules files from staging areas. 14 * 15 * @internal 16 * This is an internal part of Package Manager and may be changed or removed 17 * at any time without warning. External code should not interact with this 18 * class. 19 */ 20 class NodeModuleExcluder implements EventSubscriberInterface { 21 22 use PathExclusionsTrait; 23 24 /** 25 * Constructs an ExcludedPathsSubscriber. changed this line in version 2 of the diff
added 10 commits
-
9085bbf0...29927706 - 6 commits from branch
project:8.x-2.x
- 68feab3c - Excluded node_modules directories
- 3c018e27 - Added test coverage
- c3edfdc2 - Changed finder
- 95985fd7 - nitpicks
Toggle commit list-
9085bbf0...29927706 - 6 commits from branch
Please register or sign in to reply