{"action":"created","issue":{"url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/189","labels_url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/189/comments","events_url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/189/events","html_url":"https://github.com/tjunnone/npm-check-updates/issues/189","id":121909840,"number":189,"title":"Preserve whitespaces between keys and values in package.json","user":{"login":"rse","id":221273,"avatar_url":"https://avatars.githubusercontent.com/u/221273?v=3","gravatar_id":"","url":"https://api.github.com/users/rse","html_url":"https://github.com/rse","followers_url":"https://api.github.com/users/rse/followers","following_url":"https://api.github.com/users/rse/following{/other_user}","gists_url":"https://api.github.com/users/rse/gists{/gist_id}","starred_url":"https://api.github.com/users/rse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rse/subscriptions","organizations_url":"https://api.github.com/users/rse/orgs","repos_url":"https://api.github.com/users/rse/repos","events_url":"https://api.github.com/users/rse/events{/privacy}","received_events_url":"https://api.github.com/users/rse/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tjunnone/npm-check-updates/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/tjunnone/npm-check-updates/labels/low-priority","name":"low-priority","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-13T09:42:08Z","updated_at":"2015-12-25T00:49:00Z","closed_at":"2015-12-18T17:12:34Z","body":"npm-check-updates is a wonderful tool I'm using regularily to update all my package.json files. Unfortunately, npm-check-updates on -u does not preserve whitespaces between keys and values when updating package.json. I'm usually using a package.json like this:\r\n\r\n```\r\n    \"devDependencies\": {\r\n        \"grunt\":                \"~0.4.5\",\r\n        \"grunt-cli\":            \"~0.1.13\",\r\n        \"grunt-contrib-jshint\": \"~0.11.2\",\r\n        \"grunt-contrib-clean\":  \"~0.6.0\",\r\n        \"grunt-eslint\":         \"~17.1.0\",\r\n        \"grunt-mocha-test\":     \"~0.12.7\",\r\n        \"mocha\":                \"~2.2.5\"\r\n    },\r\n    \"dependencies\" : {\r\n        \"package\":              \"~1.0.1\",\r\n        \"lodash\":               \"~3.10.1\",\r\n        \"datauri\":              \"~0.7.1\",\r\n        \"html-minifier\":        \"~0.7.2\",\r\n        \"clean-css\":            \"~3.4.1\",\r\n        \"uglify-js\":            \"~2.4.24\",\r\n        \"chalk\":                \"~1.1.1\",\r\n        \"pretty-bytes\":         \"~2.0.1\",\r\n        \"sprintfjs\":            \"~1.2.0\",\r\n        \"dashdash\":             \"~1.10.0\"\r\n    },\r\n```\r\nAfter running `npm-check-updates -uat` I get:\r\n\r\n```\r\n    \"devDependencies\": {\r\n        \"grunt\":                \"~0.4.5\",\r\n        \"grunt-cli\":            \"~0.1.13\",\r\n        \"grunt-contrib-jshint\": \"~0.11.3\",\r\n        \"grunt-contrib-clean\": \"~0.7.0\",\r\n        \"grunt-eslint\": \"~17.3.1\",\r\n        \"grunt-mocha-test\":     \"~0.12.7\",\r\n        \"mocha\": \"~2.3.4\"\r\n    },\r\n    \"dependencies\" : {\r\n        \"package\":              \"~1.0.1\",\r\n        \"lodash\":               \"~3.10.1\",\r\n        \"datauri\": \"~1.0.0-alpha.5\",\r\n        \"html-minifier\": \"~1.0.0\",\r\n        \"clean-css\": \"~3.4.8\",\r\n        \"uglify-js\": \"~2.6.1\",\r\n        \"chalk\":                \"~1.1.1\",\r\n        \"pretty-bytes\":         \"~2.0.1\",\r\n        \"sprintfjs\": \"~1.2.1\",\r\n        \"dashdash\": \"~1.10.1\"\r\n    },\r\n```\r\nInstead, I'd like npm-check-updates to preserve all my existing whitespaces, so I can get:\r\n\r\n```\r\n    \"devDependencies\": {\r\n        \"grunt\":                \"~0.4.5\",\r\n        \"grunt-cli\":            \"~0.1.13\",\r\n        \"grunt-contrib-jshint\": \"~0.11.3\",\r\n        \"grunt-contrib-clean\":  \"~0.7.0\",\r\n        \"grunt-eslint\":         \"~17.3.1\",\r\n        \"grunt-mocha-test\":     \"~0.12.7\",\r\n        \"mocha\":                \"~2.3.4\"\r\n    },\r\n    \"dependencies\" : {\r\n        \"package\":              \"~1.0.1\",\r\n        \"lodash\":               \"~3.10.1\",\r\n        \"datauri\":              \"~1.0.0-alpha.5\",\r\n        \"html-minifier\":        \"~1.0.0\",\r\n        \"clean-css\":            \"~3.4.8\",\r\n        \"uglify-js\":            \"~2.6.1\",\r\n        \"chalk\":                \"~1.1.1\",\r\n        \"pretty-bytes\":         \"~2.0.1\",\r\n        \"sprintfjs\":            \"~1.2.1\",\r\n        \"dashdash\":             \"~1.10.1\"\r\n    },\r\n```\r\n\r\nBecause without this I always have to reformat the package.json manually afterwards.\r\nIt would be great if npm-check-updates could preserve existing whitespaces, perhaps just under a particular CLI option, of course."},"comment":{"url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/comments/167173275","html_url":"https://github.com/tjunnone/npm-check-updates/issues/189#issuecomment-167173275","issue_url":"https://api.github.com/repos/tjunnone/npm-check-updates/issues/189","id":167173275,"user":{"login":"rse","id":221273,"avatar_url":"https://avatars.githubusercontent.com/u/221273?v=3","gravatar_id":"","url":"https://api.github.com/users/rse","html_url":"https://github.com/rse","followers_url":"https://api.github.com/users/rse/followers","following_url":"https://api.github.com/users/rse/following{/other_user}","gists_url":"https://api.github.com/users/rse/gists{/gist_id}","starred_url":"https://api.github.com/users/rse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rse/subscriptions","organizations_url":"https://api.github.com/users/rse/orgs","repos_url":"https://api.github.com/users/rse/repos","events_url":"https://api.github.com/users/rse/events{/privacy}","received_events_url":"https://api.github.com/users/rse/received_events","type":"User","site_admin":false},"created_at":"2015-12-25T00:49:00Z","updated_at":"2015-12-25T00:49:00Z","body":"I've now written an alternative CLI for npm-check-updates which preserves the JSON syntax formatting now: https://www.npmjs.com/package/upd Thanks for listening and keep up your excellent npm-check-updates module."}}