DEV Community

Ramu Narasinga
Ramu Narasinga

Posted on • Edited on • Originally published at thinkthroo.com

@manypkg/get-packages usage in Changesets

In this article, we analyse @manypkg/get-packages and its usage in Changesets source code.

@manypkg/get-packages

@manypkg/get-packages is open-source utility written by Thinkmill. It is a

simple utility to get the packages from a monorepo, whether they’re using Yarn, Bolt, Lerna, pnpm or Rush.

This library exports getPackages and getPackagesSync. It is intended mostly for use of developers building tools that want to support different kinds of monorepos as an easy way to write tools without having to write

tool-specific code. It supports Yarn, Bolt, Lerna, pnpm, Rush and single-package repos(where the only package is the the same as the root package). This library uses @manypkg/find-root to search up from the directory

that’s passed to getPackages or getPackagesSync to find the project root.

@manypkg/get-packages usage in Changesets

Since Changesets is a monorepo, it has a package named should-skip-package. In this package, you will find an import from @manypkg/get-packages as shown below.

Image description

But this only imports type — Package

There is another example found in [CLI package]

(https://github.com/changesets/changesets/blob/main/packages/cli/src/run.ts#L40).

const packages = await getPackages(cwd);
Enter fullscreen mode Exit fullscreen mode

Image description

About me:

Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.

I am open to work on an interesting project. Send me an email at ramu.narasinga@gmail.com

My Github - https://github.com/ramu-narasinga
My website - https://ramunarasinga.com
My Youtube channel - https://www.youtube.com/@thinkthroo
Learning platform - https://thinkthroo.com
Codebase Architecture - https://app.thinkthroo.com/architecture
Best practices - https://app.thinkthroo.com/best-practices
Production-grade projects - https://app.thinkthroo.com/production-grade-projects

References:

  1. https://www.npmjs.com/package/@manypkg/get-packages

  2. https://github.com/changesets/changesets/blob/main/packages/cli/src/run.ts#L5C10-L5C28

  3. https://github.com/changesets/changesets/blob/main/packages/should-skip-package/src/index.ts#L4

  4. https://github.com/changesets/changesets/blob/main/packages/cli/src/run.ts#L156

  5. https://github.com/changesets/changesets/blob/main/packages/cli/src/run.ts#L168

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more