Thanks for your interest in contributing to zarr-gl! Contributions are welcome in the form of bug reports, feature requests, and pull requests.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/zarr-gl.git - Install dependencies:
npm install - Create a branch:
git checkout -b your-feature-name
npm run dev- Build in watch mode for developmentnpm run build- Create production buildnpm run serve- Serve the dist folder on http://localhost:8888 with CORS enablednpm run lint- Check for linting errorsnpm run fmt- Format code with Prettiernpm run check- Type-check without emitting filesnpm run all- Run formatting, linting, and type-checking
-
Development mode (
npm run dev):- Unminified code
- Source maps enabled for debugging
- Larger bundle size
- Recommended for local development
-
Production mode (
npm run build):- Minified code
- No source maps
- Smaller bundle size
- Used for PR previews and releases
The included demo application is already configured to use your local zarr-gl build via "zarr-gl": "file:../" in its package.json.
Run both in separate terminal windows:
Terminal 1 - Library (with hot reload):
npm run devTerminal 2 - Demo App:
cd demo
npm run devNow when you edit files in src/, webpack will automatically rebuild and the demo will pick up changes.
If you prefer to build manually:
# Build library in development mode (includes source maps)
npx webpack --mode development
# Or build for production (no source maps)
npm run build
# Then run demo
cd demo
npm run devTo use your local zarr-gl build in any project:
-
In your project's
package.json, add:{ "dependencies": { "zarr-gl": "file:../path/to/zarr-gl" } } -
Run
npm installin your project -
The project will use your local build from
dist/zarr-gl.js
Alternatively, you can use npm link:
-
In the zarr-gl root directory:
npm link
-
In your test project directory:
npm link zarr-gl
-
Start your project and it will use your local build
For quick testing without modifying dependencies, you can serve the built library and load it directly:
-
Build the library:
npm run build
-
Serve the dist folder:
npm run serve
-
In your test project's HTML, load the library from the local server:
<script src="http://localhost:8888/zarr-gl.js"></script>
This approach is useful for quick testing or when working with projects that load the library via a script tag.
Development builds include source maps, so you can:
- Set breakpoints in the original TypeScript source
- See proper stack traces
- Inspect unminified code
Make sure to use development mode when debugging:
npm run devBefore opening a pull request, run the checks to ensure your code passes all linting, formatting, and type-checking requirements:
npm run allThis will run formatting, linting, and type-checking. Fix any issues before committing.
When you open a pull request, a preview build is automatically created and deployed. A GitHub action will provide the link and code snippet to use in a comment on the PR.