Git Product home page Git Product logo

get-monorepo-packages's Introduction

get-monorepo-packages

Travis Prettier npm semantic-release License

Get a list of packages from a monorepo. Supports:

Install

npm install --save get-monorepo-packages

Usage

import getPackages from 'get-monorepo-packages';
getPackages('/path/to/root');

Returns an array of objects containing:

  • location - The relative path to the package.
  • package - The package.json file for the package.

get-monorepo-packages's People

Contributors

azu avatar azz avatar kwelch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

get-monorepo-packages's Issues

rush support?

Can we add support for reading from rush.json? I'm happy to submit a PR if it'd be likely to merge.

Latest lerna v7 does not use useWorkspaces flag

I noticed the eslint-plugin-import started failing after I upgraded to lerna 7 which removes the useWorkspaces flag

This package I think detects the useWorkspaces flag to find packages though

I can keep the useWorkspaces flag in my lerna.json but note that lerna has a "lerna.json fixer script" that removes this flag

Remove globby as dependency

I don't think it is needed, at all. Also, it's slow no matter it uses fast-glob under the hood.

I recently needed and implemented such thing. I remove the /* from given workspaces, then just readdir.

pkg.workspaces
    .map((x) => x.slice(0, -2))
    .filter(Boolean)
    .reduce((acc, ws) => {
      const workspace = path.join(cwd, ws);
      const packages = fs
        .readdirSync(workspace)
        .map((dir) => {
          const pkgDir = path.join(workspace, dir);
          const pkgJsonPath = path.join(pkgDir, 'package.json');

          return { pkgDir, pkgJsonPath };
        })
        .map(({ pkgDir, pkgJsonPath }) => {
          // eslint-disable-next-line global-require, import/no-dynamic-require
          const pkgJson = require(pkgJsonPath);
          return { pkgDir, pkgJson };
        });

      return acc.concat(packages);
    }, [])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.