Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Run lint-staged to process only changed JS files
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"**/*.{js,jsx,ts,tsx,json,md}": ["prettier --write"],
"**/*.js": ["jest --findRelatedTests --passWithNoTests"]
}
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to MongoDB OpenAPI Project

## Development Setup

### Prerequisites

- Node.js v20 or later
- npm v8 or later
- Git

### Installation

1. Clone the repository:
```bash
git clone https://github.com/your-username/mongodb-openapi.git
cd mongodb-openapi
```

2. Install dependencies:
```bash
npm install
```

3. Set up Git hooks (optional):
```bash
npm run precommit
```

This will install Husky, which manages Git hooks for the project. The hooks ensure code quality by automatically running various checks before commits.

## Development Workflow

### Git Hooks

This project uses the following Git hooks:

- **pre-commit**: Automatically formats your code using Prettier and runs tests for staged JavaScript files to ensure code quality before each commit.

### Available Scripts

- `npm run format` - Format all files with Prettier
- `npm run format-check` - Check formatting without modifying files
- `npm run lint-js` - Lint JavaScript files
- `npm run test` - Run all tests

#### IPA specific targets

- `npm run gen-ipa-docs` - Generate IPA ruleset documentation (see `./tools` folder for more information)
- `npm run ipa-validation` - Run OpenAPI validation with Spectral
Loading
Loading