Skip to content

Commit 4558275

Browse files
authored
docs: update contributing guidelines with example script (#98)
1 parent 3254f8d commit 4558275

File tree

6 files changed

+297
-42
lines changed

6 files changed

+297
-42
lines changed

CONTRIBUTING.md

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,107 @@
1-
# How to contribute
1+
# Contributing Guide
22

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

5-
```bash
6-
npm install
7-
```
7+
## Prerequisites
88

9-
## Codestyle
9+
Before contributing, ensure that you have the following:
1010

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

13-
## Unit tests
15+
## Getting Started
1416

15-
Run the unittest using the below command:
17+
To set up the project on your local machine, follow these steps:
1618

17-
```bash
18-
npm test
19-
```
19+
1. **Fork** the repository on GitHub.
20+
2. **Clone** the forked repository to your local machine:
2021

21-
## Before submitting
22+
```bash
23+
git clone https://github.com/<your-username>/node-nepali-datetime.git
24+
cd node-nepali-datetime
25+
```
2226

23-
Before submitting your Pull Request, please do the following steps:
27+
3. **Install dependencies**:
2428

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

31-
## Other help
33+
4. **Verify your setup**:
3234

33-
You can contribute by spreading a word about this library.
34-
It would also be a huge contribution to write
35-
a short article on how you are using this project.
36-
You can also share your best practices with us.
35+
- Run the example script to test the library:
36+
37+
```bash
38+
npm run example
39+
```
40+
41+
Modify the [example.ts](./example.ts) file to experiment with your example code.
42+
43+
- Run lint checks:
44+
45+
```bash
46+
npm run lint
47+
```
48+
49+
- Run tests to ensure everything works:
50+
51+
```bash
52+
npm run test
53+
```
54+
55+
5. **Start contributing** by making the necessary changes to the codebase.
56+
57+
## Code Style
58+
59+
- A **Prettier** configuration file ([`.prettierrc`](./.prettierrc)) is provided to maintain a consistent coding style.
60+
- Pre-commit hooks will automatically format your code before committing. Ensure that your code passes lint checks.
61+
62+
## Pull Requests
63+
64+
We welcome and appreciate pull requests from the community. To contribute:
65+
66+
1. **Fork** the repository and create a new branch based on the `main` branch:
67+
68+
```bash
69+
git checkout -b <your-branch-name>
70+
```
71+
72+
2. **Write tests** for your changes if applicable.
73+
3. **Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)** for commit messages.
74+
Examples:
75+
76+
- `feat: add JSON parser`
77+
- `fix(parser): resolve parsing issue`
78+
79+
4. **Push** your branch to your forked repository:
80+
81+
```bash
82+
git push origin <your-branch-name>
83+
```
84+
85+
5. **Create a Pull Request**:
86+
87+
- Open a pull request from your branch to the `main` branch of the original repository.
88+
- Provide a clear and concise description of the changes, along with relevant context.
89+
90+
6. **Review & Feedback**:
91+
92+
- Participate in the code review process and address any feedback promptly.
93+
94+
## License
95+
96+
By contributing to this project, you agree that your contributions will be licensed under the **GPL-3.0 License**.
97+
Refer to the [LICENSE](./LICENSE) file for more details.
98+
99+
## Other Ways to Contribute
100+
101+
Even if you don’t contribute code, you can still help:
102+
103+
- **Spread the word** about this library.
104+
- Write a blog or article about how you use this project.
105+
- Share your best practices, examples, or ideas with us.
106+
107+
Thank you for contributing to **node-nepali-datetime**! 🎉

example.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import NepaliDate from './src/NepaliDate'
2+
3+
console.log('node-nepali-datetime')
4+
5+
// Now
6+
const now = new NepaliDate()
7+
console.log('Now:', now.toString())
8+
9+
// Try your example codes here

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ module.exports = {
55
'^.+\\.ts?$': 'ts-jest',
66
},
77
transformIgnorePatterns: ['<rootDir>/node_modules/'],
8-
testPathIgnorePatterns: ['.eslintrc.js'],
8+
testPathIgnorePatterns: [],
99
}

0 commit comments

Comments
 (0)