napi-rs/src/update-package.ts
2020-09-04 17:11:23 +08:00

9 lines
243 B
TypeScript

import { writeFileAsync } from './utils'
export async function updatePackageJson(
path: string,
partial: Record<string, any>,
) {
const old = require(path)
await writeFileAsync(path, JSON.stringify({ ...old, ...partial }, null, 2))
}