Skip to content

Commit

Permalink
docs: update contributing guidelines with example script (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
aj3sh authored Dec 20, 2024
1 parent 3254f8d commit 4558275
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 42 deletions.
119 changes: 95 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,107 @@
# How to contribute
# Contributing Guide

## Install dependencies
Thank you for your interest in contributing to the **node-nepali-datetime** project!
Your contributions will help improve and enhance this library.
Please take a moment to review the following guidelines before getting started.

```bash
npm install
```
## Prerequisites

## Codestyle
Before contributing, ensure that you have the following:

A [.prettierrc](./.prettierrc) file is available to maintain the coding style. Besides, your code will automatically be formatted by the pre-commit hook.
- **Node.js v18 or higher** installed. Download it from the [official Node.js website](https://nodejs.org/)
or use `nvm` to manage multiple Node.js versions.
- **npm** installed (comes with Node.js).

## Unit tests
## Getting Started

Run the unittest using the below command:
To set up the project on your local machine, follow these steps:

```bash
npm test
```
1. **Fork** the repository on GitHub.
2. **Clone** the forked repository to your local machine:

## Before submitting
```bash
git clone https://github.com/<your-username>/node-nepali-datetime.git
cd node-nepali-datetime
```

Before submitting your Pull Request, please do the following steps:
3. **Install dependencies**:

1. Add any changes you want.
1. Add tests for the new changes.
1. Edit documentation (`README.md`) if you have changed something significant.
1. Commit your changes using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
Examples: `feat: add JSON parser`, `feat(parser): add JSON parser`.
```bash
npm install
```

## Other help
4. **Verify your setup**:

You can contribute by spreading a word about this library.
It would also be a huge contribution to write
a short article on how you are using this project.
You can also share your best practices with us.
- Run the example script to test the library:

```bash
npm run example
```

Modify the [example.ts](./example.ts) file to experiment with your example code.

- Run lint checks:

```bash
npm run lint
```

- Run tests to ensure everything works:

```bash
npm run test
```

5. **Start contributing** by making the necessary changes to the codebase.

## Code Style

- A **Prettier** configuration file ([`.prettierrc`](./.prettierrc)) is provided to maintain a consistent coding style.
- Pre-commit hooks will automatically format your code before committing. Ensure that your code passes lint checks.

## Pull Requests

We welcome and appreciate pull requests from the community. To contribute:

1. **Fork** the repository and create a new branch based on the `main` branch:

```bash
git checkout -b <your-branch-name>
```

2. **Write tests** for your changes if applicable.
3. **Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)** for commit messages.
Examples:

- `feat: add JSON parser`
- `fix(parser): resolve parsing issue`

4. **Push** your branch to your forked repository:

```bash
git push origin <your-branch-name>
```

5. **Create a Pull Request**:

- Open a pull request from your branch to the `main` branch of the original repository.
- Provide a clear and concise description of the changes, along with relevant context.

6. **Review & Feedback**:

- Participate in the code review process and address any feedback promptly.

## License

By contributing to this project, you agree that your contributions will be licensed under the **GPL-3.0 License**.
Refer to the [LICENSE](./LICENSE) file for more details.

## Other Ways to Contribute

Even if you don’t contribute code, you can still help:

- **Spread the word** about this library.
- Write a blog or article about how you use this project.
- Share your best practices, examples, or ideas with us.

Thank you for contributing to **node-nepali-datetime**! 🎉
9 changes: 9 additions & 0 deletions example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import NepaliDate from './src/NepaliDate'

console.log('node-nepali-datetime')

// Now
const now = new NepaliDate()
console.log('Now:', now.toString())

// Try your example codes here
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = {
'^.+\\.ts?$': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/'],
testPathIgnorePatterns: ['.eslintrc.js'],
testPathIgnorePatterns: [],
}
Loading

0 comments on commit 4558275

Please sign in to comment.