|
| 1 | +# Publishing to Zigistry |
| 2 | + |
| 3 | +This document describes the setup for publishing the ServiceStack Zig library to Zigistry. |
| 4 | + |
| 5 | +## Package Structure |
| 6 | + |
| 7 | +The package is structured according to Zigistry requirements: |
| 8 | + |
| 9 | +### Required Files |
| 10 | + |
| 11 | +1. **build.zig.zon** - Package metadata file |
| 12 | + - Package name: `servicestack` |
| 13 | + - Version: `0.1.0` |
| 14 | + - Description: ServiceStack HTTP Client Library for Zig |
| 15 | + - Minimum Zig version: `0.13.0` |
| 16 | + - License: MIT |
| 17 | + - Paths: Specifies which files are included in the package |
| 18 | + |
| 19 | +2. **build.zig** - Build configuration |
| 20 | + - Defines the `servicestack` module |
| 21 | + - Sets up tests with `zig build test` |
| 22 | + - Provides example builds with `zig build example` and `zig build advanced` |
| 23 | + - Uses standard Zig build system conventions |
| 24 | + |
| 25 | +3. **src/lib.zig** - Main library file |
| 26 | + - Exports the public API |
| 27 | + - Includes documentation comments |
| 28 | + - Contains unit tests |
| 29 | + |
| 30 | +4. **LICENSE** - MIT License file |
| 31 | + |
| 32 | +5. **README.md** - Package documentation |
| 33 | + - Installation instructions |
| 34 | + - Usage examples |
| 35 | + - API reference |
| 36 | + |
| 37 | +### Additional Files |
| 38 | + |
| 39 | +- **CONTRIBUTING.md** - Contributor guidelines |
| 40 | +- **examples/** - Example code demonstrating usage |
| 41 | + - `basic.zig` - Simple examples |
| 42 | + - `advanced.zig` - Comprehensive usage |
| 43 | +- **.github/workflows/ci.yml** - GitHub Actions CI/CD |
| 44 | + |
| 45 | +## How to Publish |
| 46 | + |
| 47 | +### Step 1: Prepare Release |
| 48 | + |
| 49 | +1. Update version in `build.zig.zon` |
| 50 | +2. Update README.md with any changes |
| 51 | +3. Ensure all tests pass: `zig build test` |
| 52 | +4. Commit all changes |
| 53 | + |
| 54 | +### Step 2: Create Git Tag |
| 55 | + |
| 56 | +```bash |
| 57 | +git tag v0.1.0 |
| 58 | +git push origin v0.1.0 |
| 59 | +``` |
| 60 | + |
| 61 | +### Step 3: Submit to Zigistry |
| 62 | + |
| 63 | +Follow the Zigistry submission process: |
| 64 | + |
| 65 | +1. Visit [zigistry.dev](https://zigistry.dev) (when available) |
| 66 | +2. Submit the package with the GitHub repository URL |
| 67 | +3. The package manager will use the git tag to fetch the code |
| 68 | +4. Zigistry will calculate the hash for the tarball |
| 69 | + |
| 70 | +### Step 4: Using the Package |
| 71 | + |
| 72 | +Once published, users can add it to their projects: |
| 73 | + |
| 74 | +```zig |
| 75 | +// build.zig.zon |
| 76 | +.{ |
| 77 | + .name = "my-project", |
| 78 | + .version = "0.1.0", |
| 79 | + .dependencies = .{ |
| 80 | + .servicestack = .{ |
| 81 | + .url = "https://github.com/ServiceStack/servicestack-zig/archive/v0.1.0.tar.gz", |
| 82 | + .hash = "1220...", // Hash provided by Zigistry |
| 83 | + }, |
| 84 | + }, |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +## Package Features |
| 89 | + |
| 90 | +### HTTP Client |
| 91 | + |
| 92 | +The package provides a complete HTTP client for ServiceStack services: |
| 93 | + |
| 94 | +- **GET** requests |
| 95 | +- **POST** requests with JSON body |
| 96 | +- **PUT** requests with JSON body |
| 97 | +- **DELETE** requests |
| 98 | +- Automatic JSON content-type headers |
| 99 | +- Error handling |
| 100 | +- Memory management with allocators |
| 101 | + |
| 102 | +### Testing |
| 103 | + |
| 104 | +Run tests with: |
| 105 | +```bash |
| 106 | +zig build test |
| 107 | +``` |
| 108 | + |
| 109 | +Tests include: |
| 110 | +- Client initialization |
| 111 | +- URL construction |
| 112 | +- Basic functionality tests |
| 113 | + |
| 114 | +### Examples |
| 115 | + |
| 116 | +Two examples are provided: |
| 117 | + |
| 118 | +1. **Basic Example** (`zig build example`) |
| 119 | + - Simple GET and POST requests |
| 120 | + - Basic error handling |
| 121 | + |
| 122 | +2. **Advanced Example** (`zig build advanced`) |
| 123 | + - All HTTP methods |
| 124 | + - Comprehensive error handling |
| 125 | + - JSON data examples |
| 126 | + |
| 127 | +## Continuous Integration |
| 128 | + |
| 129 | +GitHub Actions CI is configured to: |
| 130 | +- Test on multiple Zig versions (0.13.0, 0.14.0) |
| 131 | +- Run all tests |
| 132 | +- Build all examples |
| 133 | +- Check code formatting |
| 134 | + |
| 135 | +## Versioning |
| 136 | + |
| 137 | +The package follows Semantic Versioning: |
| 138 | +- MAJOR version for incompatible API changes |
| 139 | +- MINOR version for backwards-compatible functionality |
| 140 | +- PATCH version for backwards-compatible bug fixes |
| 141 | + |
| 142 | +Current version: **0.1.0** (Initial release) |
| 143 | + |
| 144 | +## Support |
| 145 | + |
| 146 | +For issues or questions: |
| 147 | +- Open an issue on GitHub |
| 148 | +- See CONTRIBUTING.md for contribution guidelines |
| 149 | + |
| 150 | +## License |
| 151 | + |
| 152 | +This package is released under the MIT License. See LICENSE file for details. |
0 commit comments