Skip to content

[6.4] Verify Component Independence in CI #81

@adnaan

Description

@adnaan

Description

Ensure CI verifies that components/ remains independently importable - it must not import anything from the parent lvt module. This is created in Issue 4.1 but should be enhanced here.

Depends on: #4.1

Tasks

  • Enhance the independence check from Issue 4.1
  • Add test that imports components from a separate test module
  • Verify components work without any lvt code
  • Add badge showing components independence status
  • Document the independence guarantee for external users

Acceptance Criteria

  • CI prevents lvt imports in components
  • Separate test module can import and use components
  • Clear documentation for external users
  • Badge in README showing independence status

Files to Modify

# .github/workflows/ci.yml (add job)
components-independence:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
    - name: Check for lvt imports
      run: |
        cd components
        if grep -r '"github.com/livetemplate/lvt"' --include="*.go" .; then
          echo "ERROR: components must not import lvt"
          exit 1
        fi
    - name: Build standalone
      run: cd components && go build ./...
    - name: Test standalone
      run: cd components && go test ./...
    - name: Test external import
      run: |
        mkdir -p /tmp/test-import
        cd /tmp/test-import
        go mod init test-import
        echo 'package main
        import "github.com/livetemplate/lvt/components/modal"
        func main() { _ = modal.New("test") }' > main.go
        go mod tidy
        go build .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions