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

Skip build on platforms other than Windows #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vweevers
Copy link

Necessary when dependents are cross-platform. The alternatives are setting "os" in package.json (which only works for yarn,
not npm), using optionalDependencies in dependents (which would unfortunately ignore legit build failures), or building a dummy native addon (which is the current approach but it requires users to have an otherwise unnecessary build toolchain).

This simple solution works for both yarn and npm. Also accounts for cross-compiling scenarios (when process.platform does not match the target platform) by checking env.npm_config_platform.

Necessary when dependents are cross-platform. The alternatives
are setting "os" in package.json (which only works for yarn,
not npm), using optionalDependencies in dependents (which would
unfortunately ignore legit build failures), or building a dummy
native addon (which is the current approach but it requires users
to have an otherwise unnecessary build toolchain).

This simple solution works for both yarn and npm. Also accounts
for cross-compiling scenarios (when process.platform does not
match the target platform) by checking env.npm_config_platform.
@lotuswood
Copy link

@sergiou87 This solution looks sleek, though I didn't verify. Would you consider to approve it for a rc build?

@@ -0,0 +1,5 @@
const platform = process.env.npm_config_platform || process.platform

if (platform === 'win32') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this if condition be negated, so that it only exits with code 1 when the platform is not win32?

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