This document provides technical guidance for developers who want to contribute code to pkgdex. It complements the ../CONTRIBUTING.md file by focusing specifically on the technical aspects of development.
Before you begin, please review the ../CONTRIBUTING.md file to understand the overall contribution guidelines and our code of conduct.
- Development environment
- Building and Testing
- Contribution Workflow
- Coding Standards
- Documentation
- License Compliance
- Go 1.24 or above
- Node/NPM
- make
- scdoc
-
Fork the repository on GitHub.
-
Clone your fork locally:
git clone 'https://github.com/YOUR-USERNAME/pkgdex.git'
cd 'pkgdex'
- Create a development configuration file:
mkdir -p '.dev'
cp 'config/dev-config.example.json' '.dev/config.json'
-
Edit the
.dev/config.json
file to set appropriate development values. You'll want to edit the following fields:server.pid
database.path
database.indexPath
You may also want to edit the following fields:
service.homepage
service.baseURL
server.address
Since pkgdex requires TLS, you'll need to generate a self-signed certificate for local development:
openssl req -x509 -newkey rsa:4096 -keyout '.dev/pkgdex-tlskey' -out '.dev/pkgdex-tlscertificate' -days 365 -nodes -subj '/CN=localhost'
To build the project locally, run:
npm install
make
This will compile the binary to build/pkgdexctl
.
For development, it's best to use the development
target with your
development configuration in .dev
:
make development
By default, this will start the service on https://localhost:8080
, but
you can change this in the .dev/config.json
file by modifying the
server.address
field. You'll need to accept the self-signed
certificate warning.
Note
If you modify the server address, you may also want to modify the
service.homepage
and service.baseURL
fields.
To run the test suite:
make test
For test output with coverage information:
make test/coverage
As said before, review the ../CONTRIBUTING.md file to understand the overall contribution guidelines and our code of conduct.
-
Ensure there's an issue for your work:
- Check existing issues first.
- If none exists, create one clearly describing the bug or feature.
-
Create a new branch for your work in your fork:
git checkout -b 'feature/your-feature-name'
# or
git checkout -b 'fix/issue-description'
-
Make your changes, following the coding standards.
-
Write tests for your changes.
-
Update documentation if necessary.
-
Update the
Unreleased
section of the ../CHANGELOG.md file.
- Push your branch to your fork:
git push origin 'feature/your-feature-name'
-
Create a pull request against the
trunk
branch of the main repository. -
In your PR description:
- Clearly describe the changes.
- Reference the issue it resolves.
- Note any breaking changes or migration steps.
-
Wait for code review feedback and address any comments.
We like to follow both the Uber and Google Go coding standards, with a preference for the Uber one when they conflict with each other, and we expect your contribution to do the same.
As mentioned in the ../CONTRIBUTING.md file, avoid adding new dependencies unless absolutely necessary.
If you need to add a new dependency:
- Ensure it's well-maintained and widely used.
- Check its license for compatibility.
- Update the ../LICENSE-3rdparty.csv file.
- Run
make tidy
to update thego.mod
andgo.sum
files.
- Add godoc comments to all types, functions, and methods, including non-exported ones.
- Comments should explain the why behind the code, not just the what.
- Put the most important information first in the comment. Aim to make the first sentence a clear, concise summary. Focus on the intent and purpose of each part of the code.
- Use complete sentences, proper capitalization and punctuation in comments.
Project documentation is stored in the docs/
directory:
hosting.md
: Instructions for deploying the service.config.md
: Configuration reference.using.md
: Usage instructions.development.md
: Development instructions.
When updating features or APIs, make corresponding updates to the
documentation. If adding new configuration options, update config.md
accordingly.
Remember that all code must comply with the REUSE specification. The default license is EUPL-1.2.
Ensure each new file needs the appropriate license header. You can use
the reuse
tool to help with this:
pipx install reuse
make lint/licenses
Thank you for contributing to pkgdex! Your efforts help make this project better for everyone.