Skip to content

Commit

Permalink
docs: updated the CONTRIBUTING file; added references to benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Perrotte committed Jan 14, 2020
1 parent ef13d25 commit 1845318
Showing 1 changed file with 107 additions and 45 deletions.
152 changes: 107 additions & 45 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,142 @@
## Table of Contents

* [Introduction](#introduction)
* [Roles](#roles)
* [Community Members](#community-members)
* [Collaborators](#collaborators)
* [npm, Inc Employees](#npm-inc-employees)
* [Code Structure](#code-structure)
* [Running Tests](#running-tests)


## Introduction

Welcome to the npm CLI Contributor Guide! This document outlines the npm CLI repository's process for community interaction and contribution. This includes the issue tracker, pull requests, wiki pages, and, to a certain extent, outside communication in the context of the npm CLI. It defines roles, responsibilities, and procedures, and is an entry point for anyone wishing to contribute their time and effort to making npm a better tool for the JavaScript community!
Welcome to the npm CLI Contributor Guide! This document outlines the npm CLI repository's process for community interaction and contribution. This includes the issue tracker, pull requests, wiki pages, and, to a certain extent, outside communication in the context of the npm CLI. This is an entry point for anyone wishing to contribute their time and effort to making npm a better tool for the JavaScript community!

All interactions in the npm repository are covered by the [npm Code of Conduct](https://www.npmjs.com/policies/conduct)

## Roles

There are three main roles for people participating in the npm issue tracker. Each has a specific set of abilities and responsibilities: [Community members](#community-members), [Collaborators](#collaborators), and [npm, Inc employees](#npm-inc-employees).
## Code Structure
```
/
├── bin/
│ │ # Directory for executable files. It's very rare that you
│ │ # will need to update a file in this directory.
│ │
│ ├── npm # npm-cli entrypoint for bourne shell
│ ├── npm-cli.js # npm-cli entrypoint for node
│ ├── npm.cmd # npm-cli entrypoint for windows
│ ├── npx # npx entrypoint for bourne shell
│ ├── npx-cli.js # npx entrypoint for node
│ └── npx.cmd # npx entrypoint for windows
├── docs/ 📖
│ │ # Directory that contains the documentation website for
│ │ # the npm-cli. You can run this website locally, and have
│ │ # offline docs! 🔥📖🤓
│ │
│ ├── content/ # npm-cli entrypoint for bourne shell
│ ├── src/ # npm-cli entrypoint for node
│ └── package.json # npx entrypoint for windows
├── lib/ 📦
│ # All the Good Bits(tm) of the CLI project live here
├── node_modules/ 🔋
│ # Vendored dependencies for the CLI project (See the
│ # dependencies section below for more details).
├── scripts/ 📜
│ # We've created some helper scripts for working with the
│ # CLI project, specifically around managing our vendored
│ # dependencies, merging in pull-requests, and publishing
│ # releases.
├── test/ 🧪
│ # All the tests for the CLI live in this folder. We've
│ # got a lot of tests 🤓🧪🩺
├── CONTRIBUTING.md # This file! 🎉
└── package.json # The projects main manifest file 📃
```

Failure to comply with the expected responsibilities of each role, or violating the Code of Conduct will result in punitive action relative to the transgression, ranging from a warning to full removal from the project, at the discretion of npm employees.
## Running Tests

### Community Members
```
# Make sure you install the dependencies first before running tests.
$ npm install
This includes anyone who may show up to the npm/npm repo with issues, PRs, comments etc. They may not have any other involvement with npm.
# Run tests for the CLI (it could take awhile).
$ npm run test
```

#### Abilities
## Debugging

* Open issues and PRs
* Comment on issues and PRs
It can be tricky to track down issues in the CLI. It's a large code base that has been evolving for over a decade. There is a handy `make` command that will connect the **cloned repository** you have on your machine with the global command, so you can add `console.log` statements or debug any other way you feel most comfortable with.

#### Responsibilities
```
# Clone the repository to start with
$ git clone git@github.com:npm/cli.git
* Comment on issues when they have a reference to the answer.
* If community members aren't sure they are correct and don't have a reference to the answer, please leave the issue and try another one.
* Defer to collaborators and npm employees for answers.
* Make sure to search for [the troubleshooting posts on npm.community](https://npm.community/c/support/troubleshooting) and search on the issue tracker for similar issues before opening a new one.
* Any users with urgent support needs are welcome to email support@npmjs.com, and our dedicated support team will be happy to help.
# Change working directories into the repository
$ cd cli
PLEASE don't @ collaborators or npm employees on issues. The CLI team is small, and has many outstanding commitments to fulfill.
# Make sure you have the latest code (if that's what you're trying to debug)
$ git fetch origin latest
### Collaborators
# Connect repository to the global namespace
$ make link
These are folks who have the ability to label and close issues. The role of collaborators may expand over time, but for now it is a limited (& important) role. This is an excellent way to contribute to npm without writing code.
#################
# ALTERNATIVELY
#################
# If ou're working on a feature or bug, you can run the same command on your
# working branch and link that code.
Community members may become collaborators by showing consistent, proven track record of quality contributions to the project, a reasonable level of proficiency with the CLI, and regular participation through the tracker and other related mediums, including regular contact with the CLI team itself. This role entails a higher level of responsibility than community member, so we ask for a higher level of understanding and commitment.
# Create new branch to work from (there are many ways)
$ git checkout -b feature/awesome-feature
Collaborators who become inactive for 3 months or longer may have their collaborator privileges removed until they are ready to return.
# Connect repository to global namespace
$ make link
```

#### Abilities
## Coverage

* Label/triage new issues
* Respond to ongoing issues
* Close resolved issues.
We try and make sure that each new feature or bug fix has tests to go along with them in order to keep code coverages consistent and increasing. We are actively striving for 100% code coverage!

#### Responsibilities
```
# You can run the following command to find out coverage
$ npm run test-coverage
```

* Only answer questions when they know the answer, and provide a reference to the answer.
* If collaborators aren't totally confident about their answer, please leave the issue and try another one.
* If they've responded to an issue, it becomes their responsibility to see it to resolution.
* Defer to fellow Collaborators & npm employees for answers (Again, please don't @ collaborators or npm employees, thank you!)
* Make sure to search [the troubleshooting posts on npm.community](https://npm.community/c/support/troubleshooting) and search the rest of the forum for similar topics.
## Benchmarking

### npm, Inc Employees
We often want to know if the bug we've fixed for the feature we've added has any sort of performance impact. We've created a [benchmark suite](https://github.com/npm/benchmarks) to run against the CLI project from pull-requests. If you would like to know if there are any performance impacts to the work you're contributing, simply do the following:

Folks who work at npm, Inc, who have a responsibility to ensure the stability and functionality of the tools npm offers.
1. Make a pull-request against this repository
2. Add the following comment to the pull-request: "`test this please ✅`"

#### Abilities
This will trigger the [benmark suite](https://github.com/npm/benchmarks) to run against your pull-request, and when it's finished running it will post a comment on your pull-request just like bellow. You'll be able to see the results from the suite inline in your pull-request.

* Label/triage new issues
* Respond to ongoing issues
* Close resolved issues
* Land PRs
> You'll notice that the bot-user will also add a 🚀 reaction to your comment to
let you know that it's sent the request to start the benchmark suite.

Please note that this is a living document, and the CLI team will put up PRs to it as needed.
![image](https://user-images.githubusercontent.com/2818462/72312698-e2e57f80-3656-11ea-9fcf-4a8f6b97b0d1.png)

#### Responsibilities
If you've updated your pull-reuqest and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_.

* Preserve and promote the health of the CLI, the registry, the website, etc.
![image](https://user-images.githubusercontent.com/2818462/72313006-ec231c00-3657-11ea-9bd9-227634d67362.png)

In special cases, [Collaborators](#collaborators) may request time to speak with an npm employee directly, by contacting them and coordinating a time/place.
## Types of Contributions

### Contributing an Issue?


### Contributing a Bug Fix?


### Contributing a Feature?


## Development Dependencies


## Dependencies

The CLI project vendors it's dependencies in the `node_modules/` folder

0 comments on commit 1845318

Please sign in to comment.