Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-exec

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-exec

Simple script to identify and execute further scripts by platform

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm

cross-exec

Simple script to identify platform and execute further npm scripts, such as build scripts (for example), by platform.

Installation

npm i -D cross-exec

Syntax

cross-exec <platform-name-1>="command 1" <platform-name-2>="command 2"...

  • platform-name argument must include platform name in it (i.e win32 for example), but it can also have additional characters. Example: --win32=\"npm run build:win32\". Two dashes will be ignored in that case.

Usage

Let say you have build npm scripts for 3 platforms and you want to create 4th script to auto build, but depends on what platform you are currently running it:

package.json scripts:

"build": "cross-exec win32=\"npm run build:win32\" linux=\"npm run build:linux\" darwin=\"npm run build:darwin\"",
"build:win32": "echo \"Win32 build process\"",
"build:linux": "echo \"Linux build process\"",
"build:darwin": "echo \"Mac OS build process\""

Script finds by proccess.platform which is the current platform. Then executes command value passed by argument with the same platform name. This gives you ability to auto build based on what platform you are working right now.

License

MIT License

Keywords

FAQs

Package last updated on 08 Apr 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