Detalhes do pacote

@visulima/package

visulima8.5kMIT3.5.8

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

anolilab, find, find-monorepo-root, find-up-pkg

readme (leia-me)

Visulima package

One Package to rule them all, finds your root-dir, monorepo or package manager is built on top of @visulima/fs, @visulima/path, normalize-package-data, pathe,and type-fest


typescript-image npm-image license-image

Daniel Bannert's open source work is supported by the community on GitHub Sponsors


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

changelog (log de mudanças)

@visulima/package 3.5.8 (2025-06-04)

Dependencies

  • @visulima/fs: upgraded to 3.1.5
  • @visulima/path: upgraded to 1.4.0

@visulima/package 3.5.7 (2025-06-03)

Dependencies

  • @visulima/fs: upgraded to 3.1.4

@visulima/package 3.5.6 (2025-06-01)

Bug Fixes

  • package-json: add check to prevent installation of already installed packages (8c0d9ff)

@visulima/package 3.5.5 (2025-05-30)

Bug Fixes

  • package-fixture-pkg-json: update dependencies (be59bd9)
  • package: @antfu/install-pkg is now bundled into the code (67ee109)
  • package: update dependencies (ab398fe)

Styles

Miscellaneous Chores

  • package-fixture-ws-bad: update fixture (c10275b)

Dependencies

  • @visulima/fs: upgraded to 3.1.3
  • @visulima/path: upgraded to 1.3.6

@visulima/package 3.5.4 (2025-03-12)

Bug Fixes

  • package: update @inquirer/confirm, @babel/core, @inquirer/core, @inquirer/type, @pnpm/exe, @rushstack/eslint-plugin-security, and eslint-plugin-mdx to latest versions (c6ce243)

@visulima/package 3.5.3 (2025-03-07)

Bug Fixes

  • updated @visulima/packem and other dev deps, for better bundling size (e940581)

Dependencies

  • @visulima/fs: upgraded to 3.1.2
  • @visulima/path: upgraded to 1.3.5

@visulima/package 3.5.2 (2025-03-03)

Miscellaneous Chores

  • updated dev dependencies (487a976)

Dependencies

  • @visulima/fs: upgraded to 3.1.1

@visulima/package 3.5.1 (2025-01-29)

Dependencies

  • @visulima/fs: upgraded to 3.1.0

@visulima/package 3.5.0 (2025-01-26)

