When I run this command drush --include="themes/contrib/bootstrap_storybook" to create sub theme I get following error.

PHP Fatal error:  Trait 'Robo\TaskAccessor' not found in D:\www\core-web\themes\contrib\bootstrap_storybook\Commands\bootstrap_storybook\SubThemeCommands.php on line 25

Fatal error: Trait 'Robo\TaskAccessor' not found in D:\www\core-web\themes\contrib\bootstrap_storybook\Commands\bootstrap_storybook\SubThemeCommands.php on line 25
Drush command terminated abnormally due to an unrecoverable error.             [error]Error: Trait 'Robo\TaskAccessor' not found in
D:\www\core-web\themes\contrib\bootstrap_storybook\Commands\bootstrap_storybook\SubThemeCommands.php,
line 25

Comments

santhoshabraham created an issue. See original summary.

doxigo’s picture

Status: Active » Fixed

Sorry for the late response, it is now fixed on the new release, was okay on the dev release though

Thanks for the report

jcandan’s picture

Status: Fixed » Active

I am so excited about the potential of this project, and I love that it is inspired in part by Radix.

However, this issue has not been fixed. No composer.json file exists as part of this project to list the php dependencies necessary for this project to work (e.g. Robo).

I recommend something like the following (based on Radix's own composer.json file):

{
  "name": "drupal/bootstrap_storybook",
  "description": "Drupal theme with built-in support for StorybookJS, Bootstrap 4 and BrowserSync out of the box, leveraging laravel-mix and webpack for better asset management.",
  "type": "drupal-theme",
  "homepage": "https://www.drupal.org/project/bootstrap_storybook",
  "authors": [
    {
      "name": "Sohail Lajevardi",
      "role": "Maintainer"
    }
  ],
  "support": {
    "issues": "https://www.drupal.org/project/issues/bootstrap_storybook"
  },
  "license": "GPL-2.0+",
  "minimum-stability": "dev",
  "require": {
    "drupal/components": "^1.0"
  },
  "require-dev": {
    "consolidation/robo": "^1.0.0"
  }
  "autoload": {
    "psr-4": {
      "Drush\\Commands\\bootstrap_storybook\\": "Commands/bootstrap_storybook/"
    }
  }
}

I don't have the time at the moment to submit a patch, so this is what I can offer for now. I may have missed dependencies. At the very least, all dependencies should be listed in documentation.

jcandan’s picture

Yeah, maybe, in fact we ought to not explicitly require Robo, but instead note it as a dependency if one wished to use the sub-theme feature. I don't know. I am on the fence now, thinking about it.

jcandan’s picture

But, definitely this should still have a composer file and list drupal components as required, and the psr-4 autoloading.

doxigo’s picture

Hey @jcandan, Thanks for your considerations and thoughtful ideas, unfortunately the roadmap of this theme is a lot of features and I'm quite limited in time.

Back to your comment, I personally avoid using a composer.json in the theme because it will cause a lot of issues due to how Drupal handles the dependencies.

For instance, right now with Radix you'll get an error if you're more than one person working on a website, imagine the scenario that I install the theme, make the child theme and then commit my changes to git, the next person pulling that changes will get an error due to lack of Components module since people would just run composer install in the root as usual.

The problem can be avoided if we just add it as an extra step to install the Components as a Drupal module itself

but having a composer.json file in theme makes sense in general

let me know what you think

jcandan’s picture

Wouldn't the second person in your scenario get the Components module because it is required? I am not sure I follow.

doxigo’s picture

Unless you commit the modules/components directory itself they wouldn't, the database shows it as enabled but the file is missing, that's an issue right now on Radix, for instance, if you try to install the Radix theme and make a child theme, there won't be any drupal/components listed as requirements in the root composer.json file

Maybe we can add another step to readme like:
make sure to run `composer install` inside the theme itself, hm? 🤔

That way you're right we can have it inside the theme as a dependency, But I still think it's going to be misleading since you have a module installed and it's not listed in the root composer.json

jcandan’s picture

Okay, this Components bit might need its own ticket, but getting back to Robo, I am still getting the same error above, even after running composer require --dev consolidation/robo! Thoughts?

doxigo’s picture

About your issue have you updated to the latest version/dev?

I've checked and it's fixed, maybe re-download the whole thing and let me know the steps you're taking so I can re-create it

jcandan’s picture

I had "drupal/bootstrap_storybook": "^2.5".

I ran composer require drupal/bootstrap_storybook:2.x-dev so that I now have "drupal/bootstrap_storybook": "2.x-dev" as per your suggestion. I reran the drush command, but this change did not fix the issue.

It's strange, PHPStorm sees TaskAccessor, why doesn't this drush command?

jcandan’s picture

Oh! Duh. I was using global drush that comes installed with Lando. I needed to composer require --dev drush/drush! Fixed. I would still recommend listing these dependencies in documentation, please. Thanks for your help!

doxigo’s picture

Category: Bug report » Support request
Status: Active » Fixed

Glad that it worked, thanks for your note, I updated the frontpage readme here

doxigo’s picture

jcandan’s picture

Cool. Still need to note the Robo dependency though, too. :)

jcandan’s picture

Component: Code » Documentation
Category: Support request » Task
Status: Fixed » Active

Sorry to be a stickler, but the Robo dependency is still not on the project page or in the README.

  • doxigo committed 6332fea on 8.x-2.x authored by jcandan
    Issue #3110121 by jcandan, doxigo, santhoshabraham: Can't Install Sub...
doxigo’s picture

Status: Active » Fixed

Sorry I forgot that part. added the `composer.json` let me know if it works alright

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.