0.1.1 โ€ข Published 6 months ago

all-contributors-inferred v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Usage

Use this package's exported inferAllContributors function to infer .all-contributorsrc configuration options from package.json and README.md contents.

npm i all-contributors-inferred
import { inferAllContributors } from "all-contributors-inferred";
import fs from "node:fs/promises";

inferAllContributors({
	packageJson: JSON.parse((await fs.readFile("package.json")).toString()),
	readmeMd: (await fs.readFile("README.md")).toString(),
});
/*
[
	{
		"contributors": ...,
		"projectName": ...,
		"projectOwner": ...
	}
]
*/

Options

inferAllContributors takes in a required options object. It may have the following required properties:

  • packageJson: Data from a parsed package.json file
  • readmeMd: Text read from the README.md file

Return Type

The returned value is the same shape as you'd see in .all-contributorsrc configuration options, but with everything optional. See the exported InferredAllContributors type.

Why?

All Contributors is one of many great pieces of tooling available for repositories. Repositories that use many tools often end up with a dauntingly large number of configuration files -- over a dozen in many cases.

Many users find it exhausting and overwhelming to open a new repository with many config files. Reducing the number of config files in repositories can help make developing them more approachable.

๐Ÿ’ก Wish this was built into All Contributors? Lend a ๐Ÿ‘ to all-contributors/all-contributors#808 Make the .all-contributorsrc file optional (infer contributors from README.md)!

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! ๐Ÿ’–

Contributors

๐Ÿ’ This package was templated with create-typescript-app using the create engine.