all-contributors / all-contributors/cli

Node API?

Đang mở
#362 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
type: enhancement
Ngôn ngữ chính
JavaScript
Star
425
Fork
149
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Is your feature request related to a problem? Please describe.**

I've started running `npx all-contributors add` as part of scripts in a few places that automate contributor attribution (https://github.com/JoshuaKGoldberg/all-contributors-auto-action, https://github.com/JoshuaKGoldberg/template-typescript-node-package/pull/639). Right now those tools generally use https://github.com/sindresorhus/execa to run the CLI as part of Node scripts. That works, but has a couple of drawbacks:

* Performance: although the overhead of running scripts is a little slow, each script can only add one contributor at a time (https://allcontributors.org/docs/en/cli/usage). It'd be nice to be able to provide an object with multiple contributors, each matched to an array of contribution types.
* Type safety: CLI usage is all string concatenation. It'd be nice to have `.d.ts`-described types.

**Describe the solution you'd like**

Could there be a Node package that exports an async function or two? Vaguely...

```js
import { addContributor, addContributors } from "all-contributors";

await addContributor("MyName", ["bug", "tool"]);

await addContributors({
MyName: ["bug", "tool"],
OtherName: ["design"],
});
```

**Describe alternatives you've considered**

🤷 Can't think of anything else.

**Additional context**

Reusing the `all-contributors` package name feels like a good idea.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.