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 🙏

© 2025 – Pkg Stats / Ryan Hefner

git-historical-blame

v0.0.1

Published

original problem: have a big PR in a huge, multi-team repo. unclear who to ask for review.

Readme

git-historical-blame

original problem: have a big PR in a huge, multi-team repo. unclear who to ask for review.

solution: find which devs have worked with the files that we modified in the PR, aggregate by their teams, and kindly ask for reviews.

current implementation & it's flaws

for every single file that has been modified since <committish>, will go thru the full history of the file (commits), will collect info (additions, deletions, author), will aggregate them and, if extra info is provided, will provide people-based and team-based statistics of the ownership of the files.

the heuristics could be improved a ton -- currently there's a lot of overlapping ownership since every commit etc., but for starters, this will do.

dependencies

  • git
  • node.js, tested with v12
    • yarn

setup

git clone https://github.com/kiprasmel/git-historical-blame.git
# or:    git clone [email protected]:kiprasmel/git-historical-blame.git

cd git-historical-blame/

yarn

usage

# pre-process the git history.
# note - matters in which committish the repo is checked out
./git-historical-blame.ts <../path/to/repo> \
                          <committish-of-file-modification-begin=origin/master> \
                          "" \
                          <files,to,ignore>

# re-group from file-by-file to author-by-author
./group.ts

basics done, some .json{.csv} files will be generated. now, to enhance the data with team members, provide a json file with an array of teammate objects:

[
  {
    "fullname": "Kipras Melnikovas",
    "email": "[email protected]",
    "team": "Sigma"
  }
]

sidenote: see below [1] for quick scripts to transform your data if you have it in a different format &/ multiple files.

note: obviously, best results will be achieved if the teammates' emails & names match with those they provided in their ~/.gitconfig. see findMatchingTeam in teamify.ts. currently, there's no logic for duplicate merging, or even more advanced things like Levenshtein/edit distance to compare the names/email addresses, but those can be added in the future / by yourself.

once ready, use the data like so (depends on previous scripts above):

./teamify <../path/to/teams.json>

this will produce multiple files:

  • teamified.json{.csv} - same as grouped.json above, but adds the team to a person when it matches
  • by-team.json{.csv} - same as previous, but also grouped by the team
  • team-stats.json{.csv} - aggregate statistics per team.

the 2 (3) most interesting files will be team-stats.csv, and by-team.json.csv (by-team.json for exact details).

[1] example of quick scripts for combining the data from multiple files & transforming into wanted form:

combine.js:

#!/usr/bin/env node

const fs = require("fs")

function combine({
	filepaths,
	combined,
}) {
	let jsons = []
	for (const f of filepaths) {
		const json = JSON.parse(fs.readFileSync(f, { encoding: "utf-8" }))
		jsons.push(json)
	}

	jsons = jsons.flat()
	fs.writeFileSync(combined, JSON.stringify(jsons, null, 2), { encoding: "utf-8" })
}

if (!module.parent) {
	process.argv.splice(0, 2)
	const filepaths = (process.argv[0] || "").split(",")
	const combined = (process.argv[1] || "combined.json")

	combine({
		filepaths,
		combined
	})
}

teamify-prep.js:

#!/usr/bin/env node

const fs = require("fs")

function teamifyPrep() {
	const json = JSON.parse(fs.readFileSync("combined.json", { encoding: "utf-8" }))

	const newJson = json.map(t => ({
			fullname: t.full_name,
			email: t.email,
			team: t.tribe_name,
		})
	)

	fs.writeFileSync("teams.json", JSON.stringify(newJson, null, 2), { encoding: "utf-8" })
}

if (!module.parent) {
	teamifyPrep()
}