test-filesystem
    Preparing search index...

    Function writePackageJson

    • Write a package.json file for a directory, creating any missing parent directories first. Parses and re-serializes with a plain 2-space indent regardless of how fields was built, so callers never need to worry about matching JSON formatting by hand.

      Parameters

      • dirPath: string

        The directory to write the package.json file into.

      • fields: Record<string, any>

        The package.json fields to write.

      Returns void