Subject: Scripts chain-calling
Author: WebSpider
In response to: Scripts calling scripts
Posted on: 04/22/2021 10:22:36 PM
package.json:
...
"scripts": {
"start": "node index.js",
"hello": "echo 'Hello World!'",
"calling-hello": "npm run hello",
"calling-hello-and": "npm run hello && echo 'Hello NPM!'"
}
...
C:\tmp\npm-scripts\hello>npm run calling-hello-and
> hello@1.0.0 calling-hello-and C:\tmp\npm-scripts\hello
> npm run hello && echo 'Hello NPM!'
> hello@1.0.0 hello C:\tmp\npm-scripts\hello
> echo 'Hello World!'
'Hello World!'
'Hello NPM!'
>
> On 04/22/2021 10:15:30 PM
WebSpider wrote:
package.json:
...
"scripts": {
"start": "node index.js",
"hello": "echo 'Hello World!'"
"calling-hello": "npm run hello",
}
...
C:\tmp\npm-scripts\hello>npm run calling-hello
> hello@1.0.0 calling-hello C:\tmp\npm-scripts\hello
> npm run hello
> hello@1.0.0 hello C:\tmp\npm-scripts\hello
> echo 'Hello World!'
'Hello World!'
References: