json icon indicating copy to clipboard operation
json copied to clipboard

problem adding another key to object

Open richpowell opened this issue 9 years ago • 1 comments

Ideally I'd like to get an outputted json like "scripts": { "dev": "watch 'npm run build, src", "test": "jest", "test:watch": "npm test -- --watch"
},

I can get the first two lines to run and change my config.json in npm script, but adding that last "test:watch": "npm test -- --watch" line has me scratching my head.. any thoughts?

Here is what I've constructed so far.. The last line isnt working, and adds nothing to my script. nor errors out.

json -I -f config.json -e 'this.scripts={"dev": "watch \u0027npm run build\u0027, src"}'

json -I -f config.json -e 'this.scripts.test= "jest"'

json -I -f config.json -e 'this.scripts.test["watch"]="npm test -- --watch"'

richpowell avatar Apr 06 '17 04:04 richpowell

I think sometimes just posting the question you vet out the answer. json -I -f config.json -e 'this.script["test.watch"] = "npm test -- --watch"'

richpowell avatar Apr 06 '17 04:04 richpowell