-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat(cli): add monorepo and Yarn PnP support #1418
Conversation
🦋 Changeset detectedLatest commit: d9df4d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
02be2b9
to
8d78546
Compare
This is awesome. Thanks @merceyz . |
4c0399d
to
ae12eaf
Compare
In normal repos the behaviour should be the same, and hopefully already covered by tests |
82748cb
to
fea6647
Compare
09e56c4
to
a83f767
Compare
let modules = resolve(cwd, 'node_modules'); | ||
|
||
if (!isDir(modules)) { | ||
return error( | ||
'No `node_modules` found! Please run `npm install` before continuing.', | ||
1 | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When run in a monorepo where the hoisting is good this folder wont exist so checking if the project is installed like this is not correct
Note that adding peer deps is a breaking change, even when optional, for clients that don’t support optional peer deps - which includes most of npm 6, and some versions of yarn. |
4f2dbeb
to
8c95b73
Compare
@ljharb To prevent old package managers from freaking out while letting newer package mangers know about them Yarn and pnpm (unsure about npm) supports just setting |
@merceyz yes, i'm saying that support for You can mitigate this by adding engines entries for yarn and npm (and pnpm, i suppose) - but doing so is also a breaking change. |
I know, that's why I said only specifying that field is the solution to that problem
|
I’m under the impression that peer deps are invalid if they are only listed in peerDependenciesMeta - Meta is a modifier, not a declaration. |
Yarn and pnpm (again, unsure about npm) treats them as an implicit peer dependency to allow projects to declare their dependencies without messing with older package managers |
I can really use this at the moment - any idea when the next |
This breaks the |
This reverts commit 4b81641.
What kind of change does this PR introduce?
bugfix, feature
Did you add tests for your changes?
Added an e2e test that will test
preact-cli
for undeclared dependencies and incorrect assumptions about thenode_modules
layout using Yarn PnP's strict dependency checks.Summary
preact-cli
doesn't work with Yarn PnP and monorepos usingnode_modules
due to its incorrect assumptions about thenode_modules
layout, various undeclared dependencies, and not resolving dependencies it provides.Fixes #1046
Fixes #1105
Fixes #1043
Does this PR introduce a breaking change?
No
Other information
N/A