🚀 Harness AI to execute your million-dollar ideas 10x faster, with 1/10th the effort.Get Started

Refactoring Script for Copying Notes to use EffectTS

7/5/2024

Refactoring

This is a post I'm working on about refactoring in general. I want to walk through a refactor, describe how I used MermaidJS and learn EffectTS.

I want to refactor my script for copying my Obsidian notes to content git repo to use EffectTS.

Here's a diagram of the flow written in MermaidJS.

flowchart TD
    AA[/"`Input path to file directory`"/]-->B(("`Start`"))
    AB[/Write directory path/]-->B
    B-->C[Get Directory Contents]
    C-->CD[(Files and folders)]
    CD-->CB[Iterate Directory Contents]
    EB-->C
    
    subgraph Iterate Directory Contents
        CA{Another item?}-->|Yes|D{"`File or Folder?`"} 
        D-->|File|EA{"`Is .md || .mdx?`"}
        D-->|Folder|EB["`Recursive call`"]
        EA-->|Yes|FA["`Read file`"]
        EA-->|No|CA
        FA-->G[Parse Frontmatter]
        G-->H{"`Has **published** status?`"}
        H-->|Yes|IA[Process Metadata]
        H-->|No|CA
        IA-->J[Handle Embedded Images]
        J-->K[Generate Slug]
        K-->M[(Write Processed File)]
    end

CA-->|No|BB
    M-->BB((End))

This Article is Still in Progress

This post is a work in progress and not yet complete. If you're interested in reading the full article, let me know!

Want to Read It? Your interest helps me prioritize which articles to finish first. Click below to tell me you want to read this article when it's complete.

Chase Adams