mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 06:22:09 +01:00
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:
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -1,5 +1,5 @@
|
||||
# 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.
|
||||
* @kjanat
|
||||
|
||||
|
||||
2
.github/workflows/autofix.yml
vendored
2
.github/workflows/autofix.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
run: golangci-lint run --fix
|
||||
|
||||
- name: Run golangci-lint format
|
||||
run: golangci-lint format
|
||||
run: golangci-lint fmt
|
||||
|
||||
- name: Run go mod tidy
|
||||
run: go mod tidy
|
||||
|
||||
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@ -64,6 +64,8 @@ jobs:
|
||||
|
||||
- name: Run tests with enhanced reporting
|
||||
id: test
|
||||
env:
|
||||
CGO_ENABLED: 1
|
||||
run: |
|
||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||
## 🔧 Test Environment
|
||||
@ -79,9 +81,9 @@ jobs:
|
||||
# Extract test results for summary
|
||||
TEST_STATUS=$?
|
||||
TOTAL_TESTS=$(grep -c "=== RUN" 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")
|
||||
SKIPPED_TESTS=$(grep -c "--- SKIP:" 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")
|
||||
SKIPPED_TESTS=$(grep -c -- "--- SKIP:" test-output.log || echo "0")
|
||||
|
||||
# Generate test summary
|
||||
cat >> $GITHUB_STEP_SUMMARY << EOF
|
||||
@ -120,7 +122,7 @@ jobs:
|
||||
### ❌ Failed Tests Details
|
||||
```
|
||||
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'
|
||||
```
|
||||
|
||||
@ -128,12 +130,10 @@ jobs:
|
||||
fi
|
||||
|
||||
# Set outputs for other steps
|
||||
cat >> $GITHUB_OUTPUT << EOF
|
||||
test-status=$TEST_STATUS
|
||||
total-tests=$TOTAL_TESTS
|
||||
passed-tests=$PASSED_TESTS
|
||||
failed-tests=$FAILED_TESTS
|
||||
EOF
|
||||
echo "test-status=$TEST_STATUS" >> $GITHUB_OUTPUT
|
||||
echo "total-tests=$TOTAL_TESTS" >> $GITHUB_OUTPUT
|
||||
echo "passed-tests=$PASSED_TESTS" >> $GITHUB_OUTPUT
|
||||
echo "failed-tests=$FAILED_TESTS" >> $GITHUB_OUTPUT
|
||||
|
||||
# Exit with the original test status
|
||||
exit $TEST_STATUS
|
||||
|
||||
208
.github/workflows/codeql.yml
vendored
208
.github/workflows/codeql.yml
vendored
@ -1,104 +1,104 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# 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
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
# 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
|
||||
# To enable automatic execution, uncomment the triggers below:
|
||||
on:
|
||||
workflow_call:
|
||||
schedule:
|
||||
- cron: '44 16 * * 6'
|
||||
# push:
|
||||
# branches: [ "master" ]
|
||||
# pull_request:
|
||||
# branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners (GitHub.com only)
|
||||
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
# required for all workflows
|
||||
security-events: write
|
||||
|
||||
# required to fetch internal or private CodeQL packs
|
||||
packages: read
|
||||
|
||||
# only required for workflows in private repositories
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: actions
|
||||
build-mode: none
|
||||
- language: go
|
||||
build-mode: autobuild
|
||||
# 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 'java-kotlin' to analyze code written in Java, Kotlin 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,
|
||||
# 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
|
||||
# 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:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Add any setup steps before running the `github/codeql-action/init` action.
|
||||
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
||||
# or others). This is typically only required for manual builds.
|
||||
# - name: Setup runtime (example)
|
||||
# uses: actions/setup-example@v1
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
# 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.
|
||||
# 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
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
# 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
|
||||
# to set the build mode to "manual" for that language. Then modify this step
|
||||
# to build your code.
|
||||
# ℹ️ 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
|
||||
- if: matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: |
|
||||
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' \
|
||||
'your code, for example:'
|
||||
echo ' make bootstrap'
|
||||
echo ' make release'
|
||||
exit 1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# 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
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
# 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
|
||||
# To enable automatic execution, uncomment the triggers below:
|
||||
on:
|
||||
workflow_call:
|
||||
schedule:
|
||||
- cron: '44 16 * * 6'
|
||||
# push:
|
||||
# branches: [ "master" ]
|
||||
# pull_request:
|
||||
# branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners (GitHub.com only)
|
||||
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
# required for all workflows
|
||||
security-events: write
|
||||
|
||||
# required to fetch internal or private CodeQL packs
|
||||
packages: read
|
||||
|
||||
# only required for workflows in private repositories
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: actions
|
||||
build-mode: none
|
||||
- language: go
|
||||
build-mode: autobuild
|
||||
# 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 'java-kotlin' to analyze code written in Java, Kotlin 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,
|
||||
# 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
|
||||
# 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:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Add any setup steps before running the `github/codeql-action/init` action.
|
||||
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
||||
# or others). This is typically only required for manual builds.
|
||||
# - name: Setup runtime (example)
|
||||
# uses: actions/setup-example@v1
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
# 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.
|
||||
# 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
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
# 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
|
||||
# to set the build mode to "manual" for that language. Then modify this step
|
||||
# to build your code.
|
||||
# ℹ️ 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
|
||||
- if: matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: |
|
||||
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' \
|
||||
'your code, for example:'
|
||||
echo ' make bootstrap'
|
||||
echo ' make release'
|
||||
exit 1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
158
.gitignore
vendored
158
.gitignore
vendored
@ -1,79 +1,79 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/go
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=go
|
||||
|
||||
### Go ###
|
||||
# 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
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/go
|
||||
|
||||
# Shit
|
||||
.github/TODO
|
||||
|
||||
# Local test files
|
||||
output/
|
||||
outputs/
|
||||
articulate-sample.json
|
||||
test-output.*
|
||||
go-os-arch-matrix.csv
|
||||
test_godocx.go
|
||||
test_input.json
|
||||
|
||||
# Build artifacts
|
||||
build/
|
||||
|
||||
# Old workflows
|
||||
.github/workflows/ci-old.yml
|
||||
.github/workflows/ci-enhanced.yml
|
||||
|
||||
# Test coverage files
|
||||
coverage.out
|
||||
coverage.txt
|
||||
coverage.html
|
||||
coverage.*
|
||||
coverage
|
||||
*.cover
|
||||
*.coverprofile
|
||||
main_coverage
|
||||
|
||||
# Other common exclusions
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.test
|
||||
*.out
|
||||
/tmp/
|
||||
.github/copilot-instructions.md
|
||||
|
||||
# Editors
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
.task/
|
||||
|
||||
**/*.local.*
|
||||
|
||||
.claude/
|
||||
|
||||
NUL
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/go
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=go
|
||||
|
||||
### Go ###
|
||||
# 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
|
||||
#
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/go
|
||||
|
||||
# Shit
|
||||
.github/TODO
|
||||
|
||||
# Local test files
|
||||
output/
|
||||
outputs/
|
||||
articulate-sample.json
|
||||
test-output.*
|
||||
go-os-arch-matrix.csv
|
||||
test_godocx.go
|
||||
test_input.json
|
||||
|
||||
# Build artifacts
|
||||
build/
|
||||
|
||||
# Old workflows
|
||||
.github/workflows/ci-old.yml
|
||||
.github/workflows/ci-enhanced.yml
|
||||
|
||||
# Test coverage files
|
||||
coverage.out
|
||||
coverage.txt
|
||||
coverage.html
|
||||
coverage.*
|
||||
coverage
|
||||
*.cover
|
||||
*.coverprofile
|
||||
main_coverage
|
||||
|
||||
# Other common exclusions
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.test
|
||||
*.out
|
||||
/tmp/
|
||||
.github/copilot-instructions.md
|
||||
|
||||
# Editors
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
.task/
|
||||
|
||||
**/*.local.*
|
||||
|
||||
.claude/
|
||||
|
||||
NUL
|
||||
|
||||
@ -4,10 +4,31 @@ repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
# File quality
|
||||
- id: trailing-whitespace
|
||||
exclude: '^\.github/ISSUE_TEMPLATE/.*\.yml$'
|
||||
- id: end-of-file-fixer
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix=lf']
|
||||
|
||||
# File validation
|
||||
- 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-symlinks
|
||||
- id: check-executables-have-shebangs
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v2.6.1
|
||||
hooks:
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
- **Build**: `task build` or `go build -o bin/articulate-parser main.go`
|
||||
- **Run tests**: `task test` or `go test -race -timeout 5m ./...`
|
||||
- **Run single test**: `go test -v -race -run ^TestName$ ./path/to/package`
|
||||
- **Test with coverage**:
|
||||
- `task test:coverage` or
|
||||
- **Test with coverage**:
|
||||
- `task test:coverage` or
|
||||
- `go test -race -coverprofile=coverage/coverage.out -covermode=atomic ./...`
|
||||
- **Lint**: `task lint` (runs vet, fmt check, staticcheck, golangci-lint)
|
||||
- **Format**: `task fmt` or `gofmt -s -w .`
|
||||
|
||||
@ -27,7 +27,7 @@ ARG BUILD_TIME
|
||||
ARG GIT_COMMIT
|
||||
# Docker buildx automatically provides these for multi-platform builds
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
@ -30,7 +30,7 @@ ARG BUILD_TIME
|
||||
ARG GIT_COMMIT
|
||||
# Docker buildx automatically provides these for multi-platform builds
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
18
README.md
18
README.md
@ -20,36 +20,36 @@ A Go-based parser that converts Articulate Rise e-learning content to various fo
|
||||
flowchart TD
|
||||
%% User Input
|
||||
CLI[Command Line Interface<br/>main.go] --> APP{App Service<br/>services/app.go}
|
||||
|
||||
|
||||
%% Core Application Logic
|
||||
APP --> |"ProcessCourseFromURI"| PARSER[Course Parser<br/>services/parser.go]
|
||||
APP --> |"ProcessCourseFromFile"| PARSER
|
||||
APP --> |"exportCourse"| FACTORY[Exporter Factory<br/>exporters/factory.go]
|
||||
|
||||
|
||||
%% Data Sources
|
||||
PARSER --> |"FetchCourse"| API[Articulate Rise API<br/>rise.articulate.com]
|
||||
PARSER --> |"LoadCourseFromFile"| FILE[Local JSON File<br/>*.json]
|
||||
|
||||
|
||||
%% Data Models
|
||||
API --> MODELS[Data Models<br/>models/course.go]
|
||||
FILE --> MODELS
|
||||
MODELS --> |Course, Lesson, Item| APP
|
||||
|
||||
|
||||
%% Export Factory Pattern
|
||||
FACTORY --> |"CreateExporter"| MARKDOWN[Markdown Exporter<br/>exporters/markdown.go]
|
||||
FACTORY --> |"CreateExporter"| HTML[HTML Exporter<br/>exporters/html.go]
|
||||
FACTORY --> |"CreateExporter"| DOCX[DOCX Exporter<br/>exporters/docx.go]
|
||||
|
||||
|
||||
%% HTML Cleaning Service
|
||||
CLEANER[HTML Cleaner<br/>services/html_cleaner.go] --> MARKDOWN
|
||||
CLEANER --> HTML
|
||||
CLEANER --> DOCX
|
||||
|
||||
|
||||
%% Output Files
|
||||
MARKDOWN --> |"Export"| MD_OUT[Markdown Files<br/>*.md]
|
||||
HTML --> |"Export"| HTML_OUT[HTML Files<br/>*.html]
|
||||
DOCX --> |"Export"| DOCX_OUT[Word Documents<br/>*.docx]
|
||||
|
||||
|
||||
%% Interfaces (Contracts)
|
||||
IPARSER[CourseParser Interface<br/>interfaces/parser.go] -.-> PARSER
|
||||
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 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
|
||||
|
||||
|
||||
class CLI userInput
|
||||
class APP,FACTORY coreLogic
|
||||
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
|
||||
- **🏗️ 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
|
||||
- **📤 Export Layer**: Factory pattern for format-specific exporters
|
||||
- **📊 Data Layer**: Domain models representing course structure
|
||||
|
||||
@ -316,13 +316,13 @@ tasks:
|
||||
docker:run:
|
||||
desc: Run Docker container
|
||||
aliases: [dr]
|
||||
deps: [docker:build]
|
||||
deps: ['docker:build']
|
||||
cmds:
|
||||
- docker run --rm {{.APP_NAME}}:{{.VERSION}} --help
|
||||
|
||||
docker:test:
|
||||
desc: Test Docker image
|
||||
deps: [docker:build]
|
||||
deps: ['docker:build']
|
||||
cmds:
|
||||
- docker run --rm {{.APP_NAME}}:{{.VERSION}} --version
|
||||
- echo "Docker image tested successfully"
|
||||
@ -434,7 +434,7 @@ tasks:
|
||||
|
||||
docs:coverage:
|
||||
desc: Open coverage report in browser
|
||||
deps: [test:coverage]
|
||||
deps: ['test:coverage']
|
||||
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}}'
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ import (
|
||||
//go:embed html_styles.css
|
||||
var defaultCSS string
|
||||
|
||||
//go:embed html_template.html
|
||||
//go:embed html_template.gohtml
|
||||
var htmlTemplate string
|
||||
|
||||
// HTMLExporter implements the Exporter interface for HTML format.
|
||||
|
||||
@ -4,9 +4,8 @@ Course description
|
||||
|
||||
## Course Information
|
||||
|
||||
- **Course ID**:
|
||||
- **Course ID**:
|
||||
- **Share ID**: example-id
|
||||
- **Navigation Mode**:
|
||||
- **Navigation Mode**:
|
||||
|
||||
---
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ try {
|
||||
# Show targets and exit if requested
|
||||
if ($ShowTargets) {
|
||||
Write-Host 'Available build targets:' -ForegroundColor Cyan
|
||||
|
||||
|
||||
# Get available platforms and architectures from Go toolchain
|
||||
try {
|
||||
$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
|
||||
$PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() }
|
||||
$ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() }
|
||||
|
||||
|
||||
foreach ($platform in $PlatformList) {
|
||||
foreach ($arch in $ArchList) {
|
||||
$BinaryName = "articulate-parser-$platform-$arch"
|
||||
@ -163,12 +163,12 @@ try {
|
||||
$SelectedTargets = @()
|
||||
$PlatformList = $Platforms.Split(',') | ForEach-Object { $_.Trim() }
|
||||
$ArchList = $Architectures.Split(',') | ForEach-Object { $_.Trim() }
|
||||
|
||||
|
||||
foreach ($target in $GoTargets) {
|
||||
$parts = $target.Split('/')
|
||||
$platform = $parts[0]
|
||||
$arch = $parts[1]
|
||||
|
||||
|
||||
if ($PlatformList -contains $platform -and $ArchList -contains $arch) {
|
||||
$SelectedTargets += @{
|
||||
Platform = $platform
|
||||
@ -177,14 +177,14 @@ try {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Display filtered targets
|
||||
foreach ($target in $SelectedTargets) {
|
||||
$BinaryName = "articulate-parser-$($target.Platform)-$($target.Arch)"
|
||||
if ($target.Platform -eq 'windows') { $BinaryName += '.exe' }
|
||||
Write-Host " $($target.Original) -> $BinaryName" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
|
||||
# Show all available targets if verbose
|
||||
if ($VerboseOutput) {
|
||||
Write-Host "`nAll Go targets available on this system:" -ForegroundColor Cyan
|
||||
@ -404,13 +404,13 @@ try {
|
||||
}
|
||||
$BuildArgs += '-o'
|
||||
$BuildArgs += $Target.Path
|
||||
|
||||
|
||||
# If using custom entry point that's not main.go
|
||||
# we need to use the file explicitly to avoid duplicate declarations
|
||||
$EntryPointPath = Join-Path $ProjectRoot $EntryPoint
|
||||
$EntryPointFile = Split-Path $EntryPointPath -Leaf
|
||||
$IsCustomEntryPoint = ($EntryPointFile -ne 'main.go')
|
||||
|
||||
|
||||
if ($IsCustomEntryPoint) {
|
||||
# When using custom entry point, compile only that file
|
||||
$BuildArgs += $EntryPointPath
|
||||
@ -419,7 +419,7 @@ try {
|
||||
$PackagePath = Split-Path $EntryPointPath -Parent
|
||||
$BuildArgs += $PackagePath
|
||||
}
|
||||
|
||||
|
||||
# For verbose output, show the command that will be executed
|
||||
if ($VerboseOutput) {
|
||||
Write-Host "Command: go $($BuildArgs -join ' ')" -ForegroundColor DarkCyan
|
||||
|
||||
@ -73,7 +73,7 @@ EXAMPLES:
|
||||
DEFAULT TARGETS:
|
||||
Operating Systems: darwin, freebsd, linux, windows
|
||||
Architectures: amd64, arm64
|
||||
|
||||
|
||||
This creates 8 binaries total (4 OS × 2 ARCH)
|
||||
|
||||
GO BUILD FLAGS:
|
||||
|
||||
Reference in New Issue
Block a user