-
Notifications
You must be signed in to change notification settings - Fork 93
Update yarn executable #217
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
Conversation
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.
LGTM, left one note about double-checking Mac behavior.
bin/yarn
Outdated
docker run --rm --volume "$PWD:/usr/src/app" "$IMAGE_NAME" sh -c "cd /usr/src/app && yarn $*" | ||
docker run \ | ||
--rm \ | ||
--user "$(id -u):$(id -g)" \ |
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.
This may not work as desired for Mac users: I know the Docker for Mac VM runs as root, and I think I ran into some issues with user perms and mounts working with that at one point.
Come to think of it, that might have been for stuff within a Dockerfile, so this might work fine. Might want to have a Mac user confirm before merging, though.
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.
I think I confirmed locally this breaks with Docker for Mac. Got this running on this branch:
[codeclimate-eslint] bin/yarn upgrade devon/update-yarn-executable☃ ✱
yarn upgrade v0.21.3
error An unexpected error occurred: "EACCES: permission denied, mkdir '/.config'".
info If you think this is a bug, please open a bug report with the information provided in "/usr/src/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
Worked as expected on master
.
I did some conditional fanciness in one of our repos way back to set this conditionally by platform. If you think it's worth it, you could do the same here by grepping uname -a
for Darwin
and using root:root on Darwin, and what you already have in other cases.
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.
I think making this cross-compatible is ideal
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.
Just pushed up a commit with a conditional.
@maxjacobson Would you mind trying it out?
7acfe70
to
f4fc4b1
Compare
- Specify current user id/group within container to fix write permission errors - Simplify docker run invocation ``` $ bin/yarn add eslint-plugin-html yarn add v0.21.3 [1/4] Resolving packages... [2/4] Fetching packages... error Could not write file "/usr/src/app/yarn-error.log": "EACCES: permission denied, open '/usr/src/app/yarn-error.log'" info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. error An unexpected error occurred: "EACCES: permission denied, unlink '/usr/src/app/node_modules/.yarn-integrity'". ```
f4fc4b1
to
9af52c7
Compare
Verified the mac behavior (at least via Docker for Mac) with @ABaldwinHunter. Going to go ahead and merge this on green. |
Addresses #173 (comment)