npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bscotch/trebuchet

v2.9.5

Published

Tooling for minimizing the cognitive load for monorepo/workspace management, with a focus on automation, minimal configuration, and interoperability with other tools.

Downloads

109

Readme

Trebuchet

A collection of command-line (CLI) and programmatic tools for managing a Typescript monorepo.

Features

  • 🤖 Package manifests kept up to date with dependency listings based on your actual code
  • 🕸 Dependency graph computed based on your code
  • 🧪 Built-in testing via Mocha, so you don't have to provide any boilerplate
  • ✈ Automatic versioning and publishing based on the dependency graph
  • 📦 Dead-simple dependency management (versions kept in sync across all projects, and only installed to the root)
  • 🏗 Commands for creating, moving, importing, and renaming projects all while keeping imports up to date
  • ☕ Command for splitting one project into multiple projects

Installation

Local: npm i @bscotch/trebuchet

Global: npm i -g @bscotch/trebuchet

Commands

Local: npx treb --help

Global: treb --help

Initial Setup

Trebuchet assumes that your monorepo:

  • Has a root package.json file containing a workspaces field
  • Has a collection of projects matching the paths/globs in that workspaces field, each with a root package.json file

Trebuchet also assumes that each project in your monorepo:

  • Is a Typescript project (not strictly required for all functionality, but required for most)
  • Has a project-root tsconfig.json file that accurately represents how your project is compiled

Assuming all of that is true, you're already set!

Pairs Well With...

Trebuchet strives to be (relatively) unopinionated and to use patterns that are compatible with other popular tools, so that you can use its features a la carte without getting locked in.

The following is a feature-based listing of what you may want to use Trebuchet vs. other tools for:

  • Versioning: Trebuchet follows Conventional Commits-style git-log-based automatic versioning. It's default bump patterns and commit types are custom, however. Alternatives include Conventional Commits, Lerna, and ChangeSets.
  • Publishing: Trebuchet simply uses npm for publishing, coupled to the versioning process. You can set per-project publish and prepublish scripts (etc) as usual. Alternatives include Lerna and ChangeSets, though those mostly do the same thing.
  • Code Management: For bleeding-edge Typescript projects, Trebuchet provides tools to manage your code at the project-level. Other code-mod features will have to be found elsewhere, likely in one-off CLI tools. Nx is an option for advanced codemod and project templating, though it has a lot of opinions and requires a lot of boilerplate to use.
  • Changelogs: Trebuchet does not currently generate Changelogs, thought that's on the short side of the roadmap. For that use ChangeSets or Conventional Commits (or tools that use them under the hood).
  • Task Management: Trebuchet does not put any effort into task management (e.g. scheduling and caching builds), and has no intention to. Other projects like Turborepo, Nx, and Lerna already focus on this and do it reasonably well. Trebuchet is developed using Turborepo and may make some assumptions here and there that that is what you're using for task management, though it tries to be agnostic.

Examples

# List all projects
treb list

# List publishable projects
treb list --publishable

# Fix import statements to include extensions
# and to sync the package.json depenencies with
# what is actually imported by the project.
treb fix --importPaths --packageJson

# Run a project's tests
treb test

# Publish all changed projects
# (includes automatic version bump based on git commits)
treb publish