find-lerna-packages
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

find-lerna-packages

version version

An utility module to help find lerna packages in lerna project programmatically, asynchronously or synchronously.

Usage

Install via yarn:

yarn add find-lerna-package

Install via npm:

npm install find-lerna-packages

Then in your source codes:

const findLernaPackages = require('find-lerna-packages');

// asynchronous: return a promise resolved with `LernaPackage` array
findLernaPackages(process.cwd()).then((pkgList) => {
  pkgList.forEach(pkg => {
    console.log(pkg.name, pkg.location);
  });
});

// synchronous: return `LernaPackage` array
findLernaPackages.sync(process.cwd()).map(pkg => {
  console.log(pkg.name, pkg.location);
});

// asynchronous: get `LernaPackage` directly by name
findLernaPackages.get('foo').then(pkg => {
  console.log(pkg.name, pkg.location);
});

// synchronous: get `LernaPackage` directly by name
const pkg = findLernaPackages.getSync('foo');
console.log(pkg.name, pkg.location);

// synchronous: get root `LernaPackage` directly
const root = findLernaPackages.getRoot();
console.log(pkg.name, pkg.location);

About LernaPackage

LernaPackage is actually the class describing lerna sub packages from @lerna/package, which is used by lerna cli internally. This utility module provides a simple type definition of it for friendly usage.

You can read package properties directly, such as name,location, private,rootPath, etc.

LICENSE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i find-lerna-packages

Weekly Downloads

5

Version

1.3.0

License

MIT

Unpacked Size

9.62 kB

Total Files

7

Last publish

Collaborators

  • aprilandjan