Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate to typescript, undici, and improve contributing #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

24 changes: 15 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ name: build

on:
push:
schedule:
- cron: '15 2,10,18 * * *'
branches:
- main
pull_request:

jobs:
test:
name: Build with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, latest]
node-version: [20, 22, latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -23,11 +24,16 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true

- name: Linting
run: pnpm eslint

- name: Run tests
run: npm test
- name: Type-checking
run: pnpm typecheck

- name: Run linter
run: npm run eslint
- name: Tests
run: pnpm test
29 changes: 16 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: build
name: publish

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
name: Publish @questdb/nodejs-questdb-client to npm
test:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -18,16 +16,21 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: latest
node-version: 22

- name: Install dependencies
run: npm ci
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true

- name: Linting
run: pnpm eslint

- name: Run tests
run: npm test
- name: Type-checking
run: pnpm typecheck

- name: Run linter
run: npm run eslint
- name: Tests
run: pnpm test

- name: Publish
uses: JS-DevTools/npm-publish@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ coverage
.idea
*.iml
.DS_Store
certs
dist
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
97 changes: 97 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Contributing to nodejs-questdb-client

Thank you for your interest in contributing to nodejs-questdb-client! This document provides guidelines and instructions for contributing to the project.

## Development Setup

1. Fork and clone the repository:
```bash
git clone https://github.com/YOUR_USERNAME/nodejs-questdb-client.git
cd nodejs-questdb-client
```

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


## Running Tests

The project uses Vitest for testing. Tests are located in the `test` directory.

1. Run tests in watch mode during development:
```bash
pnpm run test
```

### Test Requirements

- Some tests use mock servers and certificates located in the `test/certs` directory

> You can generate the certificates by running the `generateCerts.sh` script in the `scripts` directory. The script requires two arguments: the output directory and the password for the certificates.
`./scripts/generateCerts.sh . questdbPwd123`


## Code Style and Quality

1. The project uses TypeScript. Make sure your code is properly typed.

2. Format your code using Prettier

3. Lint your code:
```bash
pnpm run lint
```

4. Fix linting issues:
```bash
pnpm run lint --fix
```

## Making Changes

1. Create a new branch for your changes:
```bash
git checkout -b feature/your-feature-name
```

2. Make your changes and commit them with clear, descriptive commit messages:
```bash
git add .
git commit -m "feat: add new feature"
```

We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.

3. Push your changes to your fork:
```bash
git push origin feature/your-feature-name
```

4. Create a Pull Request from your fork to the main repository.

## Pull Request Guidelines

1. Make sure all tests pass
2. Update documentation if needed
3. Add tests for new features
4. Keep PRs focused - one feature or bug fix per PR
5. Link any related issues in the PR description

## Documentation

- Update the README.md if you're adding new features or changing existing ones
- Add JSDoc comments for new public APIs
- Include examples in the documentation when appropriate

## Need Help?

If you have questions or need help, you can:
- Open an issue with your question
- Join our community discussions (if available)

## License

By contributing to nodejs-questdb-client, you agree that your contributions will be licensed under the project's license.

Loading