Skip to content

Instantly share code, notes, and snippets.

@coryhouse
Last active September 26, 2024 04:50
Show Gist options
  • Save coryhouse/b26f49bead69066844d9 to your computer and use it in GitHub Desktop.
Save coryhouse/b26f49bead69066844d9 to your computer and use it in GitHub Desktop.
Example of calling one script from another
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack"
}
}
@mcandre
Copy link

mcandre commented Sep 25, 2024

&& assumes a POSIX sh environment. This likely breaks on various and sundry Windows environments, it may break the default (Free)BSD csh. It may break fish, Plan 9's rc, ion, and more.

A Gruntfile or makefile are more portable than NPM's awful built-in task runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment