Added writeToPackageJson method.