Aller au contenu

Development

Ce contenu n’est pas encore disponible dans votre langue.

Install the necessary tools for development by following their respective installation instructions.

  • Go
  • GitHub CLI (optional, for theme development with private repositories)

Clone the repository and build the project:

git clone https://github.com/germainlefebvre4/cvwonder.git
cd cvwonder
make build

Build the binary:

make build

This creates the cvwonder executable in the project root.

If you’re developing or testing themes in private repositories, CVWonder supports multiple authentication methods:

Option 1: GitHub CLI (Recommended)

# Authenticate once
gh auth login
# CVWonder automatically detects and uses your gh credentials
./cvwonder theme install https://github.com/your-org/your-private-theme

Option 2: Environment Variables

# Set the token in your environment
export GITHUB_TOKEN="ghp_your_personal_access_token"
# Or use GH_TOKEN
export GH_TOKEN="ghp_your_personal_access_token"
# Install themes
./cvwonder theme install https://github.com/your-org/your-private-theme

Authentication Priority:

CVWonder checks for credentials in this order:

  1. GitHub CLI (gh) - automatic if logged in
  2. GITHUB_TOKEN environment variable
  3. GH_TOKEN environment variable
  4. Unauthenticated (public repositories only)

Debugging Authentication:

Use debug logging to verify which authentication method is being used:

./cvwonder theme install <url> --log-level debug

Testing Authentication Flow:

When developing authentication features, test all methods:

# Test GitHub CLI
gh auth login
./cvwonder theme install <private-repo> --log-level debug
# Test environment variable
gh auth logout
export GITHUB_TOKEN="token_here"
./cvwonder theme install <private-repo> --log-level debug
# Test unauthenticated (should fail for private repos)
unset GITHUB_TOKEN
unset GH_TOKEN
./cvwonder theme install <private-repo> --log-level debug

Use the serve command with watch mode for live reloading:

./cvwonder serve --watch

Lint the codebase (TODO: add linting configuration):

# golangci-lint run

Run all unit tests:

go test ./...

Run tests for a specific package:

go test ./internal/utils/...
go test ./internal/themes/...

Run tests with coverage:

go test ./... -cover

Run tests with verbose output:

go test ./... -v

Integration tests are run as part of the CI/CD pipeline.

Documentation is built using Astro Starlight and located in docs/github-pages/.

cd docs/github-pages
npm ci
npm run dev

This starts a local development server at http://localhost:4321/

cd docs/github-pages
npm run build

For information about the codebase structure and architecture, see the Architecture documentation.