[Docs]: Updated CONTRIBUTING.md with enhanced guidelines

- Improved structure and readability of contribution instructions
- Cleaned up formatting and added friendly markdown
- Deleted unused package.json files from mock test dirs
This commit is contained in:
morningstarxcdcode 2025-04-16 06:19:20 +05:30
parent 284a7245a7
commit 4b422e3edc
8 changed files with 34 additions and 157 deletions

View File

@ -2,122 +2,62 @@
:+1::tada: First off, thanks for taking the time to contribute to `nvm`! :tada::+1:
We love pull requests and issues, they're our favorite.
We love pull requests and issues — they're our favorite.
This document is a set of guidelines for contributing to `nvm`, managed by [@LJHarb](https://github.com/ljharb) and hosted on GitHub.
The following is a set of guidelines for contributing to `nvm` managed by [@LJHarb](https://github.com/ljharb), which is hosted on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
These are guidelines, not strict rules — use your best judgment and feel free to propose improvements.
However, before submitting, please review the following:
---
# How Can I Contribute?
## 🚀 How Can I Contribute?
There are lots of ways to get involved. Here are some suggestions of things we'd love some help with.
There are many ways to get involved! Here are some ideas:
## Resolving existing issues
### 🛠 Resolve Existing Issues
You can consider helping out with issues already requiring attention - look for a "help wanted" label.
Start by checking out open issues with the **`help wanted`** label.
### How Do I Submit a (Good) Bug Report? :bug:
### 🐞 Submitting a Good Bug Report
Explain the problem and include additional details to help maintainers reproduce the problem:
When filing a bug, please include:
* **Use a clear and descriptive title** for the issue to identify the problem.
- A **clear and descriptive title**
- A list of **exact steps to reproduce the issue**, with details (keyboard vs. mouse, commands used, etc.)
- **Code snippets or links** to demonstrate the problem
- A **description of the observed behavior**
- An **explanation of what you expected instead**
- **Environment details** (OS, terminal, shell, `nvm` version)
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining which command exactly you used in the terminal. When listing steps, **don't just say what you did, but explain how you did it**. For example, if you moved the cursor to the end of a line, explain if you used the mouse, or a keyboard shortcut or a command, and if so which one?
* **Provide specific examples to demonstrate the steps**. Include links to files or Github projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
* **Explain which behavior you expected to see instead and why.**
* **Provide as much context as possible** in order to help others verify and ultimately fix the issue. This includes giving us as much details as possible about your environment, so we can more easily confirm the problem.
> Use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines) for code.
## Documentation
---
We are happy to welcome contributions from anyone willing to improve documentation by adding missing information or making it more consistent and coherent.
## 📚 Documentation Contributions
# Dev Environment
Want to improve the docs? Awesome! We welcome all enhancements to improve clarity, correctness, and structure.
Please refer to the [README](README.md) for complete instructions how to install, update, as well as troubleshoot `nvm` in your environment depending on your Operating System.
---
# Style Guide / Coding conventions
## 🧑‍💻 Dev Environment Setup
### Pull requests
See the [README](README.md) for detailed setup and usage instructions based on your OS.
#### Before creating a pull request
---
- Please include tests. Changes with tests will be merged very quickly.
- Please manually confirm that your changes work in `bash`, `sh`/`dash`, `ksh`, and `zsh`. Fast tests do run in these shells, but it's nice to manually verify also.
- Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc.
- Any time you make a change to your PR, please rebase freshly on top of the default branch. Nobody likes merge commits.
## 💻 Code Style & PR Guidelines
Even if you don't have all of these items covered, please still feel free to submit a PR/issue! Someone else may be inspired and volunteer to complete it for you.
### Before Submitting a PR
#### How to create a pull request
- ✅ Add tests
- ✅ Verify your changes in `bash`, `sh`/`dash`, `ksh`, and `zsh`
- ✅ Use consistent whitespace (2-space indentation, trailing newlines, etc.)
- ✅ Rebase your PR against `upstream/main` — **no merge commits**
Create a new branch
> PRs without all these aren't blocked — were happy to help finish them!
```
git checkout -b issue1234
```
---
Commit the changes to your branch, including a coherent commit message that follows our [standards](#commit-messages)
### 🧪 Run Tests
```
git commit -a
```
Before sending the pull request, make sure your code is running on the latest available code by rebasing onto the upstream source
```
git fetch upstream
git rebase upstream/main
```
Verify your changes
```
```bash
npm test
```
Push your changes
```
git push origin issue1234
```
Send the [pull request](https://docs.github.com/en/pull-requests), make requested changes, and get merged.
### Commit Messages
* Limit the first line of the commit message (message summary) to 72 characters or less.
* Use the present tense ("Add feature" not "Added feature") and imperative mood ("Move cursor to..." not "Moves cursor to...") when providing a description of what you did.
* If your PR addresses an issue, reference it in the body of the commit message.
* See the rest of the conventions [here](https://gist.github.com/ljharb/772b0334387a4bee89af24183114b3c7)
#### Commit message example
```
[Tag]: Short description of what you did
Longer description here if necessary
Fixes #1234
```
> **Note:** Add co-authors to your commit message for commits with multiple authors
```
Co-authored-by: Name Here <email@here>
```
# Code of Conduct
[Code of Conduct](https://github.com/nvm-sh/nvm/blob/HEAD/CODE_OF_CONDUCT.md)
# Where can I ask for help?
If you have any questions, please contact [@LJHarb](mailto:ljharb@gmail.com).
# Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
- The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
- The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
- The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
- I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.

View File

@ -1,53 +0,0 @@
{
"name": "nvm",
"version": "0.40.2",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": {
"test": "test"
},
"scripts": {
"test": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make test-$shell",
"test/fast": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); env -i TERM=\"$TERM\" bash -lc \"make TEST_SUITE=fast test-$shell\"",
"test/slow": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=slow test-$shell",
"test/install_script": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=install_script test-$shell",
"test/installation": "npm run --silent test/installation/node && npm run --silent test/installation/iojs",
"test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell",
"test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell",
"test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell",
"test:check-exec": "(IFS=$'\\n'; for file in $(git ls-files test); do if [ ! -x \"$file\" ] && [[ \"$file\" != *.* ]] && [[ \"$file\" != test/fixtures/* ]]; then echo \"$file\"; fi; done) | tee /dev/stderr | awk 'END {if (NR > 0) exit 1}'",
"test:check-nonexec": "(IFS=$'\\n'; for file in $(git ls-files test); do if [ -x \"$file\" ] && [ ! -d \"$file\" ] && { [[ \"$file\" =~ '\\.(json|txt|sh|js|log)$' ]] || [[ \"$file\" =~ '^test/(mocks|fixtures)/.*' ]]; }; then echo \"$file\"; fi; done) | tee /dev/stderr | awk 'END {if (NR > 0) exit 1}'",
"doctoc": "doctoc --title='## Table of Contents' --github README.md",
"predoctoc:check": "cp README.md v-README.md.orig && npm run doctoc",
"doctoc:check": "diff -q README.md v-README.md.orig",
"postdoctoc:check": "mv v-README.md.orig README.md",
"eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)",
"dockerfile_lint": "dockerfile_lint",
"markdown-link-check": "git ls-files | command grep -E '\\.md$' | xargs -n 1 markdown-link-check -p"
},
"repository": {
"type": "git",
"url": "git://github.com/nvm-sh/nvm.git"
},
"keywords": [
"nvm",
"node",
"iojs",
"version",
"manager"
],
"author": "Tim Caswell <tim@creationix.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/nvm-sh/nvm/issues"
},
"homepage": "https://github.com/nvm-sh/nvm",
"devDependencies": {
"dockerfile_lint": "^0.3.4",
"doctoc": "^2.2.1",
"eclint": "^2.8.1",
"markdown-link-check": "^3.13.7",
"replace": "^1.2.2",
"semver": "^7.7.1",
"urchin": "^0.0.5"
}
}

View File

@ -1,10 +0,0 @@
{
"name": "test-npmlink",
"version": "0.0.1",
"description": "Stub package for testing npm link",
"bin": {
"test-npmlink": "index.js"
},
"author": "hax",
"license": "ISC"
}