-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix getting workspace ignores in case of non-monorepo #4268
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
@stefanofa is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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.
Hey! thanks for taking a stab at this!
The way I did it is a bit redundant, as in the case of a monorepo the call to
getWorkspaceGlobs
is made 2 times and so is not the most efficient.
Just making sure, do you mean there's a duplicate call to fs.ReadPackageJSON
?
Instead of fs.ReadPackageJSON
twice, how about returning a custom error from getWorkspaceGlobs
(instead of fmt.Errorf()
), and returning the ignores: ["node_modules/**]
in that case, but bubbling up all other errors?
Happy to give you another pointer to custom error handling if you want!
PS, I know @tknickman also said he might have time to take a look at this, in case he had a different solution in mind.
Yes, that's what I meant. By the way, I tried the refactor you suggested! |
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.
Couple more questions:
- What happens in a real monorepo when the workspace config is missing?
- In
npm
andpnpm
implementations ofgetWorkspaceIgnores
, the default return value is**/node_modules/**
. Should we use that as the default here also? Or can we trust the user that if the workspaces config is missing, then we really only want to ignore the root./node_modules
?
Co-authored-by: Mehul Kar <mehul.kar@vercel.com>
This should still error as we call
I think from my groking that |
Let's merge this into my branch then! |
Description
Hey @mehulkar I tried to fix #4140 .
This is my first time reading or writing in go so it's likely I may have done something wrong.
The way I did it is a bit redundant, as in the case of a monorepo the call to
getWorkspaceGlobs
is made 2 times and so is not the most efficient. Unfortunately I think I lack a lot of context to try and come up with a better solution, but I felt like trying :)