|
| 1 | +# **node-addon-api** Contribution Philosophy |
| 2 | + |
| 3 | +The **node-addon-api** team loves contributions. There are many ways in which you can |
| 4 | +contribute to **node-addon-api**: |
| 5 | +- Source code fixes |
| 6 | +- Additional tests |
| 7 | +- Documentation improvements |
| 8 | +- Joining the N-API working group and participating in meetings |
| 9 | + |
| 10 | +## Source changes |
| 11 | + |
| 12 | +**node-addon-api** is meant to be a thin convenience wrapper around N-API. With this |
| 13 | +in mind, contributions of any new APIs that wrap around a core N-API API will |
| 14 | +be considered for merge. However, changes that wrap existing **node-addon-api** |
| 15 | +APIs are encouraged to instead be provided as an ecosystem module. The |
| 16 | +**node-addon-api** team is happy to link to a curated set of modules that build on |
| 17 | +top of **node-addon-api** if they have broad usefulness to the community and promote |
| 18 | +a recommended idiom or pattern. |
| 19 | + |
| 20 | +### Rationale |
| 21 | + |
| 22 | +The N-API team considered a couple different approaches with regards to changes |
| 23 | +extending **node-addon-api** |
| 24 | +- Larger core module - Incorporate these helpers and patterns into **node-addon-api** |
| 25 | +- Extras package - Create a new package (strawman name '**node-addon-api**-extras') |
| 26 | +that contain utility classes and methods that help promote good patterns and |
| 27 | +idioms while writing native addons with **node-addon-api**. |
| 28 | +- Ecosystem - Encourage creation of a module ecosystem around **node-addon-api** |
| 29 | +where folks can build on top of it. |
| 30 | + |
| 31 | +#### Larger Core |
| 32 | +This is probably our simplest option in terms of immediate action needed. It |
| 33 | +would involve landing any open PRs against **node-addon-api**, and continuing to |
| 34 | +encourage folks to make PRs for utility helpers against the same repository. |
| 35 | + |
| 36 | +The downside of the approach is the following: |
| 37 | +- Less coherency for our API set |
| 38 | +- More maintenance burden on the N-API WG core team. |
| 39 | + |
| 40 | +#### Extras Package |
| 41 | +This involves us spinning up a new package which contains the utility classes |
| 42 | +and methods. This has the benefit of having a separate module where helpers |
| 43 | +which make it easier to implement certain patterns and idioms for native addons |
| 44 | +easier. |
| 45 | + |
| 46 | +The downside of this approach is the following: |
| 47 | +- Potential for confusion - we'll need to provide clear documentation to help the |
| 48 | +community understand where a particular contribution should be directed to (what |
| 49 | +belongs in **node-addon-api** vs **node-addon-api-extras**) |
| 50 | +- Need to define the level of support/API guarantees |
| 51 | +- Unclear if the maintenance burden on the N-API WG is reduced or not |
| 52 | + |
| 53 | +#### Ecosystem |
| 54 | +This doesn't require a ton of up-front work from the N-API WG. Instead of |
| 55 | +accepting utility PRs into **node-addon-api** or creating and maintaining a new |
| 56 | +module, the WG will encourage the creation of an ecosystem of modules that |
| 57 | +build on top of **node-addon-api**, and provide some level of advertising for these |
| 58 | +modules (listing them out on the repository/wiki, using them in workshops/tutorials |
| 59 | +etc). |
| 60 | + |
| 61 | +The downside of this approach is the following: |
| 62 | +- Potential for lack of visibility - evangelism and education is hard, and module |
| 63 | +authors might not find right patterns and instead implement things themselves |
| 64 | +- There might be greater friction for the N-API WG in evolving APIs since the |
| 65 | +ecosystem would have taken dependencies on the API shape of **node-addon-api** |
| 66 | + |
0 commit comments