Skip to content

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

Merged
merged 2 commits into from
Mar 17, 2017
Merged

Update yarn executable #217

merged 2 commits into from
Mar 17, 2017

Conversation

dblandin
Copy link
Contributor

@dblandin dblandin commented Mar 16, 2017

  • Update bin/yarn executable
    • Specify current user id/group within container to fix write permission errors
    • Simplify docker run invocation
  • Add shellcheck engine to codeclimate analysis

Addresses #173 (comment)

$ 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'".

@dblandin dblandin requested a review from maxjacobson March 16, 2017 23:49
Copy link
Contributor

@wfleming wfleming left a 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)" \
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor Author

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?

@dblandin dblandin force-pushed the devon/update-yarn-executable branch from 7acfe70 to f4fc4b1 Compare March 17, 2017 16:25
- 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'".
```
@dblandin dblandin force-pushed the devon/update-yarn-executable branch from f4fc4b1 to 9af52c7 Compare March 17, 2017 16:40
@dblandin
Copy link
Contributor Author

Verified the mac behavior (at least via Docker for Mac) with @ABaldwinHunter. Going to go ahead and merge this on green.

@dblandin dblandin merged commit d1524f9 into master Mar 17, 2017
@dblandin dblandin deleted the devon/update-yarn-executable branch March 17, 2017 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants