bluethen on `BlogPost.get("primate-39"), you're gonna get { html, toc, path, body, frontmatter }
bluethe only tricky part is to have this operation loads from the fs in dev, and from memory, as part of the bundle, in prod
blueload*
bluebut markdowndb is the key to unlock full cms capabilities
phalethblue: hi
phalethcan you check the last PR on primate repo?
phalethI'm looking for a post-build handler or something like that
phaleth*latest PR
phalethwhy is it called db if it's not overridable?
blueI'll check it phaleth
bluewhat do you mean with no overridable?
bluenot(
bluenot*
phalethmarkdown files are static I guess
bluethe problem is we want different behaviour during dev and prod. in dev it's acceptable to load / transform the mds on the fly, in prod it isn't
blueplus, primate/website has different addons like transforming snippets which makes everything more complicated
blueI wish I had a good solution for it, I currently don't
phalethso the db is like a cache for md files?
phalethmight was well just transform them to html and let the site be static
phalethbtw, the PR I opened is getting towards that, just need to figure out a build step, I could slap something together after build, but I'm wondering if there is something primate specific
bluethere is `app.done`. I don't like it, but you can use it
blueit's not bad right now because it's all precompiled in memory
phalethif the website gets busy then you can bother yourself with that, but then SSG and running the site on nginx would solve all those problems
phalethyeah, and memory is fast
blueyes but @primate/markdown is just for apps/website, I'm trying to rethink it as a general cms-like solution
blueisn't just*
phalethdid you see the response time? :)
phaleththere is not much to gain
blue9 ms?
phalethyeah, deno is kinda slow, but still acceptable
blueno let's optimise it to 0.5 ms </sumner>
phalethheh, then that means it's nginx
blueyeah I was joking, 9 ms is totally acceptable for now
blueso my point is
blueapps/website is actually not the issue here. it'll get --target=static and be happy with its htmls. especially with your colourscheme work
bluethe issue here are other apps. I have this small apps where I keep notes, like obsidian, and the 'load from fs' is fully acceptable for it at least in dev mode
bluesmall app*
blueso essentially this is a caching problem
blueyou don't want to run the expensive md > html pipeline on every request
blueyou ideally only want to run it when the source has changed
bluefor the fs, you could do a small `stats` check I suppose and compare against what you last saw
phalethok, so then it's a store, it's not a db
blueyes it is a store, it'll be exposed as markdown.store
blueand you'll have programmatic access to the frontmatter and also partitioning
blue@primate/markdown.store becomes the new way to use markdown, and --target=static is how we solve the caching problem for apps/website
blueI still don't know how to tell --target=static though how it should generate pages based on a parameterised route
bluebut yeah, all of this still doesn't solve my major conundrum during dev which is that apps/website takes way too long to start up, and recreate the bundle
phalethyeah, primate website takes a while to startup in dev mode
bluemaybe, markdown.store runs all the pipeline on startup (or if you don't care, you can pass in lazy: true).
bluein dev mode I'd generally go lazy, I think
blueand the website would start up immediately
blueso every docs page is converted on the fly, and then cached until stats has changed
blueand in production, --target=static takes over, so laziness isn't relevant, everything gets produced during build
bluemaybe I don't even need lazy: true and it's always lazy, and always cached
blueI think this is a good compromise
bluebut this requires markdown stores and --target=static to arrive in the same commit
blueotherwise we can't meaningfully deploy the website, it'll be slow on first requests and you'd need to copy .md files and the snippets directly and what not
phalethcool, looking forward to static target
blueya
phalethI have a FileRef to a text file, now I need to replace contents inside the file behind the FileRef, how to do that with rcompat?
phalethnpm install replace
phalethomg
phalethwrite method exists
blueyes
blueif it's an object you want to write you also have writeJSON
bluethat will write it out as a JSON string you can later load with #json
phalethit's a JS file
phalethplain text
bluecool, then just #write
phalethwrite works, I just don't know how to read the file