Development Guide
This guide is for developers working on the phenopackets-js library itself or those who need a deeper understanding of its setup.
Prerequisites
Before you begin development, ensure you have:
- Node.js (LTS versions recommended)
 - npm or yarn
 - Protocol Buffer Compiler (
protoc) - Git
 
Repository Setup
- Clone the repository:
 
git clone https://github.com/berntpopp/phenopackets-js.git
cd phenopackets-js
- Install dependencies:
 
npm install
- Download proto files:
 
# On Windows
scripts\download-protos.bat
# On Linux/macOS
bash ./scripts/download-protos.sh
Building the Library
After making changes or updating proto files:
- Generate JavaScript code from protos:
 
npm run generate-protos
- Run tests:
 
npm test
Code Style and Linting
The project uses ESLint and Prettier for code formatting:
- Format code: 
npm run format - Check formatting: 
npm run format:check - Lint code: 
npm run lint - Fix lint issues: 
npm run lint:fix 
Testing
Run the test suite:
npm test
Or in watch mode during development:
npm run test:watch
Documentation
Documentation Generation
The documentation is automatically generated and deployed using GitHub Actions when changes are pushed to the main branch. The process includes:
- Building JSDoc API documentation from source code
 - Deploying to GitHub Pages
 - Updating the documentation site
 
For local development, you can generate the documentation using:
npm run docs:generate-api
Automated Workflows
The project uses GitHub Actions for automation:
- Documentation: Automatically builds and deploys documentation on changes to 
mainbranch - Release: Uses semantic-release for automated versioning and publishing
 - CI: Runs tests and quality checks on pull requests
 
Workflow files are located in .github/workflows/:
docs.yml: Documentation generation and deploymentrelease.yml: Package versioning and publishingci.yml: Continuous integration checks
Release Process
The project uses semantic-release for versioning and publishing:
- Commits must follow the Conventional Commits specification
 - CI/CD will automatically: 
- Run tests
 - Generate documentation
 - Create a release
 - Publish to npm
 
 
Project Structure
phenopackets-js/
├── lib/              # Generated JavaScript code
├── protos/           # Protocol Buffer definitions (downloaded)
├── scripts/          # Build and utility scripts
├── src/              # Source code
├── tests/            # Test files
└── docs/             # Documentation
For more detailed information about specific aspects of development, see: