Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run Spectacle in a monorepo managed by Yarn workspaces #204

Open
thekevinbrown opened this issue Mar 4, 2020 · 0 comments
Open

Can't run Spectacle in a monorepo managed by Yarn workspaces #204

thekevinbrown opened this issue Mar 4, 2020 · 0 comments

Comments

@thekevinbrown
Copy link

thekevinbrown commented Mar 4, 2020

We're trying to use spectacle in a monorepo structured like this:

project:
  packages:
    api-1
    api-1-docs
    api-2
    api-2-docs

We're using Yarn workspaces, and because api-1-docs and api-2-docs share the Spectacle dependencies, they get hoisted up to the node_modules folder in project instead of landing in individual node_modules folders inside of api-1-docs and api-2-docs.

This is all fine until I try to run spectacle swagger.json. Then I get:

$ spectacle swagger.json

>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?
>> Local Npm module "grunt-contrib-cssmin" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-compile-handlebars" not found. Is it installed?
>> Local Npm module "grunt-prettify" not found. Is it installed?
>> Local Npm module "grunt-sass" not found. Is it installed?
>> Local Npm module "grunt-embed" not found. Is it installed?
Task error: [Error: Task "sass:foundation_scss" not found.
<stack trace>

It looks like this is because grunt's loadNpmTasks doesn't resolve modules as Node would. When I check in the parent node_modules folder all of those modules are there.

My workaround for the moment is:

pushd ../.. && spectacle packages/api-1-docs/swagger.json -t packages/api-1-docs/public && popd

But that's really messy. Is there any way to get Spectacle to resolve the grunt tasks the same way Node would so I can change the command back to spectacle swagger.json?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant