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

@wayfair/one-version

v0.5.0

Published

Opinionated Monorepo Dependency Management CLI

Downloads

7,054

Readme

Release license: MIT Contributor Covenant Maintainer

One Version to bring them all, and in the darkness bind them.1

🚨 Enforcement: Require all workspaces in a monorepo to conform to the One-Version rule.

📦 Supports multiple package managers: Support for yarn classic, yarn berry, and pnpm workspaces.

💥 Coordinated upgrades: Coming Soon!


Table Of Contents

One-Version Rule

This package implements a version of Google's One-Version Rule:

For every dependency in [a] repository, there must be only one version of that dependency to choose.2

Please refer to the implementation notes for our specific evaluation criteria.

There is some overlap between this tool and experimental yarn constraints, without requiring use of a particular package manager.

Getting Started

Install @wayfair/one-version at the workspace root using yarn:

yarn add --dev -w @wayfair/one-version

Or pnpm:

pnpm add -save-dev -w @wayfair/one-version

Add the following section to your package.json:

{
  "scripts": {
    "one-version:check": "one-version check"
  }
}

Run yarn one-version:check or pnpm run one-version:check.

If the repo is compliant, the tool will print this message:

✨ One Version Rule Success - found no version conflicts!

If the repo is not compliant, you will see a version of this message:

🚫 One Version Rule Failure - found multiple versions of the following dependencies:

prettier
  2.1.2
    dev: @wayfair/app-a, @wayfair/app-b
  ^2.3.2
    dev: @wayfair/app-c
  2.2.1
    dev: @wayfair/lib-a

Configuration

The behavior of @wayfair/one-version can be configured by a one-version.config.json at the root of the repository.

Supported Options

overrides (optional, object)

Overrides lets workspaces opt out of the one-version rule. This may be useful while performing major upgrades.

Examples

{
  "overrides": {
    "dependency": {
      "versionSpecifier": ["workspaceA", "workspaceB"]
    }
  }
}

For example, the below config will allow app-A and lib-L to specify react@^16.9, even if the rest of the repo specifies react@^17.

{
  "overrides": {
    "react": {
      "^16.9": ["app-A", "lib-L"]
    }
  }
}

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated 💜. For contributing guidelines, please see CONTRIBUTING.md

License

Distributed under the MIT License. See LICENSE for more information.


1: J.R.R. Tolkien, 1954. Mostly.

2: Software Engineering At Google - Winters, Manshreck and Wright, 2020, p. 341