napi-rs/cli/src/update-package.ts

10 lines
243 B
TypeScript
Raw Normal View History

2020-09-04 17:22:15 +09:00
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))
}