Skip to content

Phase 3: Token replacement service #5

Description

@markdav-is

Summary

Implement ITokenReplacementService to replace Oqtane tokens in file contents and file/directory names.

Depends On

  • Phase 2: Template Discovery (needs TemplateManifest model)

Tasks

  • Implement ITokenReplacementService / TokenReplacementService:
    • GenerateTokens(ModuleOptions options)Dictionary<string, string>
    • ReplaceTokens(string content, Dictionary<string, string> tokens) → string
    • ReplaceTokensInPath(string path, Dictionary<string, string> tokens) → string
  • Support all standard Oqtane tokens:
    Token Replacement
    [Owner] Owner name (e.g., MarkDav)
    [Module] Module name (e.g., WeatherArbitrage)
    [Description] Module description
    [Guid] New GUID — unique per occurrence
    [Year] Current year (e.g., 2026)
    [Date] Current date (e.g., 2026-02-12)
    [Framework] Target framework (e.g., net10.0)
  • Ensure [Guid] generates a distinct GUID each time it appears (not one GUID reused everywhere)
  • Handle token replacement in both file contents and file/directory paths

Acceptance Criteria

  • Unit tests pass for all token types
  • Multiple [Guid] tokens in the same file produce different GUIDs
  • Tokens in file paths are replaced (e.g., [Owner].[Module].Client/MarkDav.WeatherArbitrage.Client/)
  • Content with no tokens passes through unchanged

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