npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@visulima/package

v3.2.0

Published

One Package to rule them all, finds your root-dir, monorepo, or package manager.

Downloads

6,801

Readme

@visulima/fs, @visulima/path, normalize-package-data, pathe,and type-fest

typescript-image npm-image license-image



Install

npm install @visulima/package
yarn add @visulima/package
pnpm add @visulima/package

Usage

findMonorepoRoot

Find the root directory path and strategy for a monorepo based on the given current working directory (cwd).

import { findMonorepoRoot } from "@visulima/package";
// or import { findMonorepoRoot } from '@visulima/package/monorepo';

const root = findMonorepoRoot(); // => /Users/../Projects/visulima

findPackageRoot

Find the root directory path and strategy for a package based on the given current working directory (cwd).

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

const root = findPackageRoot(); // => /Users/../Projects/visulima/packages/package

findPackageJson

Find the package.json file in the specified directory or its parent directories.

import { findPackageJson } from "@visulima/package";
// or import { findPackageJson } from '@visulima/package/package-json';

const root = findPackageJson(); // => /Users/../Projects/visulima/packages/package/package.json

writePackageJson

Writes the package.json file with the given data.

import { writePackageJson } from "@visulima/package";
// or import { writePackageJson } from '@visulima/package/package-json';

writePackageJson({ name: "visulima" } /* ,{ cwd: "./" }*/);

parsePackageJson

Parse the package.json file.

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

const packageJson = parsePackageJson(/* object or package.json as string */);

findLockFile

Asynchronously finds a lock file in the specified directory or any of its parent directories.

import { findLockFile } from "@visulima/package";
// or import { findLockFile } from '@visulima/package/package-manager';

const lockFile = await findLockFile(); // => /Users/../Projects/visulima/packages/package/package-lock.json

findPackageManager

Finds the package manager used in a project based on the presence of lock files or package.json configuration.

If found, returns the package manager and the path to the lock file or package.json.

Throws an error if no lock file or package.json is found.

import { findPackageManager } from "@visulima/package";
// or import { findPackageManager } from '@visulima/package/package-manager';

const { packageManager, path } = findPackageManager(); // => { packageManager: 'npm', path: '/Users/../Projects/visulima/packages/package' }

getPackageManagerVersion

Retrieves the version of the specified package manager.

import { getPackageManagerVersion } from "@visulima/package";
// or import { getPackageManagerVersion } from '@visulima/package/package-manager';

const version = await getPackageManagerVersion("npm"); // => 7.5.4

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

About

Related Projects

License

The visulima package is open-sourced software licensed under the MIT