Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/payalord/cross-exec
Simple script to identify and execute further scripts by platform
https://github.com/payalord/cross-exec
Last synced: about 5 hours ago
JSON representation
Simple script to identify and execute further scripts by platform
- Host: GitHub
- URL: https://github.com/payalord/cross-exec
- Owner: payalord
- License: mit
- Created: 2022-04-02T21:10:52.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-11T05:52:19.000Z (over 2 years ago)
- Last Synced: 2024-11-08T15:51:07.939Z (9 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/cross-exec.svg)](https://www.npmjs.com/package/cross-exec)
# 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 ="command 1" ="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:
```json
"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](LICENSE)