Skip to content

Phase 4: File generation from templates #6

Description

@markdav-is

Summary

Implement IFileService to create the module directory structure and copy/process template files with token replacement.

Depends On

  • Phase 3: Token Replacement Service
  • Phase 2: Template Discovery

Tasks

  • Implement IFileService / FileService:
    • ModuleExists(string solutionDir, string owner, string moduleName) → bool
    • CreateModuleStructure(string targetDir, TemplateManifest manifest, Dictionary<string, string> tokens) → void
    • DeleteModule(string targetDir, string owner, string moduleName) — for --force overwrite
  • For each file in the template manifest:
    1. Read source template file
    2. Apply token replacement to file contents
    3. Apply token replacement to target file path
    4. Create target directories as needed
    5. Write processed file to target location
  • Handle --force flag: delete existing module directories before creating
  • Skip binary files (don't apply token replacement to non-text files)

Acceptance Criteria

  • Running module create with a real Oqtane template produces the correct file tree:
    MarkDav.WeatherArbitrage.Client/
    MarkDav.WeatherArbitrage.Server/
    MarkDav.WeatherArbitrage.Shared/
    
  • All [Owner], [Module], etc. tokens are replaced in file contents
  • File and directory names have tokens replaced
  • --force removes existing module before recreating
  • Error when module exists and --force is not set

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions