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

Improve: make peer checks more tolerant #118

Merged
merged 31 commits into from
Jun 11, 2021
Merged

Improve: make peer checks more tolerant #118

merged 31 commits into from
Jun 11, 2021

Conversation

kellymears
Copy link
Member

Type of change

  • MINOR: feature

Dependencies added

  • none

Details

Some people were having trouble with tailwindcss and eventually we figured out it was because tailwindcss was installed as a non dev dep, and @roots/bud-tailwindcss would exit early if it didn't see it in devDependencies specifically. There is similar behavior from most of the extensions that require additional packages to be installed as peers.

I don't really think it should matter to bud how the project structures its dependencies and so I wanted to check in both places before early exit. This requires a lot of annoying typing:

app.discovery.has('devDependencies.tailwindcss') && app.discovery.has('dependencies.tailwindcss') && doThing()

This change addresses that with a bud.discovery.hasPeerDependencies . It takes a package name and returns a boolean if the dependency is found in either the project level devDependencies or dependencies.

app.discovery.hasPeerDependency('tailwindcss') && doThing()

This change also makes the @roots/sage preset a lot more flexible in terms of how it can be imported/required (aligning it with most of the other extensions).

@github-actions github-actions bot added the docs label Jun 8, 2021
@github-actions github-actions bot removed the examples label Jun 8, 2021
@github-actions github-actions bot added @roots/bud-server dependencies Pull requests that update a dependency file labels Jun 9, 2021
@kellymears kellymears merged commit 3f5e257 into next Jun 11, 2021
@kellymears kellymears added this to the 4.5.0 milestone Jun 11, 2021
@kellymears kellymears deleted the improve-dep-checks branch June 12, 2021 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment