Documentation for Simbo's Packages
    Preparing search index...

    Module @simbo/find-up-package - v1.0.3

    Find Up Package

    📦 @simbo/find-up-package

    A utility for finding an npm package in the directory hierarchy that matches specific criteria.

    It uses find-up to walk up the filesystem, checking each package.json until it finds a match.

    ⸻

    Features

    • Search upwards for a package.json file matching custom conditions

    • Configurable matcher function for defining what counts as a match

    • Returns the found directory path and the parsed package.json

    • Optionally normalize the package.json using npm's normalize-package-data

    • Async, Promise-based API

    • Fully typed with TypeScript

    Install @simbo/find-up-package from the npm registry:

    npm i [-D] @simbo/find-up-package
    

    For a complete API reference, see the documentation.

    import { findUpPackage } from '@simbo/find-up-package';

    const result = await findUpPackage();

    if (result) {
    console.log(`Found package.json in: ${result.path}`);
    console.log(result.packageJson.name, result.packageJson.version);
    }

    MIT © Simon Lepel

    Interfaces

    NormalizeOptions
    Options
    Package
    PackageNormalized

    Type Aliases

    MatchFn
    OptionsWithNormalize
    OptionsWithoutNormalize
    PackageJsonNormalized

    Functions

    findUpPackage