'generate-all-stories' command throws error when profiles directory doesn't exist

Created on 31 January 2024, 5 months ago
Updated 20 February 2024, 4 months ago

Problem/Motivation

Running `drush storybook:generate-all-stories` when 'profiles' directory doesn't exist throws an error:

In StorybookCommands.php line 71:
  RecursiveDirectoryIterator::__construct(profiles): Failed to open directory: No such file or directory

On projects that don't use contrib/custom profiles, the 'profiles' directory may not exist. The same issue is theoretically possible for themes but far less likely since storybook is usually used when creating a theme, but nonetheless the fix should be applied for all scanned directories.

Currently using a workaround of creating empty 'profiles' directory.

Steps to reproduce

  1. Setup clean standard profile installation of Drupal.
  2. Install drupal/storybook module.
  3. Remove web/profiles directory.
  4. Run `drush storybook:generate-all-stories`.

Proposed resolution

Before creating RecursiveDirectoryIterator check if the directory exists, skip scanning it if it does not.

Remaining tasks

  • Implement fix

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Other tooling

Created by

πŸ‡΅πŸ‡±Poland wotnak

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024