Infers All Contributors settings from an existing README.md table and package.json. π
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": ...
}
]
*/
inferAllContributors
takes in a required options object.
It may have the following required properties:
packageJson
: Data from a parsedpackage.json
filereadmeMd
: Text read from theREADME.md
file
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.
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)!
See .github/CONTRIBUTING.md
, then .github/DEVELOPMENT.md
.
Thanks! π
Josh Goldberg π π» π§ π π§ π π |
π This package was templated with
create-typescript-app
using thecreate
engine.