Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aklinker1/buildc

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aklinker1/buildc

Zero config CLI tool for caching and orchestrating builds in monorepos

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-88.78%
Maintainers
0
Weekly downloads
 
Created
Source

buildc

Zero config CLI tool for caching package builds in monorepos.

pnpm i -D buildc

Then prefix any package-specific build commands you want to cache with buildc -- :

// packages/example/package.json
-"build": "unbuild",
+"build": "buildc -- unbuild",

Now when you run the build script for that package, it will only rebuild the package if a file has changed.

Additionally, if your package depends on one or more other packages in the monorepo, buildc will detect that and run those package's build scripts in the correct order!

If you need to ensure a package's dependencies are built before running a command, prefix it with buildc --deps-only --:

-"test": "vitest",
+"test": "buildc --deps-only -- vitest",
Supports:
  • PNPM workspaces
  • Bun workspaces

Note that this is a personal tool, and I only plan on supporting the tools I use. If you want to add support for NPM or Yarn, feel free to open a PR!

Config

Each package.json can have a buildc field where you can configure options. Listed below are the defaults:

{
  // ...,
  "buildc": {
    // Set to false to disable the cache-checking behavior for this package
    "cachable": true,
    // The directory where your build is output to
    "outDir": "dist",
    // List of glob patterns to include when checking if the package needs rebuilt
    "include": ["src/**/*"],
    // List of glob patterns to ignore when checking if the package needs rebuilt
    "exclude": ["**/__tests__/**", "**/*.test.*", "**/e2e/**"],
  },
}

Other Commands

buildc all

Builds all the packages in your monorepo. Can be ran from any directory inside the monorepo.

buildc graph

Prints a dependency graph showing which packages depend on others. Can be ran from any directory inside the monorepo.

Debugging

To debug, set the DEBUG environment variable to 1:

DEBUG=1 pnpm buildc -- unbuild

Why Not NX/Turborepo?

It's hard to just use the caching feature of NX/Turborepo without completely migrating to the tools, and using them instead of pnpm/bun, which more developers are familiar with. I found that since build-caching was really the only feature I used from those packages, it wasn't worth migrating to.

Instead, this tools is a simpler version that doesn't add another CLI people have to memorize to use. Well, technically it does, but at the same time, it doesn't get in your way, and I bet people wouldn't even realize it was being called most the time. Which is the goal.

Keywords

FAQs

Package last updated on 20 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc