1. npm-run-posix-or-windows
Portable NPM scripts when those have to work on Windows too
npm-run-posix-or-windows
Package: npm-run-posix-or-windows
Created by: madarche
Last modified: Wed, 22 Jun 2022 08:59:27 GMT
Version: 2.0.2
License: MIT
Downloads: 6,999
Repository: https://github.com/madarche/npm-run-posix-or-windows

Install

npm install npm-run-posix-or-windows
yarn add npm-run-posix-or-windows

npm-run-posix-or-windows

NPM version
Dependency Status
devDependency Status
Build Status

This is a very lightweight and straightforward module that proposes a simple,
yet limited, solution to write portable NPM scripts when those have to work on
Windows too (the hell with Windows, hopefully someday all developers will be
working on Unix).

Use npm-run-posix-or-windows in NPM scripts to run an alternative script
when the script is run under Windows. When under Windows the script name is then
suffixed with :windows.

Usage:

 {
  "name": "some-package-name",
  "version": "1.0.0",
  "author": "SomeOne",
  "scripts": {
    "postinstall": "npm prune && npm-run-posix-or-windows postinstall:leveldown",
    "postinstall:leveldown": "cd node_modules/pouchdb/node_modules/leveldown && node-gyp rebuild --target=$npm_package_dependencies_electron_prebuilt --dist-url=https://atom.io/download/atom-shell",
    "postinstall:leveldown:windows": "cd node_modules/pouchdb/node_modules/leveldown && node-gyp rebuild --target=%npm_package_dependencies_electron_prebuilt% --dist-url=https://atom.io/download/atom-shell",
    "start": "electron ."
  },
  "dependencies": {
    "bluebird": "3.3.3",
    "electron-prebuilt": "0.36.7",
    "npm-run-posix-or-windows": "2.0.0",
    "pouchdb": "5.2.1"
  }
}

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code