Contributing to @capgo/capacitor-light-sensor
January 4, 2026 · View on GitHub
Thank you for your interest in contributing to this Capacitor plugin!
Development Setup
-
Clone the repository
-
Install dependencies:
bun install -
Install SwiftLint for iOS linting (macOS only):
brew install swiftlint
Available Scripts
| Script | Description |
|---|---|
npm run build | Build the plugin (TypeScript + Rollup) |
npm run watch | Watch mode for TypeScript |
npm run lint | Fix all linting issues (ESLint, Prettier, SwiftLint) |
npm run lint:check | Check for linting issues without fixing |
npm run fmt | Format all code |
npm run verify | Verify all platforms build correctly |
npm run verify:ios | Verify iOS builds |
npm run verify:android | Verify Android builds |
npm run verify:web | Verify web/TypeScript builds |
npm run docgen | Generate API documentation |
Project Structure
capacitor-light-sensor/
├── src/ # TypeScript source
│ ├── definitions.ts # Plugin interface & types
│ ├── index.ts # Plugin registration
│ └── web.ts # Web implementation (stub)
├── ios/ # iOS implementation
│ └── Sources/CapgoLightSensorPlugin/
│ └── CapgoLightSensorPlugin.swift
├── android/ # Android implementation
│ └── src/main/java/app/capgo/capacitor/lightsensor/
│ └── CapgoLightSensorPlugin.kt
├── example-app/ # Example Capacitor app
├── dist/ # Build output (generated)
└── .github/ # GitHub workflows & templates
Making Changes
TypeScript Changes
- Edit files in
src/ - Run
npm run buildto compile - Run
npm run lintto fix formatting
Android Changes
- Edit Kotlin files in
android/src/main/java/ - Run
npm run verify:androidto verify the build
iOS Changes
- Edit Swift files in
ios/Sources/ - Run
npm run swiftlint -- --fixto format - Run
npm run verify:iosto verify the build
Documentation Changes
- Update JSDoc comments in
src/definitions.ts - Run
npm run docgento regenerate README API docs
Testing
Example App
The example-app/ directory contains a test application:
cd example-app
bun install
bun run build
npx cap add android
npx cap sync
npx cap open android
Run on a physical Android device to test the light sensor.
Pull Request Guidelines
- Create a feature branch from
main - Make your changes
- Run
npm run lintto ensure code style - Run
npm run verifyto ensure all platforms build - Submit a PR with a clear description
Code Style
- TypeScript: ESLint with
@ionic/eslint-config - Prettier:
@ionic/prettier-config - Swift: SwiftLint with
@ionic/swiftlint-config - Kotlin: Standard Android/Kotlin style
Publishing
Publishing is handled automatically by GitHub Actions when version tags are pushed:
- Merge changes to
main - The
bump_versionworkflow automatically:- Runs tests
- Updates documentation
- Bumps the version
- Creates a git tag
- The
buildworkflow then:- Builds the package
- Publishes to npm
- Creates a GitHub release
Questions?
Open an issue if you have questions or need help!