0
"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

1
  • 3
    Looks like you're calling the same script within itself: npm run release, that might be the issue. Commented Jan 15, 2021 at 7:42

4 Answers 4

1

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
Sign up to request clarification or add additional context in comments.

Comments

0

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" }

Comments

0

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.

Comments

0

This is a perfect case for post scripts:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.