Metreeca Gear
    Preparing search index...

    Function getPackage

    • Retrieves the base path of an enclosing package.

      Locates the package a path belongs to by its manifest, rather than by the folder the process happens to be started from, so that a path anchored to it is the same however the code is launched, whether from a shell, an IDE run configuration or a deployed workload.

      Parameters

      • path: string

        The absolute path the package is looked up from, typically the folder of the calling module, as given by import.meta.dirname

      Returns string

      The absolute path of the closest folder holding a package.json file, at or above path

      If neither path nor any folder above it holds a package.json file