<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zuri Klaschka (they/them)</title>
    <description>The latest articles on DEV Community by Zuri Klaschka (they/them) (@pklaschka).</description>
    <link>https://dev.to/pklaschka</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F534789%2Fce65eb06-c9de-4712-8d0f-d9b223af132c.png</url>
      <title>DEV Community: Zuri Klaschka (they/them)</title>
      <link>https://dev.to/pklaschka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pklaschka"/>
    <language>en</language>
    <item>
      <title>pnpm and Parcel based monorepo</title>
      <dc:creator>Zuri Klaschka (they/them)</dc:creator>
      <pubDate>Sun, 13 Mar 2022 15:57:16 +0000</pubDate>
      <link>https://dev.to/pklaschka/pnpm-and-parcel-based-monorepo-4ojc</link>
      <guid>https://dev.to/pklaschka/pnpm-and-parcel-based-monorepo-4ojc</guid>
      <description>&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;I have tried several ways of managing JavaScript/TypeScript Library Monorepos in the past: &lt;code&gt;lerna&lt;/code&gt;, &lt;code&gt;yarn workspaces&lt;/code&gt;, etc.&lt;/p&gt;

&lt;p&gt;Now don't get me wrong: These are great tools and I very much appreciate the effort their authors have put into them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But they always felt a little bit like gambling.&lt;/strong&gt; It never felt like I was really in control of what was happening (with a lot of black magic), and I found that they felt a bit ... fragile (I was alsways worried about breaking some symlinks or stuff like that when running any commands).&lt;/p&gt;

&lt;h2&gt;
  
  
  A solution?
&lt;/h2&gt;

&lt;p&gt;I wanted to try both &lt;a href="https://pnpm.io/" rel="noopener noreferrer"&gt;&lt;code&gt;pnpm&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://parceljs.org/" rel="noopener noreferrer"&gt;Parcel&lt;/a&gt;. I had heard good things about both tools and have recently gotten more and more frustrated with their more established competitors.&lt;/p&gt;

&lt;p&gt;When I looked at their respective documentation pages, it looked like both had great monorepo support. Since I was also still on a long-lasting search for some "building an npm library"-compatible monorepo solution with a better developer experience than what I had seen so far, I decided to give it a shot.&lt;/p&gt;

&lt;h2&gt;
  
  
  The repository
&lt;/h2&gt;

&lt;p&gt;So, I built (and documented) a test repository to try this new monorepo setup:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/pklaschka" rel="noopener noreferrer"&gt;
        pklaschka
      &lt;/a&gt; / &lt;a href="https://github.com/pklaschka/pnpm-parcel-monorepo-test" rel="noopener noreferrer"&gt;
        pnpm-parcel-monorepo-test
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A repository for trying a JS/TS npm library monorepo setup using pnpm as package manager and parcel as a build tool.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;
&lt;code&gt;pnpm&lt;/code&gt; &amp;amp; &lt;code&gt;parcel&lt;/code&gt; monorepo test&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;A repository for trying a JS/TS npm library monorepo setup using &lt;code&gt;pnpm&lt;/code&gt; as package manager and &lt;code&gt;parcel&lt;/code&gt; as a build tool.&lt;/p&gt;
&lt;p&gt;Development prerequisites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/download/" rel="nofollow noopener noreferrer"&gt;Node v16+&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pnpm.io/installation" rel="nofollow noopener noreferrer"&gt;pnpm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Tech Stack&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;This is an overview of the most important components of this monorepo's tech stack&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://pnpm.io/" rel="nofollow noopener noreferrer"&gt;pnpm&lt;/a&gt;&lt;/strong&gt; -- package and monorepo workspace manager&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://parceljs.org/" rel="nofollow noopener noreferrer"&gt;Parcel&lt;/a&gt;&lt;/strong&gt; -- build tool&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://jestjs.io/" rel="nofollow noopener noreferrer"&gt;Jest&lt;/a&gt; / &lt;a href="https://kulshekhar.github.io/ts-jest/" rel="nofollow noopener noreferrer"&gt;&lt;code&gt;ts-jest&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; -- Unit testing framework&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.typescriptlang.org/" rel="nofollow noopener noreferrer"&gt;TypeScript / &lt;code&gt;tsc&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; -- TypeScript type checking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://typescript-eslint.io/docs/linting/" rel="nofollow noopener noreferrer"&gt;TypeScript ESLint&lt;/a&gt;&lt;/strong&gt; -- linting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://prettier.io/" rel="nofollow noopener noreferrer"&gt;Prettier&lt;/a&gt;&lt;/strong&gt; -- code formatter&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://fliegwerk.github.io/fliegdoc/" rel="nofollow noopener noreferrer"&gt;fliegdoc&lt;/a&gt;&lt;/strong&gt; -- documentation generator&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://docs.github.com/en/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt;&lt;/strong&gt; -- CI pipeline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://renovatebot.com/" rel="nofollow noopener noreferrer"&gt;Renovate&lt;/a&gt;&lt;/strong&gt; -- Dependency Update Management&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Setting up the development environment&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Install the dependencies:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;pnpm install&lt;/pre&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;automatically runs recursively for the workspace, cf. &lt;a href="https://pnpm.io/cli/install" rel="nofollow noopener noreferrer"&gt;https://pnpm.io/cli/install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Alias: &lt;code&gt;pnpm i&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm ci&lt;/code&gt;-equivalent: &lt;code&gt;pnpm i --frozen-lockfile&lt;/code&gt; (automatically true in CI environment)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;You can also run &lt;code&gt;pnpm install&lt;/code&gt; when anything about your dependencies becomes out of date to fix it back up.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Dependency Management&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Installing&lt;/h4&gt;…&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/pklaschka/pnpm-parcel-monorepo-test" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The repository contains a test setup with a more or less full tech stack consisting of, among others:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;ESLint&lt;/li&gt;
&lt;li&gt;Prettier&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/fliegwerk/and-so-i-wrote-my-own-typescript-documentation-generator-2l2f"&gt;fliegdoc&lt;/a&gt; (a self-built documentation generator)&lt;/li&gt;
&lt;li&gt;jest / ts-jest&lt;/li&gt;
&lt;li&gt;GitHub Actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I described most things in the &lt;code&gt;README.md&lt;/code&gt;, but I also created an additional &lt;a href="https://pklaschka.notion.site/Building-and-Publishing-d444abcb209748ec9cea13b9da59bad5#96ee0ded13d54d3eacd18e02de43509f" rel="noopener noreferrer"&gt;public Notion page&lt;/a&gt; describing more details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;I'm really happy with how it works and will definitely use this approach in the future.&lt;/strong&gt; I'll also probably migrate existing monorepos to this approach, in the future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🟢 &lt;strong&gt;you feel like you're in control&lt;/strong&gt; with &lt;code&gt;pnpm&lt;/code&gt;, it's pretty straight-forward to understand how their workspace system works, so you feel like you're in control and don't have to guess about fixes to your problems 🎉. E.g., &lt;code&gt;pnpm install&lt;/code&gt; sets up everything. Before, I always was unsure if I should now run &lt;code&gt;npm install&lt;/code&gt;, &lt;code&gt;lerna bootstrap&lt;/code&gt;, or something else.&lt;/li&gt;
&lt;li&gt;🟢 &lt;strong&gt;quick build times&lt;/strong&gt; since &lt;code&gt;parcel&lt;/code&gt; &lt;a href="https://pklaschka.notion.site/Building-and-Publishing-d444abcb209748ec9cea13b9da59bad5#96ee0ded13d54d3eacd18e02de43509f" rel="noopener noreferrer"&gt;builds all the packages at once&lt;/a&gt; (instead of running build scripts one package at a time), build times (especially with the build cache in place) are incredibly fast&lt;/li&gt;
&lt;li&gt;🟢 &lt;strong&gt;development experience&lt;/strong&gt; with &lt;code&gt;parcel watch&lt;/code&gt;, it's possible to very quickly develop&lt;/li&gt;
&lt;li&gt;🟢 &lt;strong&gt;"native" workspaces&lt;/strong&gt; working with workspaces / multiple packages feels "native" to &lt;code&gt;pnpm&lt;/code&gt; (compared to its competitors, where I unfortunately found that it feels more like a "hacky side feature"). Commands work how I would expect them to work, "internal" dependencies betweeen packages &lt;a href="https://pnpm.io/workspaces#publishing-workspace-packages" rel="noopener noreferrer"&gt;automatically get hydrated with version numbers on publish&lt;/a&gt;, and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Drawbacks
&lt;/h3&gt;

&lt;p&gt;Of course, every approach comes with a few drawbacks. Here are the ones I've found so far:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🟡 &lt;strong&gt;less ecosystem support&lt;/strong&gt; while &lt;code&gt;pnpm&lt;/code&gt; and &lt;code&gt;parcel&lt;/code&gt; work great in 99 % of cases, tools often don't test their support for these as much as, for example, for &lt;code&gt;yarn&lt;/code&gt; and &lt;code&gt;webpack&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;🟢 &lt;strong&gt;(no Dependabot support)&lt;/strong&gt; at the time of writing this, GitHub's &lt;em&gt;Dependabot&lt;/em&gt; doesn't support &lt;code&gt;pnpm&lt;/code&gt;. Thankfully, &lt;a href="https://docs.renovatebot.com/" rel="noopener noreferrer"&gt;Renovate&lt;/a&gt; seems to work well.&lt;/li&gt;
&lt;li&gt;🟢 &lt;strong&gt;(no included "release automation" tooling)&lt;/strong&gt; &lt;code&gt;lerna&lt;/code&gt; came with great Changelog / Conventional Commit / ... based release automation tooling. Unfortunately, I haven't yet found a great solution for doing something similar with &lt;code&gt;pnpm&lt;/code&gt;. &lt;em&gt;Do you have any recommendations?&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A quick fix for a Parcel bug that almost made me dismiss it
&lt;/h3&gt;

&lt;p&gt;When I initially tested Parcel, it felt unstable. It wouldn't shut down, would from time to time just overwrite my &lt;code&gt;package.json&lt;/code&gt;, and just overall not work very well at all.&lt;/p&gt;

&lt;p&gt;I was almost ready to give up when I found &lt;a href="https://github.com/parcel-bundler/parcel/issues/7271" rel="noopener noreferrer"&gt;this issue on GitHub&lt;/a&gt;. It turns out that I had a &lt;code&gt;package-lock.json&lt;/code&gt; somewhere higher up the file tree (probably some backup I had created before). This lead to Parcel showing all kinds of weird behavior (not only the one described in the issue). So if you decide to try this approach and feel like Parcel is "freaking out" in a weird way, it might be worth checking for &lt;code&gt;package.json&lt;/code&gt;, &lt;code&gt;packaage-lock.json&lt;/code&gt; or similar files higher up in the file tree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So overall, this is easy to fix. But this almost made me (which would have been a shame!) turn away from Parcel, so I wanted to include this note here.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Even more details
&lt;/h3&gt;

&lt;p&gt;Furthermore, I've documented everything I learned about the process / how the repo is structured in a &lt;a href="https://pklaschka.notion.site/pnpm-and-parcel-for-monorepos-56107d7839594eec8ef5b6d0e9abcb1c" rel="noopener noreferrer"&gt;Notion Page&lt;/a&gt;. If you decide to try this monorepo configuration, this could be useful to you as it includes all the commands you need to know, links to various important resources, and so on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Author
&lt;/h2&gt;


&lt;div class="ltag__user ltag__user__id__534789"&gt;
    &lt;a href="/pklaschka" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F534789%2Fce65eb06-c9de-4712-8d0f-d9b223af132c.png" alt="pklaschka image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/pklaschka"&gt;Zuri Klaschka (they/them)&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/pklaschka"&gt;Working Student, Creative Cloud Platform and Ecosystem Team @ Adobe; I do many things. Among them developing websites and plugins for Adobe products, primarily Adobe XD. Viva la Open-Source!&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>monorepo</category>
      <category>parcel</category>
      <category>pnpm</category>
    </item>
    <item>
      <title>And so, I wrote my own Typescript Documentation Generator...</title>
      <dc:creator>Zuri Klaschka (they/them)</dc:creator>
      <pubDate>Fri, 08 Jan 2021 00:57:24 +0000</pubDate>
      <link>https://dev.to/fliegwerk/and-so-i-wrote-my-own-typescript-documentation-generator-2l2f</link>
      <guid>https://dev.to/fliegwerk/and-so-i-wrote-my-own-typescript-documentation-generator-2l2f</guid>
      <description>&lt;p&gt;TL;DR: For a project &lt;a href="https://github.com/fussel178" rel="noopener noreferrer"&gt;fussel178&lt;/a&gt; and I (&lt;a href="https://github.com/pklaschka" rel="noopener noreferrer"&gt;pklaschka&lt;/a&gt;) were working on, we needed a documentation generator for a Typescript Monorepo. &lt;/p&gt;

&lt;h2&gt;
  
  
  The "Status Quo"
&lt;/h2&gt;

&lt;p&gt;While the existing solution, TypeDoc, is a great tool, it didn't really fit our needs, and documentation on how to customize the output isn't easy to come by. Don't get me wrong: It's a great project that does a lot more than my own solution, but it simply didn't fit our project's needs. Still, for many projects, it works great, and I can highly recommend checking it out:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/TypeStrong" rel="noopener noreferrer"&gt;
        TypeStrong
      &lt;/a&gt; / &lt;a href="https://github.com/TypeStrong/typedoc" rel="noopener noreferrer"&gt;
        typedoc
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Documentation generator for TypeScript projects.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  So... let's build it ourselves 😜
&lt;/h2&gt;

&lt;p&gt;After spending a day searching for alternatives (unsuccessfully), I decided to "just" build my own solution. And thus, &lt;em&gt;fliegdoc&lt;/em&gt; found its beginning 😉&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/fliegwerk" rel="noopener noreferrer"&gt;
        fliegwerk
      &lt;/a&gt; / &lt;a href="https://github.com/fliegwerk/fliegdoc" rel="noopener noreferrer"&gt;
        fliegdoc
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A documentation generator for Typescript-based libraries with good support for monorepos
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Welcome to fliegdoc 👋&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/fliegdoc" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/d3eb5922c1812c297183dcca332a92ed8bb663808a97fa7ae511ab3cf97ba06c/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f666c696567646f63" alt="Version"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/2fe1060a10150faafd35e6622ae201ec31572e7109b29557bde323702729715a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334531322e302e302d626c75652e737667"&gt;&lt;img src="https://camo.githubusercontent.com/2fe1060a10150faafd35e6622ae201ec31572e7109b29557bde323702729715a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334531322e302e302d626c75652e737667" alt="Prerequisite"&gt;&lt;/a&gt;
&lt;a href="https://fliegwerk.github.io/fliegdoc" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5391604d1e8f886512ab4eeeb3922f4d58a8fac27454e641b1b39c65f51c4d6b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d7965732d627269676874677265656e2e737667" alt="Documentation"&gt;&lt;/a&gt;
&lt;a href="https://github.com/fliegwerk/fliegdoc/graphs/commit-activity" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5ca62441414bacaa54c6c6e5b68e46c76305947b6bf498c4949fc71c1b4b10dd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d61696e7461696e65642533462d7965732d677265656e2e737667" alt="Maintenance"&gt;&lt;/a&gt;
&lt;a href="https://github.com/fliegwerk/fliegdoc/blob/master/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/0fd0273045442d89a46d334dde5318fd65b132108ad41b6d43e756d63723c092/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f666c6965677765726b2f666c696567646f63" alt="License: MIT"&gt;&lt;/a&gt;
&lt;a href="https://twitter.com/pklaschka2000" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/56d466efee6025840dde24a414d48c3643b52def17c724e9b64824f95b288f0b/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f706b6c617363686b61323030302e7376673f7374796c653d736f6369616c" alt="Twitter: pklaschka2000"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A documentation generator for Typescript-based libraries with good support for monorepos&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;🏠 &lt;a href="https://fliegwerk.github.io/fliegdoc" rel="nofollow noopener noreferrer"&gt;Homepage, Demo &amp;amp; Docs&lt;/a&gt;
&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Prerequisites&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;node &amp;gt;12.0.0&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Install&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;npm install --global fliegdoc&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;CLI&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;$ fliegdoc --help
Usage: fliegdoc [command] [options]

Commands:
  fliegdoc build [options]  Build the documentation       [default] [aliases: b]
  fliegdoc serve [options]  Preview the documentation &lt;span class="pl-k"&gt;in&lt;/span&gt; the browser[aliases: s]
  fliegdoc completion       generate completion script

Options:
      --help     Show &lt;span class="pl-c1"&gt;help&lt;/span&gt;                                             [boolean]
  -s, --serve    Serve the static files after build   [boolean] [default: false]
  -p, --port     The port on which the documentation gets hosted        [number]
  -v, --version  Show version number                                   [boolean]

Get &lt;span class="pl-c1"&gt;help&lt;/span&gt; &lt;span class="pl-k"&gt;for&lt;/span&gt; individual commands by running fliegdoc &lt;span class="pl-k"&gt;&amp;lt;&lt;/span&gt;command&lt;span class="pl-k"&gt;&amp;gt;&lt;/span&gt; --help&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The CLI searches for a &lt;code&gt;fliegdoc.config.js&lt;/code&gt; file and applies its options &lt;strong&gt;on top of the default options&lt;/strong&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Example &lt;code&gt;fliegdoc.config.js&lt;/code&gt; with default options&lt;/h4&gt;

&lt;/div&gt;
&lt;div class="highlight highlight-source-js notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;// fliegdoc.config.js&lt;/span&gt;
&lt;span class="pl-k"&gt;const&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt; HTMLTheme &lt;span class="pl-kos"&gt;}&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-en"&gt;require&lt;/span&gt;&lt;span class="pl-kos"&gt;(&lt;/span&gt;&lt;span class="pl-s"&gt;'fliegdoc'&lt;/span&gt;&lt;span class="pl-kos"&gt;)&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
&lt;span class="pl-smi"&gt;module&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-c1"&gt;exports&lt;/span&gt; &lt;span class="pl-c1"&gt;=&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-c1"&gt;baseUrl&lt;/span&gt;: &lt;span class="pl-s"&gt;'/'&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/fliegwerk/fliegdoc" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  What &lt;em&gt;fliegdoc&lt;/em&gt; is
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;fliegdoc&lt;/em&gt; documents only the exported members (!) of a TypeScript library, i.e., one or more (in the case of a monorepo) npm packages.&lt;/p&gt;

&lt;p&gt;It first converts the source file's AST to a kind of "documentation-ready" AST, which then gets passed to a theme, converting it to HTML (but, if the theme gets adjusted, also any other format).&lt;/p&gt;

&lt;p&gt;The generated web page then includes the project's root &lt;code&gt;README.md&lt;/code&gt;, and the API References for the project's modules, i.e., packages.&lt;/p&gt;

&lt;p&gt;Therefore, it can very easily be used to document mono-repo structures, including more than one package.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;p&gt;Since the project's exposed APIs themselves are documented using the project itself, you can visit the &lt;a href="https://fliegwerk.github.io/fliegdoc/" rel="noopener noreferrer"&gt;project documentation&lt;/a&gt; to see the generated results.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use it
&lt;/h3&gt;

&lt;p&gt;Let's consider a Lerna-based monorepo with (for simplicity) two packages, resulting in a folder structure that looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── packages/
│   ├── package-1/
│   │   ├── src/
│   │   │   └── main.ts
│   │   ├── package.json
│   │   └── tsconfig.json
│   └── package-2/
│       ├── src/
│       │   └── main.ts
│       ├── package.json
│       └── tsconfig.json
├── package.json
├── lerna.json
├── README.md
└── tsconfig.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Since &lt;em&gt;fliegdoc&lt;/em&gt; generates the documentation for the entire repository, we add &lt;code&gt;fliegdoc&lt;/code&gt; as a &lt;code&gt;devDependency&lt;/code&gt; of the root &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm i &lt;span class="nt"&gt;-D&lt;/span&gt; fliegdoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Next, we add two scripts in our root &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"docs:build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fliegdoc build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"docs:serve"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fliegdoc serve"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If our repository followed an easy structure, with just one root &lt;code&gt;tsconfig.json&lt;/code&gt;, &lt;code&gt;package.json&lt;/code&gt;, &lt;code&gt;README.md&lt;/code&gt;, and a &lt;code&gt;main.ts&lt;/code&gt; in a root &lt;code&gt;src&lt;/code&gt; folder, that all we'd need to do. However, we are within a monorepo that ... makes things a bit more complicated.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Things should be made as simple as possible but not any simpler" (Albert Einstein)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To configure &lt;em&gt;fliegdoc&lt;/em&gt; to work with this repo structure, we create a &lt;code&gt;fliegdoc.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;modules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;package&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./packages/package-1/package.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;tsconfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./packages/package-1/tsconfig.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;mainFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;main.ts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;package&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./packages/package-2/package.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;tsconfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./packages/package-2/tsconfig.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;mainFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;main.ts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;While we &lt;em&gt;could&lt;/em&gt; configure many other parameters, we can already successfully generate the documentation for the repo with this config.&lt;/p&gt;

&lt;p&gt;
  Further configuration options
  &lt;br&gt;
Among others, see &lt;a href="https://fliegwerk.github.io/fliegdoc/fliegdoc/#FliegdocConfig" rel="noopener noreferrer"&gt;https://fliegwerk.github.io/fliegdoc/fliegdoc/#FliegdocConfig&lt;/a&gt; for a full reference:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;readme = './README.md'&lt;/code&gt;: The path to the repo's &lt;code&gt;README.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;outDir = './docs'&lt;/code&gt;: The directory into which the docs get generated&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;baseUrl = '/'&lt;/code&gt;: the root URL of the documentation. Useful when you want to deploy your projects to subdirectories on your server, e.g., on GitHub pages (where &lt;code&gt;/[repo-name]/&lt;/code&gt; gets prefixed to the URL, compared to &lt;code&gt;/&lt;/code&gt;).
&lt;/li&gt;
&lt;/ul&gt;




&lt;/p&gt;
&lt;p&gt;We can now run&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npm run docs:serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;fliegdoc&lt;/em&gt;, when running &lt;code&gt;fliegdoc serve&lt;/code&gt;, does a few things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read the config and apply its overrides to the default configuration&lt;/li&gt;
&lt;li&gt;Go through the modules specified in the config and parse the exported members of their &lt;code&gt;mainFile&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Build a "documentation-ready syntax tree", consisting only of abstracted elements interesting for the docs, from the parsed AST&lt;/li&gt;
&lt;li&gt;Serve a site that consists of pages for

&lt;ul&gt;
&lt;li&gt;the project's &lt;code&gt;README.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;API references for the &lt;code&gt;modules&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When instead of &lt;code&gt;docs:serve&lt;/code&gt;, we run the &lt;code&gt;docs:build&lt;/code&gt; script, the only difference will be that in step (4.), the site won't just be served on an HTTP server, but instead, the HTML files get built and outputted to a folder &lt;code&gt;./docs&lt;/code&gt;, which then can get deployed to, e.g., GitHub Pages, Netlify, or a "classic" web server.&lt;/p&gt;
&lt;h2&gt;
  
  
  What &lt;em&gt;fliegdoc&lt;/em&gt; isn't
&lt;/h2&gt;

&lt;p&gt;It isn't an "all-around" documentation generator for Typescript. It specializes heavily (!) in documenting package modules and has a focus on being easy to understand (the "basic" project was developed in only one day).&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While the project is still in a rather early stage of development, and documentation is, right now, WIP (the irony 🤣), it already serves its purpose in multiple of my own projects, without problems.&lt;/p&gt;

&lt;p&gt;Perhaps, its use-case also fits your project, in which case, please feel free to share any feature requests should you decide to use it.&lt;/p&gt;

&lt;p&gt;It was certainly interesting to dive a bit deeper into the ASTs and other "lower-level" Typescript things apart from everything else.&lt;/p&gt;
&lt;h2&gt;
  
  
  Author
&lt;/h2&gt;


&lt;div class="ltag__user ltag__user__id__534789"&gt;
    &lt;a href="/pklaschka" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F534789%2Fce65eb06-c9de-4712-8d0f-d9b223af132c.png" alt="pklaschka image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/pklaschka"&gt;Zuri Klaschka (they/them)&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/pklaschka"&gt;Working Student, Creative Cloud Platform and Ecosystem Team @ Adobe; I do many things. Among them developing websites and plugins for Adobe products, primarily Adobe XD. Viva la Open-Source!&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Pablo Klaschka is the first chairman and co-founder of fliegwerk, a group of students developing Open-Source projects.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>node</category>
      <category>documentation</category>
      <category>news</category>
    </item>
  </channel>
</rss>
