Below is an example how to run a script from another with npm
in package.json
.
What's the equivalent with yarn
?
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
}
}
You could do
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "yarn run clean",
}
}
And then the command yarn run prebuild
should work.
Also you could just do yarn run clean
.
Documentation of the run
cli : https://yarnpkg.com/lang/en/docs/cli/run/