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

Allow Node.js-like runtimes to identify as Node.js as well. #2357

Merged
merged 1 commit into from Feb 22, 2019

Conversation

abernix
Copy link
Member

@abernix abernix commented Feb 22, 2019

Previously, in order to only load dependencies which only work on Node.js and fail in non-Node.js environments, we introduced a check which did a string-comparison of process.release.name to see if it is was node.

This was first introduced in 9c563fa as part of #2054, but has gone on to be useful for other purposes as well.

Some Node.js forks such as NodeSource's N|Solid, which is a fork of Node.js which follows-up each Node.js release with a custom build that includes additional native addons but is otherwise the same, override this value with their own name. This means that N|Source returns nsolid, despite the fact
that it is almost entirely the same as Node.js.

Luckily, N|Solid leaves the base version of its Node.js in process.versions.node (and additionally adds its own process.versions.nsolid). By relaxing the string comparison on process.release.name, we should still be able to accurately detect the environment we want - which is "Close enough to Node.js!".

Fixes #2356

Previously, in order to only load dependencies which only work on Node.js
and fail in non-Node.js environments, we introduced a check which did a
string-comparison of `process.release.name` to see if it is was `node`.

This was first introduced in 9c563fa as
part of #2054, but has gone on to be useful for other purposes as well.

Some Node.js forks such as NodeSource's N|Solid, which is a fork of Node.js
which follows-up each Node.js release with a custom build that includes
additional native addons but is otherwise the same, override this value with
their own name.  This means that N|Source returns `nsolid`, despite the fact
that it is almost entirely the same as Node.js.

Luckily, N|Solid leaves the base version of its Node.js in
`process.versions.node` (and additionally adds its own
`process.versions.nsolid`).  By relaxing the string comparison on
`process.release.name`, we should still be able to accurately detect the
environment we want - which is "Close enough to Node.js!".

Fixes #2356
@abernix abernix merged commit 8b02c0c into master Feb 22, 2019
@abernix abernix deleted the abernix/accommodate-nodesource-nsolid branch February 22, 2019 07:04
trevor-scheer added a commit to apollographql/apollo-tooling that referenced this pull request Mar 4, 2019
trevor-scheer added a commit to apollographql/apollo-tooling that referenced this pull request Mar 4, 2019
trevor-scheer added a commit to apollographql/apollo-tooling that referenced this pull request Mar 13, 2019
trevor-scheer added a commit to apollographql/apollo-tooling that referenced this pull request Mar 13, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant