Skip to content

editPackageJson

Reads, edits, and writes back the package.json file using the provided edit function.

Import:

import { editPackageJson } from 'obsidian-dev-utils/script-utils/npm';

Signature:

function editPackageJson(editFn: (packageJson: PackageJson) => Promisable<void>, options: EditPackageJsonOptions): Promise<void>

Parameters:

ParameterTypeDescription
editFn(packageJson: PackageJson) => Promisable<void>The function to edit the parsed PackageJson object.
optionsEditPackageJsonOptionsAdditional options for editing.

Returns: Promise<void> — A Promise that resolves when the file has been edited and written.


Links to this page: