@biomejs/version-utils
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Version utils

This library provides helper functions to detect the version of Biome from the dependencies of a given project.

[!WARNING] This is an internal library, and semver is not guaranteed to be followed, so depend on it at your own risk.

Installation

npm install @biomejs/version-utils

Usage

Detecting from dependencies

To detect the version of Biome from the dependencies of a given project, use the detectFromDependencies helper function. This function will look for the version of Biome in the dependencies of the lockfile for the project, and fall back to the package.json file if no lockfile is found, or if it cannot be read.

import { detectFromDependencies } from '@biomejs/version-utils';

const version = detectFromDependencies('/path/to/project');

[!TIP] The lockfiles of the following package managers are supported:

  • npm (package-lock.json)
  • pnpm (pnpm-lock.yaml)
  • yarn (yarn.lock)

Bun's lockfile is binary and cannot be easily read, so we fall back to the package.json file for Bun projects.

License

Copyright © 2024, Nicolas Hedger. Released under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @biomejs/version-utils

Weekly Downloads

18

Version

0.2.0

License

MIT

Unpacked Size

38.4 kB

Total Files

9

Last publish

Collaborators

  • nhedger
  • dominionl
  • ematipico
  • conaclos