diff --git a/README-developer.md b/README-developer.md new file mode 100644 index 0000000..17caefe --- /dev/null +++ b/README-developer.md @@ -0,0 +1,311 @@ +# Developer Guide - IPCEI-CIS Developer Framework + +## ๐Ÿš€ Quick Start + +### Prerequisites + +Install [Devbox](https://www.jetify.com/devbox/): +```bash +curl -fsSL https://get.jetify.com/devbox | bash +``` + +### Setup + +1. Clone the repository +2. Start devbox shell: +```bash +devbox shell +``` + +Devbox automatically installs all required tools: +- Hugo (v0.151.0+extended) +- Go (v1.25.1) +- Node.js (v24.10.0) +- Dart Sass +- htmltest +- go-task + +## ๐Ÿ“š Technology Stack + +### Hugo (v0.151.0+extended) + +Hugo is a fast static site generator. This project uses Hugo in extended mode with: +- **Docsy Theme** (v0.12.0) - Documentation theme with responsive design +- **Bootstrap 5.3.8** - UI framework +- **PostCSS** - CSS processing + +### Docsy Theme + +Docsy is a Hugo theme optimized for technical documentation: +- Multi-language support +- Search functionality +- Navigation menu system +- Code syntax highlighting +- Responsive design + +Key directories: +- `content/en/` - English content (Markdown files) +- `layouts/` - Custom layout overrides +- `assets/scss/` - Custom styles +- `static/` - Static assets (images, etc.) + +### Task (Taskfile) + +Task is a task runner / build tool that replaces Makefiles. It uses `Taskfile.yml` for defining tasks. + +## ๐Ÿ› ๏ธ Development Workflow + +### Using Task (Recommended) + +View all available tasks: +```bash +task +# or +task --list +``` + +Common tasks: + +#### Development +```bash +task serve # Start Hugo dev server (http://localhost:1313) +task build # Build production site +task build:dev # Build development site +task clean # Clean build artifacts +``` + +#### Testing +```bash +task test # Run all tests +task test:quick # Run quick tests (without link checking) +task test:build # Test if Hugo builds successfully +task test:markdown # Lint Markdown files +task test:html # Validate HTML output +task test:links # Check all links (internal & external) +``` + +#### Dependencies +```bash +task deps:install # Install all dependencies +task deps:update # Update all dependencies +``` + +#### CI/CD +```bash +task ci # Run full CI pipeline locally +``` + +### Using NPM Scripts (Alternative) + +If you prefer NPM: +```bash +npm test # All tests +npm run test:quick # Quick tests +npm run test:build # Build test +npm run test:markdown # Markdown linting +npm run test:html # HTML validation +npm run test:links # Link checking +``` + +### Using Hugo Directly + +```bash +# Development server +hugo server + +# Production build +hugo --gc --minify + +# Check version +hugo version +``` + +## ๐Ÿ“ Project Structure + +``` +. +โ”œโ”€โ”€ content/ # Content files (Markdown) +โ”‚ โ””โ”€โ”€ en/ # English content +โ”‚ โ”œโ”€โ”€ docs/ # Documentation +โ”‚ โ””โ”€โ”€ blog/ # Blog posts +โ”œโ”€โ”€ layouts/ # Custom HTML templates +โ”œโ”€โ”€ static/ # Static files +โ”œโ”€โ”€ assets/ # Assets (SCSS, images) +โ”œโ”€โ”€ public/ # Generated site (not in Git) +โ”œโ”€โ”€ resources/ # Hugo cache (not in Git) +โ”œโ”€โ”€ hugo.toml # Hugo configuration +โ”œโ”€โ”€ go.mod # Hugo modules (Docsy theme) +โ”œโ”€โ”€ Taskfile.yml # Task definitions +โ”œโ”€โ”€ package.json # NPM dependencies & scripts +โ””โ”€โ”€ devbox.json # Devbox configuration +``` + +## ๐Ÿ“ Content Creation + +### Creating New Pages + +```bash +# Using Hugo +hugo new docs/concepts/my-page.md +hugo new blog/my-post.md + +# Or create manually in content/en/ +``` + +### Front Matter + +Every content file needs front matter: + +```yaml +--- +title: "My Page Title" +description: "Page description" +date: 2025-10-23 +weight: 10 # Order in navigation +--- + +Your content here... +``` + +### Using Docsy Shortcodes + +Docsy provides helpful shortcodes: + +#### Tabbed Panes +```markdown +{{}} + {{}} + Content for tab 1 + {{}} + {{}} + Content for tab 2 + {{}} +{{}} +``` + +#### Code Blocks +```markdown +{{}} +key: value +{{}} +``` + +#### Alerts +```markdown +{{}} +Important information +{{}} +``` + +## ๐Ÿงช Testing + +See [TESTING.md](TESTING.md) for detailed testing documentation. + +Quick reference: +- `task test` - Run all tests before committing +- `task test:quick` - Fast checks during development +- Tests run automatically on GitHub Actions for PRs + +## ๐Ÿ”ง Configuration + +### Hugo Configuration (`hugo.toml`) + +Main settings: +- `baseURL` - Site URL +- `title` - Site title +- `defaultContentLanguage` - Default language +- Module imports (Docsy theme) + +### Docsy Configuration + +Docsy-specific settings in `hugo.toml`: +```toml +[params] +github_repo = "your-repo" +github_branch = "main" +``` + +### Devbox Configuration (`devbox.json`) + +Defines all development tools and their versions. + +Update tools: +```bash +devbox update # Update all packages +task deps:update # Update all dependencies (devbox + npm + hugo modules) +``` + +## ๐ŸŽจ Styling + +Custom styles in `assets/scss/_variables_project.scss`: +```scss +// Override Bootstrap/Docsy variables +$primary: #your-color; +``` + +Hugo will process SCSS automatically with PostCSS and Autoprefixer. + +## ๐ŸŒ Multi-Language Support + +Add new language: +1. Create `content//` directory +2. Add language config in `hugo.toml`: +```toml +[languages.] +languageName = "Language Name" +weight = 2 +``` + +## ๐Ÿ› Troubleshooting + +### "Module not found" errors +```bash +hugo mod get -u +hugo mod tidy +``` + +### PostCSS errors +```bash +npm install +``` + +### Build errors +```bash +task clean +task build +``` + +### Devbox issues +```bash +devbox update +devbox shell --refresh +``` + +## ๐Ÿ“š Resources + +- [Hugo Documentation](https://gohugo.io/documentation/) +- [Docsy Documentation](https://www.docsy.dev/docs/) +- [Taskfile Documentation](https://taskfile.dev/) +- [Devbox Documentation](https://www.jetify.com/devbox/docs/) + +## ๐Ÿค Contributing + +1. Create a feature branch +2. Make your changes +3. Run tests: `task test` +4. Commit with semantic messages: + - `feat(scope): add new feature` + - `fix(scope): fix bug` + - `docs(scope): update documentation` + - `test(scope): add tests` + - `chore(scope): maintenance` +5. Push and create pull request + +## ๐Ÿ“ฆ Deployment + +Build for production: +```bash +task build +``` + +Output will be in `public/` directory, ready for deployment. diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..ffb5199 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,88 @@ +version: '3' + +vars: + HUGO_CMD: hugo + NPM_CMD: npm + +tasks: + default: + desc: Show available tasks + cmds: + - task --list + + # Build tasks + build: + desc: Build Hugo site + cmds: + - "{{.HUGO_CMD}} --gc --minify" + + build:dev: + desc: Build Hugo site for development + cmds: + - "{{.HUGO_CMD}}" + + serve: + desc: Start Hugo dev server + cmds: + - "{{.HUGO_CMD}} server" + + clean: + desc: Clean build artifacts + cmds: + - rm -rf public resources/_gen .hugo_build.lock + + # Test tasks + test: + desc: Run all tests + deps: + - test:build + - test:markdown + - test:html + - test:links + + test:quick: + desc: Run quick tests (without link check) + deps: + - test:build + - test:markdown + + test:build: + desc: Test Hugo build + cmds: + - "{{.HUGO_CMD}} --gc --minify --logLevel info" + + test:markdown: + desc: Lint markdown files + cmds: + - "{{.NPM_CMD}} run test:markdown" + + test:html: + desc: Validate HTML + cmds: + - "{{.NPM_CMD}} run test:html" + + test:links: + desc: Check links + cmds: + - htmltest + + # Development tasks + deps:install: + desc: Install all dependencies + cmds: + - "{{.NPM_CMD}} install" + - "{{.HUGO_CMD}} mod get -u" + - "{{.HUGO_CMD}} mod tidy" + + deps:update: + desc: Update dependencies + cmds: + - devbox update + - "{{.NPM_CMD}} update" + - "{{.HUGO_CMD}} mod get -u" + + # CI/CD + ci: + desc: Run CI pipeline locally + deps: + - test diff --git a/devbox.json b/devbox.json index f688f2b..56ed1a3 100644 --- a/devbox.json +++ b/devbox.json @@ -5,7 +5,8 @@ "dart-sass@latest", "go@latest", "nodejs@latest", - "htmltest@latest" + "htmltest@latest", + "go-task@latest" ], "shell": { "init_hook": [], diff --git a/devbox.lock b/devbox.lock index 672aced..7629ec6 100644 --- a/devbox.lock +++ b/devbox.lock @@ -65,9 +65,53 @@ } } }, - "github:NixOS/nixpkgs/nixpkgs-unstable": { - "last_modified": "2025-10-13T09:56:54Z", - "resolved": "github:NixOS/nixpkgs/c12c63cd6c5eb34c7b4c3076c6a99e00fcab86ec?lastModified=1760349414&narHash=sha256-W4Ri1ZwYuNcBzqQQa7NnWfrv0wHMo7rduTWjIeU9dZk%3D" + "go-task@latest": { + "last_modified": "2025-10-07T08:41:47Z", + "resolved": "github:NixOS/nixpkgs/bce5fe2bb998488d8e7e7856315f90496723793c#go-task", + "source": "devbox-search", + "version": "3.45.4", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/jpyzi7ph07mxn64vr684rn4sn81rmdbv-go-task-3.45.4", + "default": true + } + ], + "store_path": "/nix/store/jpyzi7ph07mxn64vr684rn4sn81rmdbv-go-task-3.45.4" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/bhkmm0w7wmgncwvn8gmbsn254n0r9app-go-task-3.45.4", + "default": true + } + ], + "store_path": "/nix/store/bhkmm0w7wmgncwvn8gmbsn254n0r9app-go-task-3.45.4" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/pv4fd2995ys0dd4rvsqcn6cd2q2qi98s-go-task-3.45.4", + "default": true + } + ], + "store_path": "/nix/store/pv4fd2995ys0dd4rvsqcn6cd2q2qi98s-go-task-3.45.4" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/535z3a3p7hwdg4g3w4f4ssq44vnqsxqh-go-task-3.45.4", + "default": true + } + ], + "store_path": "/nix/store/535z3a3p7hwdg4g3w4f4ssq44vnqsxqh-go-task-3.45.4" + } + } }, "go@latest": { "last_modified": "2025-10-07T08:41:47Z",