Features

  • package: adding strict parsing to findPackageJson, findPackageJsonSync and parsePackageJson (#485) (67636d2)

@visulima/package 3.4.8 (2025-01-25)

Bug Fixes

  • fixed wrong node version range in package.json (4ae2929)

Miscellaneous Chores

Dependencies

  • @visulima/fs: upgraded to 3.0.1
  • @visulima/path: upgraded to 1.3.4

@visulima/package 3.4.7 (2025-01-25)

Miscellaneous Chores

  • updated all dev dependencies (37fb298)

Dependencies

  • @visulima/fs: upgraded to 3.0.0

@visulima/package 3.4.6 (2025-01-22)

Bug Fixes

  • package: updated @inquirer/confirm to ^5.1.3 and all dev deps (c8affca)

Miscellaneous Chores

  • lock file update, added dedupe lint command (5ba7093)

Dependencies

  • @visulima/fs: upgraded to 2.3.8

@visulima/package 3.4.5 (2025-01-16)

Bug Fixes

  • package: exported FindPackageJsonCache for findPackageJson and findPackageJsonSync (36e241c)

@visulima/package 3.4.4 (2025-01-13)

Dependencies

  • @visulima/fs: upgraded to 2.3.7
  • @visulima/path: upgraded to 1.3.3

@visulima/package 3.4.3 (2025-01-12)

Bug Fixes

  • package: updated @antfu/install-pkg to v1, @inquirer/confirm 5.1.2 and all dev deps (a30e052)

Dependencies

  • @visulima/fs: upgraded to 2.3.6
  • @visulima/path: upgraded to 1.3.2

@visulima/package 3.4.2 (2025-01-08)

Dependencies

  • @visulima/fs: upgraded to 2.3.5
  • @visulima/path: upgraded to 1.3.1

@visulima/package 3.4.1 (2025-01-08)

Dependencies

  • @visulima/fs: upgraded to 2.3.4
  • @visulima/path: upgraded to 1.3.0

@visulima/package 3.4.0 (2025-01-03)

Features

  • package: ensurePackages confirm message key support now a function call (aa8d64c)

@visulima/package 3.3.0 (2025-01-02)

Features

  • added new ensurePackages function to install missing packages (20c05c0)

@visulima/package 3.2.2 (2024-12-31)

Dependencies

  • @visulima/fs: upgraded to 2.3.3
  • @visulima/path: upgraded to 1.2.0

@visulima/package 3.2.1 (2024-12-27)

Bug Fixes

  • fs: added missing yaml to dependencies (210b995)

Miscellaneous Chores

  • updated dev dependencies (9de2eab)

Dependencies

  • @visulima/fs: upgraded to 2.3.2

@visulima/package 3.2.0 (2024-12-16)

Features

  • package: added new generateMissingPackagesInstallMessage function (4503cd8)

@visulima/package 3.1.6 (2024-12-12)

Bug Fixes

  • allow node v23 (8ca929a)
  • allowed node 23, updated dev dependencies (f99d34e)
  • updated packem to v1.8.2 (23f869b)
  • updated packem to v1.9.2 (47bdc2d)

Styles

Miscellaneous Chores

  • package: removed old dev dependency (827e535)
  • updated dev dependencies (a916944)

Dependencies

  • @visulima/fs: upgraded to 2.3.1
  • @visulima/path: upgraded to 1.1.2

@visulima/package 3.1.5 (2024-10-25)

Dependencies

  • @visulima/fs: upgraded to 2.3.0

@visulima/package 3.1.4 (2024-10-05)

Dependencies

  • @visulima/fs: upgraded to 2.2.2
  • @visulima/path: upgraded to 1.1.1

@visulima/package 3.1.3 (2024-10-05)

Bug Fixes

  • package: fixed typing of findup fn, update dev dependencies (6f15edc)

Dependencies

  • @visulima/fs: upgraded to 2.2.1
  • @visulima/path: upgraded to 1.1.0

@visulima/package 3.1.2 (2024-09-29)

Dependencies

  • @visulima/fs: upgraded to 2.2.0

@visulima/package 3.1.1 (2024-09-24)

Bug Fixes

  • update packem to v1 (05f3bc9)
  • updated esbuild from v0.23 to v0.24 (3793010)

Miscellaneous Chores

  • updated dev dependencies (05edb67)

Dependencies

  • @visulima/fs: upgraded to 2.1.18
  • @visulima/path: upgraded to 1.0.9

@visulima/package 3.1.0 (2024-09-12)

Features

  • added new getPackageJsonProperty, hasPackageJsonProperty, hasPackageJsonAnyDependency helper function for pacakge.json (d8f5375)

Miscellaneous Chores

  • health-check: improved tests for health-check (4d24572)

@visulima/package 3.0.11 (2024-09-11)

Bug Fixes

Miscellaneous Chores

  • updated dev dependencies (28b5ee5)

Dependencies

  • @visulima/fs: upgraded to 2.1.17
  • @visulima/path: upgraded to 1.0.8

@visulima/package 3.0.10 (2024-09-07)

Bug Fixes

  • fixed broken chunk splitting from packem (1aaf277)

Dependencies

  • @visulima/fs: upgraded to 2.1.16
  • @visulima/path: upgraded to 1.0.7

@visulima/package 3.0.9 (2024-09-07)

Bug Fixes

  • added types support for node10 (604583f)

Styles

Miscellaneous Chores

  • update dev dependencies (0738f98)

Dependencies

  • @visulima/fs: upgraded to 2.1.15
  • @visulima/path: upgraded to 1.0.6

@visulima/package 3.0.8 (2024-08-30)

Miscellaneous Chores

  • updated dev dependencies (45c2a76)

Dependencies

  • @visulima/fs: upgraded to 2.1.14
  • @visulima/path: upgraded to 1.0.5

@visulima/package 3.0.7 (2024-08-08)

Miscellaneous Chores

  • updated dev dependencies (da46d8e)

Dependencies

  • @visulima/fs: upgraded to 2.1.13

@visulima/package 3.0.6 (2024-08-04)

Dependencies

  • @visulima/fs: upgraded to 2.1.12
  • @visulima/path: upgraded to 1.0.4

@visulima/package 3.0.5 (2024-08-01)

Bug Fixes

  • upgraded @visulima/packem (dc0cb57)

Styles

Miscellaneous Chores

  • added private true into fixture package.json files (4a9494c)
  • updated dev dependencies (ac67ec1)
  • updated dev dependencies and sorted the package.json (9571572)

Dependencies

  • @visulima/fs: upgraded to 2.1.11
  • @visulima/path: upgraded to 1.0.3

@visulima/package 3.0.4 (2024-07-02)

Miscellaneous Chores

  • changed typescript version back to 5.4.5 (55d28bb)

Dependencies

  • @visulima/fs: upgraded to 2.1.10

@visulima/package 3.0.3 (2024-07-02)

Dependencies

  • @visulima/fs: upgraded to 2.1.9

@visulima/package 3.0.2 (2024-07-01)

Bug Fixes

  • update dependency normalize-package-data to 6.0.2 (d70f125)

Miscellaneous Chores

  • updated dev dependencies (34df456)

@visulima/package 3.0.1 (2024-07-01)

Styles

Dependencies

  • @visulima/fs: upgraded to 2.1.8

@visulima/package 3.0.0 (2024-06-20)

⚠ BREAKING CHANGES

  • moved findCacheDirectory, findCacheDirectorySync into a new package Signed-off-by: prisis d.bannert@anolilab.de

Features

  • find-cache-dir: a new package out of package find-cache functions (b9a2728)
  • removed findCacheDirectory, findCacheDirectorySync from this package (a84fa91)

Miscellaneous Chores

  • package: added removed files back (753c10c)

@visulima/package 2.0.1 (2024-06-19)

Bug Fixes

  • package: removed TsConfigJson export (efbdf58)

Miscellaneous Chores

  • updated dev dependencies (de0f8a6)

@visulima/package 2.0.0 (2024-06-17)

⚠ BREAKING CHANGES

  • package: You can find all ts-config function inside the new @visulima/tsconfig package Signed-off-by: prisis d.bannert@anolilab.de

Features

  • package: moved all ts-config helpers into a new package (17871de)
  • tsconfig: new package for tsconfig out of @visulima/package (98f5e12)

Miscellaneous Chores

  • package: removed not used package (52b0cc2)

@visulima/package 1.10.3 (2024-06-17)

Miscellaneous Chores

  • updated dev dependencies (c889486)

Dependencies

  • @visulima/fs: upgraded to 2.1.7

@visulima/package 1.10.2 (2024-06-16)

Styles

  • fixed found code style issue with eslint and prettier (114e9c9)

Dependencies

  • @visulima/fs: upgraded to 2.1.6

@visulima/package 1.10.1 (2024-06-11)

Miscellaneous Chores

Dependencies

  • @visulima/fs: upgraded to 2.1.5

@visulima/package 1.10.0 (2024-06-11)

Features

Styles

Build System

  • fixed found audit error, updated all dev package deps, updated deps in apps and examples (4c51950)

@visulima/package 1.9.2 (2024-06-06)

Bug Fixes

Dependencies

  • @visulima/fs: upgraded to 2.1.4
  • @visulima/path: upgraded to 1.0.2

@visulima/package 1.9.1 (2024-06-05)

Miscellaneous Chores

  • updated dev dependencies (a2e0504)

Dependencies

  • @visulima/fs: upgraded to 2.1.3

@visulima/package 1.9.0 (2024-05-31)

Features

  • package: added new findMonorepoRootSync func, improved find-cache-dir, added new exports entry (15cbed5)

@visulima/package 1.8.4 (2024-05-31)

Bug Fixes

  • package: fixed finding of cache folder in a monorepo (ccec0b7)

@visulima/package 1.8.3 (2024-05-28)

Bug Fixes

  • package: exposed missing implicitBaseUrlSymbol, readTsConfig, wr… (#416) (6e3d431)

@visulima/package 1.8.2 (2024-05-24)

Bug Fixes

Miscellaneous Chores

  • changed semantic-release-npm to pnpm (b6d100a)
  • fixed wrong named folders to integration, added TEST_PROD_BUILD (1b826f5)

Dependencies

  • @visulima/fs: upgraded to 2.1.2
  • @visulima/path: upgraded to 1.0.1

@visulima/package 1.8.1 (2024-05-15)

Reverts

  • package: revert wrong bump of version (e41910f)

Dependencies

  • @visulima/fs: upgraded to 2.1.1

@visulima/package 1.7.6 (2024-05-07)

Bug Fixes

  • package: symlinks shouldn't be resolved to a real path (#394) (c504321)

@visulima/package 1.7.5 (2024-05-06)

Dependencies

  • @visulima/fs: upgraded to 2.1.0

@visulima/package 1.7.4 (2024-05-03)

Bug Fixes

  • updated type-fest to version ^4.18.1 (ab96053)

Dependencies

  • @visulima/fs: upgraded to 2.0.9

@visulima/package 1.7.3 (2024-04-27)

Bug Fixes

  • deps: updated type-fest dep (93445aa)

Dependencies

  • @visulima/fs: upgraded to 2.0.8

@visulima/package 1.7.2 (2024-04-17)

Dependencies

  • @visulima/fs: upgraded to 2.0.7

@visulima/package 1.7.1 (2024-04-09)

Dependencies

  • @visulima/fs: upgraded to 2.0.6

@visulima/package 1.7.0 (2024-04-06)

Features

  • package: added new implicitBaseUrlSymbol export (#388) (6a14166)

@visulima/package 1.6.2 (2024-04-05)

Bug Fixes

  • updated type-fest and dev deps (d7f648d)

Dependencies

  • @visulima/fs: upgraded to 2.0.5

@visulima/package 1.6.1 (2024-04-02)

Dependencies

  • @visulima/fs: upgraded to 2.0.4

@visulima/package 1.6.0 (2024-04-02)

Features

  • package: added new findPackageManagerSync and NotFoundPackageError (8648de4)

Bug Fixes

  • extended PackageNotFoundError, added missing tests (63223c2)
  • fixed broken commit (8917816)

@visulima/package 1.5.3 (2024-04-01)

Bug Fixes

  • package: added missing export (fa6a9f2)

@visulima/package 1.5.2 (2024-03-30)

Bug Fixes

  • updated dev dependencies and type-fest (1df1a35)

Dependencies

  • @visulima/fs: upgraded to 2.0.3

@visulima/package 1.5.1 (2024-03-27)

Bug Fixes

  • added missing os key to package.json (4ad1268)

Dependencies

  • @visulima/fs: upgraded to 2.0.2

@visulima/package 1.5.0 (2024-03-25)

Features

  • package: added findCacheDirectory, findCacheDirectorySync and findPackageRootSync (#366) (b96f8bf)

@visulima/package 1.4.3 (2024-03-24)

Dependencies

  • @visulima/fs: upgraded to 2.0.1

@visulima/package 1.4.2 (2024-03-23)

Bug Fixes

  • package: adjusted error message (a9a38b6)

Dependencies

  • @visulima/fs: upgraded to 2.0.0

@visulima/package 1.4.1 (2024-03-22)

Bug Fixes

  • package: updated type-fest (1c63351)

Dependencies

  • @visulima/fs: upgraded to 1.11.1

@visulima/package 1.4.0 (2024-03-22)

Features

  • switched get-tsconfig with internal code, add cache (#360) (3cdd387)

@visulima/package 1.3.5 (2024-03-20)

Dependencies

  • @visulima/fs: upgraded to 1.11.0

@visulima/package 1.3.4 (2024-03-19)

Dependencies

  • @visulima/fs: upgraded to 1.10.0

@visulima/package 1.3.3 (2024-03-19)

Dependencies

  • @visulima/fs: upgraded to 1.9.0

@visulima/package 1.3.2 (2024-03-17)

Dependencies

  • @visulima/fs: upgraded to 1.8.0

@visulima/package 1.3.1 (2024-03-16)

Dependencies

  • @visulima/fs: upgraded to 1.7.1

@visulima/package 1.3.0 (2024-03-16)

Features

Dependencies

  • @visulima/fs: upgraded to 1.7.0

@visulima/package 1.2.10 (2024-03-11)

Bug Fixes

  • package: updated get-tsconfig (d8d3169)

@visulima/package 1.2.9 (2024-03-07)

Bug Fixes

  • package: added missing PackageJson type export (06e1c50)

@visulima/package 1.2.8 (2024-03-04)

Bug Fixes

  • fixed all found type issues (eaa40d1)
  • minifyWhitespace on prod build, removed @tsconfig/* configs (410cb73)

@visulima/package 1.2.7 (2024-01-19)

Bug Fixes

  • updated all deps, updated test based on eslint errors (909f8f3)

@visulima/package 1.2.6 (2023-11-30)

Bug Fixes

@visulima/package 1.2.5 (2023-11-30)

Bug Fixes

@visulima/package 1.2.4 (2023-11-07)

Bug Fixes

  • fixed the homepage url of the package (02075ce)

@visulima/package 1.2.3 (2023-11-02)

Bug Fixes

@visulima/package 1.2.2 (2023-11-02)

Bug Fixes

@visulima/package 1.2.1 (2023-10-30)

Bug Fixes

  • update dependencies in pnpm-lock.yaml (d3a5626)

@visulima/package 1.2.0 (2023-10-24)

Features

  • extended findTSConfig with jsconfig.json search (13902fd)

Bug Fixes

@visulima/package 1.1.0 (2023-10-17)

Features

  • added new function that identify the initiating package-manager (0c89c6a)

Bug Fixes

  • removed bun from the dev deps of the package lib (95c790f)

@visulima/package 1.0.0 (2023-10-15)

Features

  • added new package with helper for package.json, monorepo and ts-config (#217) (c7946c8)