Complete installation setup and fix browser sandbox issue

- Add complete installation instructions including ghcup setup
- Create install-deps.sh script for system dependencies
- Fix GHC version compatibility (base >=4.18 instead of 4.21)
- Add puppeteer config to disable sandboxing for mermaid CLI
- Update Mermaid module to use puppeteer config file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Your Name 2025-09-02 15:52:15 +00:00
parent fe3e599909
commit 4ae2321cfd
5 changed files with 48 additions and 19 deletions

View File

@ -11,26 +11,49 @@ Mermaid code blocks (```mermaid) will be rendered to SVG and embedded.
## Installation ## Installation
### Build and install to PATH ### Prerequisites
First install the required system dependencies:
```bash
./install-deps.sh
```
### Install Haskell toolchain
Install ghcup (Haskell toolchain installer):
```bash
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
source ~/.ghcup/env
```
Install specific GHC and Cabal versions:
```bash
ghcup install ghc 9.12.2
ghcup install cabal 3.16.0.0
ghcup set ghc 9.12.2
ghcup set cabal 3.16.0.0
```
### Install Mermaid CLI
```bash
npm install -g @mermaid-js/mermaid-cli
```
### Build and install docster
```bash
cabal install --installdir=$HOME/.local/bin cabal install --installdir=$HOME/.local/bin
```
Make sure `~/.local/bin` is in your PATH. Add to your shell config if needed: Make sure `~/.local/bin` is in your PATH. Add to your shell config if needed:
```bash
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
```
## Requirements
- GHC + Cabal (via ghcup)
- Pandoc
- TeX Live (for PDF)
- Mermaid CLI (`npm install -g @mermaid-js/mermaid-cli`)
### specific versions
source ~/.ghcup/env && ghcup install ghc 9.12.2
source ~/.ghcup/env && ghcup install cabal 3.16.0.0
source ~/.ghcup/env && ghcup install hls 2.11.0.0
## Development ## Development

View File

@ -34,7 +34,7 @@ library
Docster.Compiler Docster.Compiler
hs-source-dirs: src hs-source-dirs: src
build-depends: build-depends:
base >=4.21 && <5, base >=4.18 && <5,
text >=2.0 && <2.2, text >=2.0 && <2.2,
filepath >=1.4 && <1.6, filepath >=1.4 && <1.6,
directory >=1.3 && <1.4, directory >=1.3 && <1.4,
@ -52,7 +52,7 @@ executable docster
main-is: Main.hs main-is: Main.hs
hs-source-dirs: app hs-source-dirs: app
build-depends: build-depends:
base >=4.21 && <5, base >=4.18 && <5,
text >=2.0 && <2.2, text >=2.0 && <2.2,
docster docster
default-language: Haskell2010 default-language: Haskell2010

2
install-deps.sh Normal file
View File

@ -0,0 +1,2 @@
sudo apt update
sudo apt install -y build-essential libgmp-dev libffi-dev zlib1g-dev texlive-latex-base texlive-fonts-recommended texlive-latex-extra texlive-xetex

3
puppeteer-config.json Normal file
View File

@ -0,0 +1,3 @@
{
"args": ["--no-sandbox", "--disable-setuid-sandbox"]
}

View File

@ -80,9 +80,10 @@ generateDiagramPaths (DiagramConfig (SourceDir sourceDir) format) (DiagramId dia
-- | Call mermaid CLI process with appropriate arguments -- | Call mermaid CLI process with appropriate arguments
callMermaidProcess :: OutputFormat -> FilePath -> FilePath -> IO (Either DocsterError ()) callMermaidProcess :: OutputFormat -> FilePath -> FilePath -> IO (Either DocsterError ())
callMermaidProcess format mmdFile outputFile = do callMermaidProcess format mmdFile outputFile = do
let args = case format of let baseArgs = case format of
HTML -> ["-i", mmdFile, "-o", outputFile] HTML -> ["-i", mmdFile, "-o", outputFile]
PDF -> ["-i", mmdFile, "-o", outputFile, "--scale", "3"] PDF -> ["-i", mmdFile, "-o", outputFile, "--scale", "3"]
args = baseArgs ++ ["--puppeteerConfigFile", "puppeteer-config.json"]
result <- catch result <- catch
(callProcess (T.unpack mermaidCommand) args >> return (Right ())) (callProcess (T.unpack mermaidCommand) args >> return (Right ()))