Edit package.json from command line

前端 未结 5 428
北恋
北恋 2021-01-30 01:19

I\'m trying to add or edit a variable in my package.json from a shell script. So if i have a package.json like this:

{
  \"name\": \"my-project\",
  \"descripti         


        
5条回答
  •  鱼传尺愫
    2021-01-30 02:09

    If you don't want to install sponge or json, you can also do

    echo "`jq '.foo="bar"' package.json`" > package.json
    

提交回复
热议问题