Skip to content
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

Prevent linking in some cases #3

Closed
SamVerschueren opened this issue Aug 28, 2016 · 6 comments
Closed

Prevent linking in some cases #3

SamVerschueren opened this issue Aug 28, 2016 · 6 comments

Comments

@SamVerschueren
Copy link
Owner

Actually, alfred-link should only be invoked when installed globally. Because of this package, tests for alfred-ng2 or alfred-npms will break because Travis tries to execute alfred-link. What would be the best way to prevent this? Just return and do nothing when ran on Travis?

https://travis-ci.org/sindresorhus/alfred-npms/builds/155452588

@sindresorhus
Copy link
Collaborator

Is there any way can detect whether it's being installed with the --global script in alfred-link? Might be some environment variables available.

@SamVerschueren
Copy link
Owner Author

Couldn't find anything in the docs so have to test this.

@SamVerschueren
Copy link
Owner Author

Apparently, process.env.npm_config_global is set to 'true'.

@nanoxd
Copy link

nanoxd commented May 29, 2017

It looks like the npm_config_global env variable isn't set by yarn. Looking through their commits, they did add support for some of the npm_config_* variables but it's unclear what those are. As a workaround, I deleted yarn.lock to use npm as seen on nanoxd/alfred-pods@6eb1314

Relevant issue: yarnpkg/yarn#399

Adding a note to the README would be helpful for anyone else encountering issues when using CI and yarn.

@sindresorhus
Copy link
Collaborator

@nanoxd Can you open a new Yarn issue about it? Their intention is to be compatible with npm, so it probably just an oversight.

@nanoxd
Copy link

nanoxd commented May 29, 2017

Sure 😄

nanoxd added a commit to nanoxd/yarn-bug-global-flag that referenced this issue May 29, 2017
Adding the yarn lockfile will break on CI because it no longer sets
`process.env.npm_config_global` to `'true'`. `alfred-link` keys off of
that to know if it should link the Workflow to Alfred:

Relevant: SamVerschueren/alfred-link#3 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants