New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cross-os

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-os

Allow to add OS-specific scripts in your package.json!

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cross-os

npm version npm downloads dependencies

OS Specific npm scripts! Ideal for tasks that differs across Operating System Platforms

Install

$ npm install cross-os --save-dev

Usage

Add scripts to your package.json like so:

  • it supports darwin, freebsd, linux, sunos or win32
"scripts": {
  "foo": "cross-os bar",
  "bar": {
    "darwin": "echo 'i will only run on Mac'",
    "win32": "echo 'i will only run on Windows'",
    "linux": "echo 'i will only run on Linux'"
  }
}

And call it like:

npm run foo

Alternatively you can also specify scripts on its own section in your package.json

"scripts": {
  "foo": "cross-os bar"
}
"cross-os": {
  "bar": {
    "darwin": "echo 'i will only run on Mac'",
    "win32": "echo 'i will only run on Windows'",
    "linux": "echo 'i will only run on Linux'"
  }
}

You also can pass args to the underlying script like this:

"scripts": {
  "foo": "cross-os bar -- arg1 arg2"
}
"cross-os": {
  "bar": {
    "darwin": "echo received arg: ",
    "win32": "echo received arg: ",
    "linux": "echo received arg: "
  }
}

or directly from the npm run script like this:

npm run foo -- arg1 arg2

License

MIT © Rafael Milewski

Keywords

FAQs

Package last updated on 17 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc