chore(tooling): Improve CI pipeline and expand pre-commit hooks

Expands the pre-commit configuration with a wider range of hooks to enforce file quality, validation, security, and Git safety checks.

The CI pipeline is updated to:
- Correct the `golangci-lint` format command to `fmt`.
- Enable CGO for test execution to support the race detector.
- Improve the robustness of test report parsing scripts.

Additionally, this commit includes minor stylistic and formatting cleanups across various project files.
This commit is contained in:
2025-11-07 07:26:21 +01:00
parent e7de5d044a
commit 8d606706e2
16 changed files with 245 additions and 225 deletions

2
.github/CODEOWNERS vendored
View File

@ -1,5 +1,5 @@
# These owners will be the default owners for everything in # These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence, they will # the repo. Unless a later match takes precedence, they will
# be requested for review when someone opens a pull request. # be requested for review when someone opens a pull request.
* @kjanat * @kjanat

View File

@ -34,7 +34,7 @@ jobs:
run: golangci-lint run --fix run: golangci-lint run --fix
- name: Run golangci-lint format - name: Run golangci-lint format
run: golangci-lint format run: golangci-lint fmt
- name: Run go mod tidy - name: Run go mod tidy
run: go mod tidy run: go mod tidy

View File

@ -64,6 +64,8 @@ jobs:
- name: Run tests with enhanced reporting - name: Run tests with enhanced reporting
id: test id: test
env:
CGO_ENABLED: 1
run: | run: |
cat >> $GITHUB_STEP_SUMMARY << EOF cat >> $GITHUB_STEP_SUMMARY << EOF
## 🔧 Test Environment ## 🔧 Test Environment
@ -79,9 +81,9 @@ jobs:
# Extract test results for summary # Extract test results for summary
TEST_STATUS=$? TEST_STATUS=$?
TOTAL_TESTS=$(grep -c "=== RUN" test-output.log || echo "0") TOTAL_TESTS=$(grep -c "=== RUN" test-output.log || echo "0")
PASSED_TESTS=$(grep -c "--- PASS:" test-output.log || echo "0") PASSED_TESTS=$(grep -c -- "--- PASS:" test-output.log || echo "0")
FAILED_TESTS=$(grep -c "--- FAIL:" test-output.log || echo "0") FAILED_TESTS=$(grep -c -- "--- FAIL:" test-output.log || echo "0")
SKIPPED_TESTS=$(grep -c "--- SKIP:" test-output.log || echo "0") SKIPPED_TESTS=$(grep -c -- "--- SKIP:" test-output.log || echo "0")
# Generate test summary # Generate test summary
cat >> $GITHUB_STEP_SUMMARY << EOF cat >> $GITHUB_STEP_SUMMARY << EOF
@ -120,7 +122,7 @@ jobs:
### ❌ Failed Tests Details ### ❌ Failed Tests Details
``` ```
EOF EOF
grep -A 10 "--- FAIL:" test-output.log | head -100 >> $GITHUB_STEP_SUMMARY grep -A 10 -- "--- FAIL:" test-output.log | head -100 >> $GITHUB_STEP_SUMMARY
cat >> $GITHUB_STEP_SUMMARY << 'EOF' cat >> $GITHUB_STEP_SUMMARY << 'EOF'
``` ```
@ -128,12 +130,10 @@ jobs:
fi fi
# Set outputs for other steps # Set outputs for other steps
cat >> $GITHUB_OUTPUT << EOF echo "test-status=$TEST_STATUS" >> $GITHUB_OUTPUT
test-status=$TEST_STATUS echo "total-tests=$TOTAL_TESTS" >> $GITHUB_OUTPUT
total-tests=$TOTAL_TESTS echo "passed-tests=$PASSED_TESTS" >> $GITHUB_OUTPUT
passed-tests=$PASSED_TESTS echo "failed-tests=$FAILED_TESTS" >> $GITHUB_OUTPUT
failed-tests=$FAILED_TESTS
EOF
# Exit with the original test status # Exit with the original test status
exit $TEST_STATUS exit $TEST_STATUS

View File

@ -1,104 +1,104 @@
# For most projects, this workflow file will not need changing; you simply need # For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository. # to commit it to your repository.
# #
# You may wish to alter this file to override the set of languages analyzed, # You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic. # or to provide custom queries or build logic.
# #
# ******** NOTE ******** # ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check # We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of # the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages. # supported CodeQL languages.
# #
name: "CodeQL" name: "CodeQL"
# This workflow is configured to be called by other workflows for more controlled execution # This workflow is configured to be called by other workflows for more controlled execution
# This allows integration with the main CI pipeline and avoids redundant runs # This allows integration with the main CI pipeline and avoids redundant runs
# To enable automatic execution, uncomment the triggers below: # To enable automatic execution, uncomment the triggers below:
on: on:
workflow_call: workflow_call:
schedule: schedule:
- cron: '44 16 * * 6' - cron: '44 16 * * 6'
# push: # push:
# branches: [ "master" ] # branches: [ "master" ]
# pull_request: # pull_request:
# branches: [ "master" ] # branches: [ "master" ]
jobs: jobs:
analyze: analyze:
name: Analyze (${{ matrix.language }}) name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see: # Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql # - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only) # - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements. # Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions: permissions:
# required for all workflows # required for all workflows
security-events: write security-events: write
# required to fetch internal or private CodeQL packs # required to fetch internal or private CodeQL packs
packages: read packages: read
# only required for workflows in private repositories # only required for workflows in private repositories
actions: read actions: read
contents: read contents: read
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- language: actions - language: actions
build-mode: none build-mode: none
- language: go - language: go
build-mode: autobuild build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both # Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v5
# Add any setup steps before running the `github/codeql-action/init` action. # Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node` # This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds. # or others). This is typically only required for manual builds.
# - name: Setup runtime (example) # - name: Setup runtime (example)
# uses: actions/setup-example@v1 # uses: actions/setup-example@v1
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v4 uses: github/codeql-action/init@v4
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }} build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file. # By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file. # Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality # queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with # If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above # "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step # to set the build mode to "manual" for that language. Then modify this step
# to build your code. # to build your code.
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual' - if: matrix.build-mode == 'manual'
shell: bash shell: bash
run: | run: |
echo 'If you are using a "manual" build mode for one or more of the' \ echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \ 'languages you are analyzing, replace this with the commands to build' \
'your code, for example:' 'your code, for example:'
echo ' make bootstrap' echo ' make bootstrap'
echo ' make release' echo ' make release'
exit 1 exit 1
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4 uses: github/codeql-action/analyze@v4
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

158
.gitignore vendored
View File

@ -1,79 +1,79 @@
# Created by https://www.toptal.com/developers/gitignore/api/go # Created by https://www.toptal.com/developers/gitignore/api/go
# Edit at https://www.toptal.com/developers/gitignore?templates=go # Edit at https://www.toptal.com/developers/gitignore?templates=go
### Go ### ### Go ###
# If you prefer the allow list template instead of the deny list, see community template: # If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
# #
# Binaries for programs and plugins # Binaries for programs and plugins
*.exe *.exe
*.exe~ *.exe~
*.dll *.dll
*.so *.so
*.dylib *.dylib
# Test binary, built with `go test -c` # Test binary, built with `go test -c`
*.test *.test
# Output of the go coverage tool, specifically when used with LiteIDE # Output of the go coverage tool, specifically when used with LiteIDE
*.out *.out
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
# Go workspace file # Go workspace file
go.work go.work
# End of https://www.toptal.com/developers/gitignore/api/go # End of https://www.toptal.com/developers/gitignore/api/go
# Shit # Shit
.github/TODO .github/TODO
# Local test files # Local test files
output/ output/
outputs/ outputs/
articulate-sample.json articulate-sample.json
test-output.* test-output.*
go-os-arch-matrix.csv go-os-arch-matrix.csv
test_godocx.go test_godocx.go
test_input.json test_input.json
# Build artifacts # Build artifacts
build/ build/
# Old workflows # Old workflows
.github/workflows/ci-old.yml .github/workflows/ci-old.yml
.github/workflows/ci-enhanced.yml .github/workflows/ci-enhanced.yml
# Test coverage files # Test coverage files
coverage.out coverage.out
coverage.txt coverage.txt
coverage.html coverage.html
coverage.* coverage.*
coverage coverage
*.cover *.cover
*.coverprofile *.coverprofile
main_coverage main_coverage
# Other common exclusions # Other common exclusions
*.exe *.exe
*.exe~ *.exe~
*.dll *.dll
*.so *.so
*.dylib *.dylib
*.test *.test
*.out *.out
/tmp/ /tmp/
.github/copilot-instructions.md .github/copilot-instructions.md
# Editors # Editors
.vscode/ .vscode/
.idea/ .idea/
.task/ .task/
**/*.local.* **/*.local.*
.claude/ .claude/
NUL NUL

View File

@ -4,10 +4,31 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 rev: v6.0.0
hooks: hooks:
# File quality
- id: trailing-whitespace - id: trailing-whitespace
exclude: '^\.github/ISSUE_TEMPLATE/.*\.yml$'
- id: end-of-file-fixer - id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
# File validation
- id: check-yaml - id: check-yaml
- id: check-json
- id: check-toml
# Security
- id: detect-private-key
# Git safety
- id: check-merge-conflict
- id: check-case-conflict
- id: no-commit-to-branch
args: ['--branch=master', '--branch=main']
# File structure
- id: check-added-large-files - id: check-added-large-files
- id: check-symlinks
- id: check-executables-have-shebangs
- repo: https://github.com/golangci/golangci-lint - repo: https://github.com/golangci/golangci-lint
rev: v2.6.1 rev: v2.6.1
hooks: hooks:

View File

@ -4,8 +4,8 @@
- **Build**: `task build` or `go build -o bin/articulate-parser main.go` - **Build**: `task build` or `go build -o bin/articulate-parser main.go`
- **Run tests**: `task test` or `go test -race -timeout 5m ./...` - **Run tests**: `task test` or `go test -race -timeout 5m ./...`
- **Run single test**: `go test -v -race -run ^TestName$ ./path/to/package` - **Run single test**: `go test -v -race -run ^TestName$ ./path/to/package`
- **Test with coverage**: - **Test with coverage**:
- `task test:coverage` or - `task test:coverage` or
- `go test -race -coverprofile=coverage/coverage.out -covermode=atomic ./...` - `go test -race -coverprofile=coverage/coverage.out -covermode=atomic ./...`
- **Lint**: `task lint` (runs vet, fmt check, staticcheck, golangci-lint) - **Lint**: `task lint` (runs vet, fmt check, staticcheck, golangci-lint)
- **Format**: `task fmt` or `gofmt -s -w .` - **Format**: `task fmt` or `gofmt -s -w .`

View File

@ -27,7 +27,7 @@ ARG BUILD_TIME
ARG GIT_COMMIT ARG GIT_COMMIT
# Docker buildx automatically provides these for multi-platform builds # Docker buildx automatically provides these for multi-platform builds
ARG BUILDPLATFORM ARG BUILDPLATFORM
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT

View File

@ -30,7 +30,7 @@ ARG BUILD_TIME
ARG GIT_COMMIT ARG GIT_COMMIT
# Docker buildx automatically provides these for multi-platform builds # Docker buildx automatically provides these for multi-platform builds
ARG BUILDPLATFORM ARG BUILDPLATFORM
ARG TARGETPLATFORM ARG TARGETPLATFORM
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ARG TARGETVARIANT ARG TARGETVARIANT

View File

@ -20,36 +20,36 @@ A Go-based parser that converts Articulate Rise e-learning content to various fo
flowchart TD flowchart TD
%% User Input %% User Input
CLI[Command Line Interface<br/>main.go] --> APP{App Service<br/>services/app.go} CLI[Command Line Interface<br/>main.go] --> APP{App Service<br/>services/app.go}
%% Core Application Logic %% Core Application Logic
APP --> |"ProcessCourseFromURI"| PARSER[Course Parser<br/>services/parser.go] APP --> |"ProcessCourseFromURI"| PARSER[Course Parser<br/>services/parser.go]
APP --> |"ProcessCourseFromFile"| PARSER APP --> |"ProcessCourseFromFile"| PARSER
APP --> |"exportCourse"| FACTORY[Exporter Factory<br/>exporters/factory.go] APP --> |"exportCourse"| FACTORY[Exporter Factory<br/>exporters/factory.go]
%% Data Sources %% Data Sources
PARSER --> |"FetchCourse"| API[Articulate Rise API<br/>rise.articulate.com] PARSER --> |"FetchCourse"| API[Articulate Rise API<br/>rise.articulate.com]
PARSER --> |"LoadCourseFromFile"| FILE[Local JSON File<br/>*.json] PARSER --> |"LoadCourseFromFile"| FILE[Local JSON File<br/>*.json]
%% Data Models %% Data Models
API --> MODELS[Data Models<br/>models/course.go] API --> MODELS[Data Models<br/>models/course.go]
FILE --> MODELS FILE --> MODELS
MODELS --> |Course, Lesson, Item| APP MODELS --> |Course, Lesson, Item| APP
%% Export Factory Pattern %% Export Factory Pattern
FACTORY --> |"CreateExporter"| MARKDOWN[Markdown Exporter<br/>exporters/markdown.go] FACTORY --> |"CreateExporter"| MARKDOWN[Markdown Exporter<br/>exporters/markdown.go]
FACTORY --> |"CreateExporter"| HTML[HTML Exporter<br/>exporters/html.go] FACTORY --> |"CreateExporter"| HTML[HTML Exporter<br/>exporters/html.go]
FACTORY --> |"CreateExporter"| DOCX[DOCX Exporter<br/>exporters/docx.go] FACTORY --> |"CreateExporter"| DOCX[DOCX Exporter<br/>exporters/docx.go]
%% HTML Cleaning Service %% HTML Cleaning Service
CLEANER[HTML Cleaner<br/>services/html_cleaner.go] --> MARKDOWN CLEANER[HTML Cleaner<br/>services/html_cleaner.go] --> MARKDOWN
CLEANER --> HTML CLEANER --> HTML
CLEANER --> DOCX CLEANER --> DOCX
%% Output Files %% Output Files
MARKDOWN --> |"Export"| MD_OUT[Markdown Files<br/>*.md] MARKDOWN --> |"Export"| MD_OUT[Markdown Files<br/>*.md]
HTML --> |"Export"| HTML_OUT[HTML Files<br/>*.html] HTML --> |"Export"| HTML_OUT[HTML Files<br/>*.html]
DOCX --> |"Export"| DOCX_OUT[Word Documents<br/>*.docx] DOCX --> |"Export"| DOCX_OUT[Word Documents<br/>*.docx]
%% Interfaces (Contracts) %% Interfaces (Contracts)
IPARSER[CourseParser Interface<br/>interfaces/parser.go] -.-> PARSER IPARSER[CourseParser Interface<br/>interfaces/parser.go] -.-> PARSER
IEXPORTER[Exporter Interface<br/>interfaces/exporter.go] -.-> MARKDOWN IEXPORTER[Exporter Interface<br/>interfaces/exporter.go] -.-> MARKDOWN
@ -64,7 +64,7 @@ flowchart TD
classDef output fill:#fce7f3,stroke:#be185d,stroke-width:2px,color:#be185d classDef output fill:#fce7f3,stroke:#be185d,stroke-width:2px,color:#be185d
classDef interface fill:#ecfdf5,stroke:#16a34a,stroke-width:1px,stroke-dasharray: 5 5,color:#16a34a classDef interface fill:#ecfdf5,stroke:#16a34a,stroke-width:1px,stroke-dasharray: 5 5,color:#16a34a
classDef service fill:#cffafe,stroke:#0891b2,stroke-width:2px,color:#0891b2 classDef service fill:#cffafe,stroke:#0891b2,stroke-width:2px,color:#0891b2
class CLI userInput class CLI userInput
class APP,FACTORY coreLogic class APP,FACTORY coreLogic
class API,FILE,MODELS dataSource class API,FILE,MODELS dataSource
@ -80,7 +80,7 @@ The system follows **Clean Architecture** principles with clear separation of co
- **🎯 Entry Point**: Command-line interface handles user input and coordinates operations - **🎯 Entry Point**: Command-line interface handles user input and coordinates operations
- **🏗️ Application Layer**: Core business logic with dependency injection - **🏗️ Application Layer**: Core business logic with dependency injection
- **📋 Interface Layer**: Contracts defining behavior without implementation details - **📋 Interface Layer**: Contracts defining behavior without implementation details
- **🔧 Service Layer**: Concrete implementations of parsing and utility services - **🔧 Service Layer**: Concrete implementations of parsing and utility services
- **📤 Export Layer**: Factory pattern for format-specific exporters - **📤 Export Layer**: Factory pattern for format-specific exporters
- **📊 Data Layer**: Domain models representing course structure - **📊 Data Layer**: Domain models representing course structure

View File

@ -316,13 +316,13 @@ tasks:
docker:run: docker:run:
desc: Run Docker container desc: Run Docker container
aliases: [dr] aliases: [dr]
deps: [docker:build] deps: ['docker:build']
cmds: cmds:
- docker run --rm {{.APP_NAME}}:{{.VERSION}} --help - docker run --rm {{.APP_NAME}}:{{.VERSION}} --help
docker:test: docker:test:
desc: Test Docker image desc: Test Docker image
deps: [docker:build] deps: ['docker:build']
cmds: cmds:
- docker run --rm {{.APP_NAME}}:{{.VERSION}} --version - docker run --rm {{.APP_NAME}}:{{.VERSION}} --version
- echo "Docker image tested successfully" - echo "Docker image tested successfully"
@ -434,7 +434,7 @@ tasks:
docs:coverage: docs:coverage:
desc: Open coverage report in browser desc: Open coverage report in browser
deps: [test:coverage] deps: ['test:coverage']
cmds: cmds:
- '{{if eq OS "darwin"}}open {{.COVERAGE_DIR}}/coverage.html{{else if eq OS "windows"}}start {{.COVERAGE_DIR}}/coverage.html{{else}}xdg-open {{.COVERAGE_DIR}}/coverage.html 2>/dev/null || echo "Please open {{.COVERAGE_DIR}}/coverage.html in your browser"{{end}}' - '{{if eq OS "darwin"}}open {{.COVERAGE_DIR}}/coverage.html{{else if eq OS "windows"}}start {{.COVERAGE_DIR}}/coverage.html{{else}}xdg-open {{.COVERAGE_DIR}}/coverage.html 2>/dev/null || echo "Please open {{.COVERAGE_DIR}}/coverage.html in your browser"{{end}}'

View File

@ -15,7 +15,7 @@ import (
//go:embed html_styles.css //go:embed html_styles.css
var defaultCSS string var defaultCSS string
//go:embed html_template.html //go:embed html_template.gohtml
var htmlTemplate string var htmlTemplate string
// HTMLExporter implements the Exporter interface for HTML format. // HTMLExporter implements the Exporter interface for HTML format.

View File

@ -4,9 +4,8 @@ Course description
## Course Information ## Course Information
- **Course ID**: - **Course ID**:
- **Share ID**: example-id - **Share ID**: example-id
- **Navigation Mode**: - **Navigation Mode**:
--- ---

View File

@ -137,7 +137,7 @@ try {
# Show targets and exit if requested # Show targets and exit if requested
if ($ShowTargets) { if ($ShowTargets) {
Write-Host 'Available build targets:' -ForegroundColor Cyan Write-Host 'Available build targets:' -ForegroundColor Cyan
# Get available platforms and architectures from Go toolchain # Get available platforms and architectures from Go toolchain
try { try {
$GoTargets = @(go tool dist list 2>$null) $GoTargets = @(go tool dist list 2>$null)
@ -148,7 +148,7 @@ try {
Write-Host '⚠️ Could not retrieve targets from Go. Using default targets.' -ForegroundColor Yellow Write-Host '⚠️ Could not retrieve targets from Go. Using default targets.' -ForegroundColor Yellow
$PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() } $PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() }
$ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() } $ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() }
foreach ($platform in $PlatformList) { foreach ($platform in $PlatformList) {
foreach ($arch in $ArchList) { foreach ($arch in $ArchList) {
$BinaryName = "articulate-parser-$platform-$arch" $BinaryName = "articulate-parser-$platform-$arch"
@ -163,12 +163,12 @@ try {
$SelectedTargets = @() $SelectedTargets = @()
$PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() } $PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() }
$ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() } $ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() }
foreach ($target in $GoTargets) { foreach ($target in $GoTargets) {
$parts = $target.Split('/') $parts = $target.Split('/')
$platform = $parts[0] $platform = $parts[0]
$arch = $parts[1] $arch = $parts[1]
if ($PlatformList -contains $platform -and $ArchList -contains $arch) { if ($PlatformList -contains $platform -and $ArchList -contains $arch) {
$SelectedTargets += @{ $SelectedTargets += @{
Platform = $platform Platform = $platform
@ -177,14 +177,14 @@ try {
} }
} }
} }
# Display filtered targets # Display filtered targets
foreach ($target in $SelectedTargets) { foreach ($target in $SelectedTargets) {
$BinaryName = "articulate-parser-$($target.Platform)-$($target.Arch)" $BinaryName = "articulate-parser-$($target.Platform)-$($target.Arch)"
if ($target.Platform -eq 'windows') { $BinaryName += '.exe' } if ($target.Platform -eq 'windows') { $BinaryName += '.exe' }
Write-Host " $($target.Original) -> $BinaryName" -ForegroundColor Gray Write-Host " $($target.Original) -> $BinaryName" -ForegroundColor Gray
} }
# Show all available targets if verbose # Show all available targets if verbose
if ($VerboseOutput) { if ($VerboseOutput) {
Write-Host "`nAll Go targets available on this system:" -ForegroundColor Cyan Write-Host "`nAll Go targets available on this system:" -ForegroundColor Cyan
@ -404,13 +404,13 @@ try {
} }
$BuildArgs += '-o' $BuildArgs += '-o'
$BuildArgs += $Target.Path $BuildArgs += $Target.Path
# If using custom entry point that's not main.go # If using custom entry point that's not main.go
# we need to use the file explicitly to avoid duplicate declarations # we need to use the file explicitly to avoid duplicate declarations
$EntryPointPath = Join-Path $ProjectRoot $EntryPoint $EntryPointPath = Join-Path $ProjectRoot $EntryPoint
$EntryPointFile = Split-Path $EntryPointPath -Leaf $EntryPointFile = Split-Path $EntryPointPath -Leaf
$IsCustomEntryPoint = ($EntryPointFile -ne 'main.go') $IsCustomEntryPoint = ($EntryPointFile -ne 'main.go')
if ($IsCustomEntryPoint) { if ($IsCustomEntryPoint) {
# When using custom entry point, compile only that file # When using custom entry point, compile only that file
$BuildArgs += $EntryPointPath $BuildArgs += $EntryPointPath
@ -419,7 +419,7 @@ try {
$PackagePath = Split-Path $EntryPointPath -Parent $PackagePath = Split-Path $EntryPointPath -Parent
$BuildArgs += $PackagePath $BuildArgs += $PackagePath
} }
# For verbose output, show the command that will be executed # For verbose output, show the command that will be executed
if ($VerboseOutput) { if ($VerboseOutput) {
Write-Host "Command: go $($BuildArgs -join ' ')" -ForegroundColor DarkCyan Write-Host "Command: go $($BuildArgs -join ' ')" -ForegroundColor DarkCyan

View File

@ -73,7 +73,7 @@ EXAMPLES:
DEFAULT TARGETS: DEFAULT TARGETS:
Operating Systems: darwin, freebsd, linux, windows Operating Systems: darwin, freebsd, linux, windows
Architectures: amd64, arm64 Architectures: amd64, arm64
This creates 8 binaries total (4 OS × 2 ARCH) This creates 8 binaries total (4 OS × 2 ARCH)
GO BUILD FLAGS: GO BUILD FLAGS: