isaacs/npm — Issue #1632: Feature: possibility to limit installation to some subset of platforms
Author: mmalecki
Created: 2011-10-31 14:42:59+00:00
State: open

I would like to limit installation of my module to some subset of platforms.

For example, my [mount](https://github.com/mmalecki/node-mount) module uses [`mount` invocation](https://github.com/mmalecki/node-mount/blob/master/src/mount.cc#L18) which is [typical to Linux](http://linux.die.net/man/2/mount) and simply won't compile on [Mac OS X](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/mount.2.html).

I think such entries in `package.json` could look like:

# Approach 0
```js
{
...
platform: ["linux", "darwin"]
}
```

for whitelist of platforms, or

```js
{
...
platform: ["!darwin"]
}
```
if a developer would like to blacklist some platform. However, I'm not sure how to act in case when someone specifies both white- and blacklist entries (specifying whitelist entries would make no sense there, so they should be simply ignored, I think?)

# Approach 1
(It would be way easier to process)

```js
{
...
platform: {
blacklist: ["darwin"]
}
}
```
and

```js
{
...
platform: {
whitelist: ["linux", "solaris"]
}
}
```
Specifying both `blacklist` and `whitelist` would be illegal.

If @isaacs likes it, I can implement it.