PackageUsage

Usage

Last updated:

Usage Guide

Find Monorepo Root

import { findMonorepoRoot } from "@visulima/package";

const result = await findMonorepoRoot();
// => { path: '/path/to/monorepo', strategy: 'pnpm' }

Detects: pnpm, npm, yarn, Lerna, Turborepo

Find Package Root

import { findPackageRoot } from "@visulima/package";

const result = await findPackageRoot();
// => { path: '/path/to/package', strategy: 'package' }

Find and Parse Package.json

import { findPackageJson } from "@visulima/package";

// Supports package.json, package.yaml, package.json5
const result = await findPackageJson();
console.log(result.packageJson.name);

// With options
const result2 = await findPackageJson("/path", {
    yaml: true,
    json5: true,
    resolveCatalog: true, // Resolve pnpm catalog
});

Read Package.json

import { readPackageJson } from "@visulima/package";

const pkg = await readPackageJson("/path/to/package.json");

Detect Package Manager

import { detectPackageManager } from "@visulima/package";

const pm = await detectPackageManager();
console.log(pm); // "pnpm" | "npm" | "yarn"
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues