-
Notifications
You must be signed in to change notification settings - Fork 405
Better support for Yarn workspaces #1225
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
Changes from all commits
31bc3f4
78a9cb1
b2df7ee
04a835e
4bc0881
4b18d43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| 'use strict'; | ||
|
|
||
| const path = require('path'); | ||
|
|
||
| /** | ||
| * @func resolveFileInPackage | ||
| * Resolves a file inside a package | ||
| */ | ||
| const resolveFileInPackage = (packageName, ...pathElements) => { | ||
| return require.resolve(path.join(packageName, ...pathElements)); | ||
| }; | ||
|
|
||
| /** | ||
| * @func resolveDirInPackage | ||
| * Resolves a file inside a package | ||
| */ | ||
| const resolveDirInPackage = (packageName, ...pathElements) => { | ||
| return path.dirname(resolveFileInPackage(packageName, ...pathElements)); | ||
| }; | ||
|
|
||
| /** | ||
| * @func resolvePackageFolder | ||
| * Resolves the location of a package on disc | ||
| */ | ||
| const resolvePackageFolder = packageName => { | ||
| return path.dirname(resolveFileInPackage(packageName, 'package.json')); | ||
| }; | ||
|
Comment on lines
+9
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question for this. The whole concept is working without process.cwd() is that correct?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Patternlab loads files from installed NodeJS packages. It starts loading via whatever resolver a package manager could configure inside the Node runtime. In my case, I want to support Yarn v2 with PnP active eventually. In such a setup, no
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it does not interfere with other resolvers like npm or yarn v1 everything is fine.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JosefBredereck if uikit resolution works via |
||
|
|
||
| module.exports = { | ||
| resolveFileInPackage, | ||
| resolveDirInPackage, | ||
| resolvePackageFolder, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Please provide an example
patternlab-config.jsonfor that or change the given ones. The user shouldn't get warnings for a freshly installed pattern-lab after we merge this.Most Important
Less Important or Internal
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.
packages/core/test/util/patternlab-config.jsonis left as is intentionally because it is used in the tests for checking the warning messages.Question back:
packages/development-edition-engine-react/patternlab-config.jsondoesn't have auikitsblock, but does point to./node_modules/@pattern-lab/uikit-workshopfiles inside thepathssection. With my change, this won't work in Yarn v2. I don't know if this is anything specific to React but I would need some help here on what to do.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.
Leave it out then. I'm not shure which engines are used anymore. Some feel depreacated / outdated anyway.