[npm] Refactor package.json code

Pull request used instead of rebase just for testing.