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

driftless-yarn

v1.2.1

Published

A simple tool to consume a project's yarn.lock and ensure certain dependencies are singular.

Downloads

8

Readme

driftless-yarn

A simple tool to consume a project's yarn.lock and ensure certain dependencies are singular.

Sample usage (more to come)

yarn add -D driftless-yarn
node ./node_modules/driftless-yarn/src/index.js -p https://github.com/eldavojohn/driftless-yarn/blob/main/public/failingList.txt

This will use the project's yarn.lock file and compare it against failingList from this repo.

There are some basic ouputs provided by this very project on itself. The public directory provides example lists that you can see here:

Failing with the yarn why flag turned on:

$ tsc && ts-node --project tsconfig.json src/index.ts -p public/failingList.txt -w
Package chalk has library entries for chalk@^2.0.0 and chalk@^4.0.0:
[1/4] Why do we have the module "chalk"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "chalk"
info Reasons this module exists
   - Hoisted from "eslint#chalk"
   - Hoisted from "jest#@jest#core#chalk"
   - Hoisted from "jest#jest-cli#chalk"
   - Hoisted from "@types#jest#jest-diff#chalk"
   - Hoisted from "ts-jest#jest-util#chalk"
   - Hoisted from "jest#@jest#core#@jest#console#chalk"
   - Hoisted from "jest#@jest#core#@jest#reporters#chalk"
   - Hoisted from "jest#@jest#core#@jest#transform#chalk"
   - Hoisted from "jest#@jest#core#@jest#types#chalk"
   - Hoisted from "jest#@jest#core#jest-config#chalk"
   - Hoisted from "jest#@jest#core#jest-message-util#chalk"
   - Hoisted from "jest#@jest#core#jest-resolve#chalk"
   - Hoisted from "jest#@jest#core#jest-runner#chalk"
   - Hoisted from "jest#@jest#core#jest-runtime#chalk"
   - Hoisted from "jest#@jest#core#jest-snapshot#chalk"
   - Hoisted from "jest#@jest#core#jest-validate#chalk"
   - Hoisted from "jest#@jest#core#jest-watcher#chalk"
   - Hoisted from "jest#@jest#core#jest-config#babel-jest#chalk"
   - Hoisted from "jest#@jest#core#jest-config#jest-circus#chalk"
   - Hoisted from "jest#@jest#core#jest-config#jest-jasmine2#chalk"
   - Hoisted from "jest#@jest#core#jest-snapshot#jest-matcher-utils#chalk"
   - Hoisted from "jest#@jest#core#jest-config#jest-circus#jest-each#chalk"
info Disk size without dependencies: "56KB"
info Disk size with unique dependencies: "108KB"
info Disk size with transitive dependencies: "192KB"
info Number of shared dependencies: 5
=> Found "tslint#[email protected]"
info This module exists because "tslint" depends on it.
info Disk size without dependencies: "44KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "200KB"
info Number of shared dependencies: 6
=> Found "@babel/highlight#[email protected]"
info This module exists because "tslint#@babel#code-frame#@babel#highlight" depends on it.
info Disk size without dependencies: "44KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "200KB"
info Number of shared dependencies: 6

error Command failed with exit code 1.

Failing with the verbose flag turned on:

Note: this is identical to the prior output since a failure shows up in both verbose and why.

Pass with the verbose flag turned on:

$ tsc && ts-node --project tsconfig.json src/index.ts -p public/passingList.txt -v
Report for each package and the number of entries it had in the yarn file:
@cspotcode/source-map-consumer: 1 entries
something-not-present: 0 entries
json5: 1 entries
lodash.memoize: 1 entries
Done in 6.45s.

Pass with the yarn why flag turned on:

This produces no output other than a success code since there was no package to run yarn why on.

Enforcing a Number of Versions Present

Inside the configuration file, numbers will enforce that the yarn.lock file has that many versions of that dependency. For example source-map 3 will enforce that there are three and exactly three versions of source-map in the project.

Matching by Major or Minor patch in semantic versioning:

Instead of numbers (note that combination is not supported) is the ability to use 'M' or 'm' at the end of a package declaration to designate that only the Major version to match (for example cssom '3.2.1', cssom '3.3.3' and cssom '3.9.0' will all match as allowed with line "cssom M"). Additionally a lower case 'm' will allow matches of minor releases (cssom '3.5.0', cssom '3.5.1' & cssom '3.5.5' will all match but cssom '3.6.0' will not).