ADHIRAJ SINGH
ADHIRAJ SINGH

Reputation: 1

Npm commands to execute scripts

"scripts": {
  "release": "npm run release| tee output1.txt",
  "build":"npm run build | tee output.txt"
},

Then I used:

npm run release

Output:Killed

Please help I pass two test cases one is remaining

Upvotes: 0

Views: 6311

Answers (4)

Anil Reddy
Anil Reddy

Reputation: 231

This is what you are expecting.

"scripts": {
  "release": "npm -v && node -v",
  "build":"node index.js"
}

run below commands and you can get the output as expected.

npm run release| tee output1.txt

npm run build | tee output.txt

Upvotes: 1

sandrooco
sandrooco

Reputation: 8756

This is a perfect case for post scripts:

"scripts": {
  "release": "do something",
  "postrelease": "tee output1.txt",
  "build": "do something different",
  "postbuild": "tee output.txt"
},

Upvotes: 0

Apoorva Chikara
Apoorva Chikara

Reputation: 8773

Scripts tag is generally used to automate repetitive tasks. You can define any number of these.

"scripts": {
  "release": "npm run release| tee output1.txt && npm run build | tee output.txt",
},

The && is referred to as AND_IF helps you to run both the commands in sequence that means if first command fails to execute it won't run the next command.

Upvotes: 0

Hamit Tokay
Hamit Tokay

Reputation: 1

you can combine scripts by && operator. They will be executed one by one

"scripts": { "release": "npm run release && tee output1.txt", "build":"npm run build && tee output.txt" }

Upvotes: 0

Related Questions