1.7.1 • Published 30 days ago

@visulima/package v1.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

@visulima/fs, jsonc-parser, normalize-package-data, pathe, resolve-pkg-maps 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

findTsConfig

Retrieves the TsConfig by searching for the "tsconfig.json" file from a given current working directory.

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

const tsconfig = await findTsConfig(); // => { path: "/Users/../Projects/visulima/packages/package/tsconfig.json", config: { compilerOptions: { ... } } }

writeTsConfig

Writes the provided TypeScript configuration object to a tsconfig.json file.

import { writeTsConfig } from '@visulima/package';
// or import { writeTsConfig } from '@visulima/package/tsconfig';

writeTsConfig({ compilerOptions: { ... } }/* ,{ cwd: "./" }*/);

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

1.7.1

30 days ago

1.7.0

1 month ago

1.6.2

1 month ago

1.5.3

1 month ago

1.6.1

1 month ago

1.6.0

1 month ago

1.5.2

1 month ago

1.5.1

1 month ago

1.5.0

1 month ago

1.4.3

2 months ago

1.4.2

2 months ago

1.4.1

2 months ago

1.4.0

2 months ago

1.3.5

2 months ago

1.3.4

2 months ago

1.3.3

2 months ago

1.3.2

2 months ago

1.3.1

2 months ago

1.3.0

2 months ago

1.2.10

2 months ago

1.2.9

2 months ago

1.2.8

2 months ago

1.2.7

4 months ago

1.2.6

5 months ago

1.2.5

5 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago