Skip to content

Commit 67e49bc

Browse files
author
Rohaan Hamid
committed
Add publishing configurations for multiple package managers
- Add Homebrew formula for macOS/Linux - Add Chocolatey package for Windows - Add Scoop manifest for Windows - Add Snapcraft configuration for Linux - Update package.json with npm publishing metadata - Include comprehensive README with publishing instructions
1 parent 0bed602 commit 67e49bc

9 files changed

Lines changed: 430 additions & 1 deletion

File tree

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
22
"name": "document-stitcher",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "Stitch together Markdown, images, and PDFs into a single printable PDF",
5+
"bin": {
6+
"document-stitcher": "./bin/document-stitcher"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/yourusername/document-stitcher-cli.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/yourusername/document-stitcher-cli/issues"
14+
},
15+
"homepage": "https://github.com/yourusername/document-stitcher-cli#readme",
516
"scripts": {
617
"start": "bun run src/index.ts",
718
"prepare": "husky install",

publishing/README.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# Publishing Configuration Files
2+
3+
This directory contains all the configuration files needed to publish Document Stitcher to various package managers across Windows, macOS, and Linux.
4+
5+
## Directory Structure
6+
7+
```
8+
publishing/
9+
├── brew/ # Homebrew (macOS/Linux)
10+
│ └── document-stitcher.rb
11+
├── chocolatey/ # Chocolatey (Windows)
12+
│ ├── document-stitcher.nuspec
13+
│ └── tools/
14+
│ ├── chocolateyinstall.ps1
15+
│ ├── chocolateyuninstall.ps1
16+
│ └── VERIFICATION.txt
17+
├── scoop/ # Scoop (Windows)
18+
│ └── document-stitcher.json
19+
└── snap/ # Snapcraft (Linux)
20+
└── snapcraft.yaml
21+
```
22+
23+
## Quick Start
24+
25+
1. **Replace `yourusername`** with your actual GitHub username in all files
26+
2. **Create GitHub releases** with the automated workflow (`.github/workflows/release.yml`)
27+
3. **Update checksums** after each release
28+
4. **Follow platform-specific instructions** below
29+
30+
## Publishing Instructions
31+
32+
### Prerequisites
33+
34+
- **GitHub Repository**: Project hosted on GitHub
35+
- **GitHub Releases**: Automated binary builds via GitHub Actions
36+
- **Replace placeholders**: Update `yourusername` with your actual GitHub username
37+
- **Test builds**: Ensure binaries work on target platforms
38+
39+
### Homebrew (macOS/Linux)
40+
41+
**For macOS and Linux users**
42+
43+
1. **Create a Homebrew tap**:
44+
```bash
45+
# Create a new repository: yourusername/homebrew-tap
46+
# Or use existing tap
47+
```
48+
49+
2. **Add the formula**:
50+
```bash
51+
# Copy brew/document-stitcher.rb to your tap
52+
cp publishing/brew/document-stitcher.rb ~/path/to/your/homebrew-tap/Formula/
53+
```
54+
55+
3. **Update checksums**:
56+
- After creating a GitHub release, update the SHA256 hashes in the formula
57+
- Use `shasum -a 256 downloaded-binary` to calculate checksums
58+
59+
4. **Test locally**:
60+
```bash
61+
brew install --build-from-source yourusername/tap/document-stitcher
62+
```
63+
64+
5. **Publish**: Push changes to your tap repository
65+
66+
**Users install with**:
67+
```bash
68+
brew install yourusername/tap/document-stitcher
69+
```
70+
71+
### Chocolatey (Windows)
72+
73+
**For Windows users via Chocolatey package manager**
74+
75+
1. **Create Chocolatey account**: https://chocolatey.org/account/Register
76+
77+
2. **Update package files**:
78+
- Edit `chocolatey/tools/chocolateyinstall.ps1` with correct URLs and checksums
79+
- Update version in `chocolatey/document-stitcher.nuspec`
80+
81+
3. **Test locally**:
82+
```powershell
83+
choco pack chocolatey/document-stitcher.nuspec
84+
choco install document-stitcher -s .
85+
```
86+
87+
4. **Submit to Chocolatey**:
88+
```powershell
89+
choco push document-stitcher.1.0.0.nupkg --source https://push.chocolatey.org/
90+
```
91+
92+
**Users install with**:
93+
```powershell
94+
choco install document-stitcher
95+
```
96+
97+
### Scoop (Windows)
98+
99+
**For Windows users via Scoop package manager**
100+
101+
1. **Fork the main bucket**: https://github.com/ScoopInstaller/Main
102+
103+
2. **Add manifest**:
104+
- Copy `scoop/document-stitcher.json` to your fork
105+
- Update URL and hash for the Windows binary
106+
107+
3. **Test locally**:
108+
```powershell
109+
scoop install document-stitcher.json
110+
```
111+
112+
4. **Submit PR**: Create a pull request to the main Scoop repository
113+
114+
**Users install with**:
115+
```powershell
116+
scoop install document-stitcher
117+
```
118+
119+
### Snapcraft (Linux)
120+
121+
**For Linux users via Ubuntu Software Center and other snap-supporting systems**
122+
123+
1. **Install Snapcraft**:
124+
```bash
125+
sudo snap install snapcraft --classic
126+
```
127+
128+
2. **Setup for publishing**:
129+
```bash
130+
snapcraft login
131+
snapcraft register document-stitcher # if not already registered
132+
```
133+
134+
3. **Build and publish**:
135+
```bash
136+
cp publishing/snap/snapcraft.yaml .
137+
snapcraft # builds the snap
138+
snapcraft upload --release=stable document-stitcher_1.0.0_amd64.snap
139+
```
140+
141+
**Users install with**:
142+
```bash
143+
sudo snap install document-stitcher
144+
```
145+
146+
### npm (Cross-platform)
147+
148+
**For developers and cross-platform users**
149+
150+
1. **Update package.json**:
151+
- Ensure `bin` field points to `./bin/document-stitcher`
152+
- Add repository, bugs, and homepage fields
153+
154+
2. **Publish to npm**:
155+
```bash
156+
npm login
157+
npm publish
158+
```
159+
160+
**Users install with**:
161+
```bash
162+
npm install -g document-stitcher
163+
```
164+
165+
## Version Updates
166+
167+
When releasing a new version:
168+
169+
1. **Update version numbers** in all configuration files
170+
2. **Create GitHub release** (triggers automated builds)
171+
3. **Update checksums** with new binary hashes
172+
4. **Update URLs** to point to new release assets
173+
5. **Test installations** on each platform
174+
6. **Submit updates** to package managers
175+
176+
## Automation
177+
178+
The GitHub Actions workflow (`.github/workflows/release.yml`) automatically:
179+
- Builds binaries for Windows, macOS (Intel/Apple Silicon), and Linux
180+
- Creates GitHub releases with all platform binaries
181+
- Calculates checksums for verification
182+
183+
## Troubleshooting
184+
185+
### Common Issues
186+
187+
- **Checksum mismatches**: Recalculate after each release
188+
- **Permission errors**: Ensure proper file permissions on binaries
189+
- **Path issues**: Use absolute paths in package configurations
190+
- **Architecture mismatches**: Ensure correct binary for target platform
191+
192+
### Testing
193+
194+
Test installations on clean environments:
195+
- **Windows**: Use Windows Sandbox or Virtual Machine
196+
- **macOS**: Use GitHub Codespaces or clean VM
197+
- **Linux**: Use Docker containers for different distributions
198+
199+
## Support
200+
201+
- **GitHub Issues**: Report bugs and request features
202+
- **Package Manager Docs**: Check official documentation for each platform
203+
- **Community**: Join discussions in respective package manager communities
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
class DocumentStitcher < Formula
2+
desc "Stitch together Markdown, images, and PDFs into a single printable PDF"
3+
homepage "https://github.com/yourusername/document-stitcher-cli"
4+
license "ISC"
5+
version "1.0.0"
6+
7+
on_macos do
8+
if Hardware::CPU.arm?
9+
url "https://github.com/yourusername/document-stitcher-cli/releases/download/v#{version}/document-stitcher-macos-arm64"
10+
sha256 "" # Will be calculated from the release binary
11+
else
12+
url "https://github.com/yourusername/document-stitcher-cli/releases/download/v#{version}/document-stitcher-macos-x64"
13+
sha256 "" # Will be calculated from the release binary
14+
end
15+
end
16+
17+
on_linux do
18+
if Hardware::CPU.arm?
19+
url "https://github.com/yourusername/document-stitcher-cli/releases/download/v#{version}/document-stitcher-linux-arm64"
20+
sha256 "" # Will be calculated from the release binary
21+
else
22+
url "https://github.com/yourusername/document-stitcher-cli/releases/download/v#{version}/document-stitcher-linux-x64"
23+
sha256 "" # Will be calculated from the release binary
24+
end
25+
end
26+
27+
def install
28+
bin.install (OS.mac? ? "document-stitcher-macos-#{Hardware::CPU.arm? ? "arm64" : "x64"}" : "document-stitcher-linux-#{Hardware::CPU.arm? ? "arm64" : "x64"}") => "document-stitcher"
29+
end
30+
31+
test do
32+
# Test that the binary runs
33+
assert_match "Usage:", shell_output("#{bin}/document-stitcher --help")
34+
end
35+
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>document-stitcher</id>
5+
<version>1.0.0</version>
6+
<packageSourceUrl>https://github.com/yourusername/document-stitcher-cli</packageSourceUrl>
7+
<owners>yourusername</owners>
8+
<title>Document Stitcher</title>
9+
<authors>Your Name</authors>
10+
<projectUrl>https://github.com/yourusername/document-stitcher-cli</projectUrl>
11+
<iconUrl>https://raw.githubusercontent.com/yourusername/document-stitcher-cli/main/icon.png</iconUrl>
12+
<licenseUrl>https://github.com/yourusername/document-stitcher-cli/blob/main/LICENSE</licenseUrl>
13+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
14+
<projectSourceUrl>https://github.com/yourusername/document-stitcher-cli</projectSourceUrl>
15+
<docsUrl>https://github.com/yourusername/document-stitcher-cli#readme</docsUrl>
16+
<bugTrackerUrl>https://github.com/yourusername/document-stitcher-cli/issues</bugTrackerUrl>
17+
<tags>cli document pdf markdown stitcher converter</tags>
18+
<summary>Stitch together Markdown, images, and PDFs into a single printable PDF</summary>
19+
<description>
20+
# Document Stitcher
21+
22+
Stitch together Markdown, images, and PDFs into a single printable PDF suitable for submissions, reports, and archives.
23+
24+
## Features
25+
26+
- Convert Markdown to PDF with LaTeX math support
27+
- Embed images with custom sizing
28+
- Include and merge external PDF files
29+
- Select or skip specific pages from embedded PDFs
30+
- Custom theming with CSS
31+
- Manual page breaks
32+
- MathJax rendering for mathematical expressions
33+
34+
## Usage
35+
36+
```
37+
document-stitcher input.md output.pdf
38+
document-stitcher input.md output.pdf --theme custom-theme.css
39+
```
40+
41+
See the [GitHub repository](https://github.com/yourusername/document-stitcher-cli) for more information.
42+
</description>
43+
<releaseNotes>https://github.com/yourusername/document-stitcher-cli/releases/tag/v1.0.0</releaseNotes>
44+
</metadata>
45+
<files>
46+
<file src="tools\**" target="tools" />
47+
</files>
48+
</package>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# VERIFICATION
2+
This package contains a pre-compiled binary for Document Stitcher.
3+
4+
The binary is downloaded from the official GitHub releases:
5+
https://github.com/yourusername/document-stitcher-cli/releases
6+
7+
You can verify the download by:
8+
1. Go to https://github.com/yourusername/document-stitcher-cli/releases/tag/v1.0.0
9+
2. Download document-stitcher-win-x64.exe
10+
3. Compare the SHA256 checksum:
11+
- Downloaded file: (see checksum in chocolateyinstall.ps1)
12+
- Official release: (checksum from GitHub release)
13+
14+
The package source code can be found at:
15+
https://github.com/yourusername/document-stitcher-cli
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageName = 'document-stitcher'
4+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
5+
$url64 = 'https://github.com/yourusername/document-stitcher-cli/releases/download/v1.0.0/document-stitcher-win-x64.exe'
6+
7+
$packageArgs = @{
8+
packageName = $packageName
9+
unzipLocation = $toolsDir
10+
fileType = 'exe'
11+
url64bit = $url64
12+
softwareName = 'Document Stitcher*'
13+
checksum64 = ''
14+
checksumType64 = 'sha256'
15+
validExitCodes = @(0)
16+
}
17+
18+
# Download and place the executable
19+
Get-ChocolateyWebFile @packageArgs
20+
21+
# Rename the downloaded file to document-stitcher.exe
22+
$exePath = Join-Path $toolsDir 'document-stitcher-win-x64.exe'
23+
$targetPath = Join-Path $toolsDir 'document-stitcher.exe'
24+
25+
if (Test-Path $exePath) {
26+
Move-Item -Path $exePath -Destination $targetPath -Force
27+
}
28+
29+
# Create a shim so it's available in PATH
30+
Install-BinFile -Name 'document-stitcher' -Path $targetPath
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageName = 'document-stitcher'
4+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
5+
6+
# Remove the shim
7+
Uninstall-BinFile -Name 'document-stitcher'
8+
9+
# Remove the executable
10+
$exePath = Join-Path $toolsDir 'document-stitcher.exe'
11+
if (Test-Path $exePath) {
12+
Remove-Item $exePath -Force
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"version": "1.0.0",
3+
"description": "Stitch together Markdown, images, and PDFs into a single printable PDF",
4+
"homepage": "https://github.com/yourusername/document-stitcher-cli",
5+
"license": "ISC",
6+
"architecture": {
7+
"64bit": {
8+
"url": "https://github.com/yourusername/document-stitcher-cli/releases/download/v1.0.0/document-stitcher-win-x64.exe",
9+
"hash": "",
10+
"bin": [
11+
[
12+
"document-stitcher-win-x64.exe",
13+
"document-stitcher"
14+
]
15+
]
16+
}
17+
},
18+
"checkver": {
19+
"github": "https://github.com/yourusername/document-stitcher-cli"
20+
},
21+
"autoupdate": {
22+
"architecture": {
23+
"64bit": {
24+
"url": "https://github.com/yourusername/document-stitcher-cli/releases/download/v$version/document-stitcher-win-x64.exe"
25+
}
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)