dhow icon indicating copy to clipboard operation
dhow copied to clipboard

Rewrite `dhow`

Open fs-c opened this issue 4 years ago • 7 comments

Closes #12 Closes #9 Also related to #11


Stuff that's still TODO:

  • ~~fully implement CLI (I'd like to propose some breaking changes in this regard though, but that's best discussed in the original issue)~~
  • ~~related to the above: don't expect the input directory to contain a pages directory, expect the input directory to be the pages directory~~
  • update the README (although this probably warrants some discussion as well)
  • ~~build fully in-memory (although it might be a good idea to have that be a separate PR, to be worked on once this is landed)~~ doesn't look like this is feasible at the moment
  • remove obsolete packages

fs-c avatar Mar 15 '21 16:03 fs-c

Potentially breaking change in the current code, dhow dev now builds to .dhow instead of __dhow__, which is how it should be (prefixed dot usually literally hides the folder, wrapping underscores visually highlight -- we don't want the latter).

Also introduced --input and --output to replace --indir and --outdir mostly because I really didn't want to write indir in my code. I don't care about reverting it, I just don't want to ever look at cli.ts again afterwards.

I also implemented a logger since I don't like spinners. Feel free to revert that, I don't mind. Reminds me of Next.js though, which is usually not a bad thing.

Did some testing in regards to the in-memory builds, I think they will work but I don't have the time at the moment.

fs-c avatar Mar 18 '21 21:03 fs-c

Scratch --input and --output, not worth making this refactor breaking. I wouldn't consider __dhow__ -> .dhow to be breaking since it's undocumented behavior (I think) so I still stand by that.

fs-c avatar Mar 19 '21 19:03 fs-c

Tried running a few of the examples & committed a few bug fixes. I'm unable to debug the tailwind example though. For some reason, it says build successful but writes no HTML files. Any ideas on what could be causing this?

kartiknair avatar Mar 20 '21 17:03 kartiknair

Where did you commit those bug fixes to?

Also I should note that I have a lot of uncommitted changes right now, I anticipate a big commit in the next couple of days. This should include incremental builds and caching in the build function for dhow dev (this is really big for me, as a tailwind user) and a slew of bugfixes. I don't have any issues with any of the examples at the moment, on my local version.

fs-c avatar Mar 21 '21 22:03 fs-c

Also, in regards to in-memory builds: they seem largely impossible at the moment (without requiring our users to opt into experimental NodeJS modules and forcing .mjs) so I've stopped pursuing them. If you want to give it a shot let me know and I'll post more info.

fs-c avatar Mar 21 '21 22:03 fs-c

This is a big one. I almost regret splitting build.js into two files because seeing the changes is harder now. But there's certainly a shit ton of new logic and I really don't look forward to writing tests for all of that -- but I will absolutely have to because I am certain this is full of bugs and corner cases that I missed. Working on the cache next.

I'm doing all this because I use tailwind, and I got tired of waiting for >10s every build just because PostCSS is slow, even though I didn't even touch a .css file. So yeah, that's how I ended up here. Next up is caching because I don't want to wait >10s when re-running dhow dev even though I didn't touch the .css. This stuff also has the nice side effect of minimizing the amount of getProps and getPaths re-runs, which I was previously concerned about in case I ever throw API calls in there that might be subject to rate limiting.

fs-c avatar Mar 21 '21 22:03 fs-c

Quick ping to prevent any surprises: The rewrite branch of the fork is now on npm under @fsoc/dhow. Let me know if you want to get the merge on track.

fs-c avatar Jul 30 '21 20:07 fs-c