Submit

Back to the channels

#primate

  1. * phaleth joined #primate
  2. blue phaleth: yesteday the primate web machine automatically redeployed
  3. blue is that configured somewhere?
  4. blue also hi
  5. blue also, we need to change the deployment branch to 0.38, I accidently floated the unready 0.39 post
  6. blue I edited the Container image with --branch=0.38 on the git clone, but that did nothing
  7. phaleth hi blue
  8. phaleth no, I did the redeployment last evening
  9. blue oh ok, that makes sense
  10. phaleth I'm trying deno for the primate website
  11. blue I took out the 0.39 post for now so we don't need to change the branch, although technically speaking the docs contain some changes
  12. blue I hope that by 0.39, it'll be all managed by repopack so I could quickly change that, and I do prefer we stay on tsgo for now
  13. blue I mean by 0.40*
  14. phaleth yeah, we should stay on tsgo
  15. phaleth do you know if this error https://upaste.de/raw/TbM comes from rcompat are would you be able to fix it?
  16. blue generally speaking until I "branch", I prefer the website to be on master, but after branching and concentrating on breaking stuff, I usually have the website point to the latest version
  17. blue so that should be easy with RP
  18. blue let me look
  19. blue hm, that feels like deno not recognising that as a node import
  20. blue should be "node:http", strictly speaking
  21. blue could you paste line 117 here?
  22. phaleth yeah, but it's an uglified code
  23. phaleth deno does not seems to like pnpm
  24. blue yeah. though there is `deno install`, fwiw
  25. phaleth so there is a lot on that one line https://upaste.de/raw/AiH
  26. blue it's just deno is notoriously bad with symlinks and monorepos
  27. phaleth ok, but does deno install work with all those dependencies that have ^workspace as a version in package.json?
  28. blue no
  29. blue await (Wo(a) ? import("https") : import("http"))
  30. blue this seems wrong, it shouldn't end up in the deno bundle
  31. phaleth that's where the error comes from yes
  32. phaleth it's not deno bundling it, it's pnpm
  33. phaleth I'm just trying to run it with deno
  34. blue oh. yes, that has slim changes of working
  35. blue pnpm will bundle it for node
  36. blue you know, maybe we should enable cross-building
  37. blue npx primate build --target=deno
  38. blue that's what you're looking for, right?
  39. phaleth I have no idea, is that a thing?
  40. blue let me show you
  41. phaleth the thing is there are these ^workspace deps in package json
  42. blue https://github.com/primate-run/primate/blob/master/packages/core/src/private/build/server/index.ts#L75
  43. blue you see that line?
  44. blue if you build with pnpm, it'll be "node"
  45. blue these conditions after which branch of rcompat is taken
  46. blue what you essentially want, is to able to say that you're building with pnpm, but the resulting bundle should be for deno
  47. blue as a quickhack, try changing taht line to "deno"
  48. blue so
  49. phaleth ok
  50. blue ...conditions.deno
  51. blue this would force rcompat to take deno paths where available
  52. blue and that http import would disappear
  53. phaleth https://upaste.de/raw/r9r
  54. blue yes, that's not going to work because I haven't coded it yet
  55. blue instead, edit it in the file
  56. phaleth are there no universal package names for all runtimes?
  57. phaleth or is npm:http the one?
  58. blue yes but you don't want that
  59. phaleth or node:http one that deno can recognize
  60. blue you want deno native abstractions
  61. blue Deno.serve
  62. phaleth ah, ok
  63. blue rcompat is intentionally incompatible there
  64. blue because if you're on deno, you shuld take the deno path
  65. blue anywy, so to src/private/build/server/index.ts
  66. blue and change line 75 to `...conditions.deno`
  67. blue then rebuild core
  68. blue and try again
  69. blue go to*
  70. blue I can edit that deno target fairly easily, but we'd better first test this
  71. phaleth ok, new error https://upaste.de/raw/rL7
  72. blue yes, you're not running it with deno
  73. phaleth oh, right
  74. phaleth habit
  75. phaleth yeah, that works
  76. phaleth $ deno run -A npm:primate serve
  77. phaleth » app url http://0.0.0.0:6161
  78. blue great. and it's using native deno functions
  79. blue I
  80. blue I
  81. blue I'll add crossbuilding to 0.39
  82. blue that's a great idea
  83. blue build with bun, run with deno ;P
  84. phaleth ok, I'll just put that patch to the Containerfile for now
  85. blue alrighty
  86. phaleth build with node run with deno
  87. phaleth ok, the 0.39 blogpost is gone
  88. blue ya, I removed it
  89. phaleth blue: can you merge some of those merge requests?
  90. phaleth I mean pull requests
  91. phaleth especially the new one
  92. blue yes, will do phaleth
  93. blue phaleth: https://github.com/primate-run/primate/commit/08bbbe8d1231393060cb9fb8655b6ec949ee1593
  94. nevet core: add crossbuilding · primate-run/primate@08bbbe8
  95. blue you can drop your patch and use --target=deno
  96. blue I merged 2/3 of the prs
  97. blue https://github.com/primate-run/primate/pull/273
  98. nevet website: remove unused dev dependencies by phaleth · Pull Request #273 · primate-run/primate
  99. blue this I'm inclined to reject because I need the devdeps for the snippets, unless you have a better idea
  100. phaleth ok, I've closed that one
  101. blue tell me if that crossbuilding patch worked for you
  102. blue so I've built the angular app (apps/angular) for node, deno and bun
  103. phaleth yeah, trying that now
  104. blue I get 3434572 bytes for bun, 3434973 bytes for deno and 3508428 bytes for node
  105. blue note though I haven't explored all deno/bun APIs, and rcompat does have some deps which could end up in bun/deno
  106. phaleth {"stream":"[1/2] STEP 12/13: RUN npx -y primate build --target=deno\n"}
  107. phaleth {"stream":"\u001b[1m\u001b[38;2;255;165;0mPRIMATE\u001b[0m\u001b[0m \u001b[38;2;255;165;0m0.39.0-pre\u001b[0m \n\n"}
  108. phaleth {"stream":"✓ build path \u001b[2m/app/primate/apps/website/build\u001b[0m\n"}
  109. phaleth looks good
  110. blue great
  111. blue you know, the differences between the frontends are staggering
  112. blue an angular app is 3.3mb, react 1.1m, svelte clocks in at 458K
  113. blue and I do have @lucide/svelte in svelte which I don't in react/angular, that is a hugebutt icon library, not sure how much of it ends up in the bundle
  114. blue really I should check
  115. phaleth yeah, the website is fine, the blog page responds fast now
  116. blue so without lucide, deno is 436K
  117. phaleth right, I wish there was client side framework that was small
  118. blue bun is same
  119. blue node is 508K, ew
  120. blue well I guess that answers the question, node pulls in busboy and ws
  121. blue you'd really expect a runtime in 2026 to support websockets and formdata properly
  122. blue but still, 436K is way too much
  123. phaleth if it's server side bundle then I don't care
  124. blue let me check the website, it should be much large b/c of shiki
  125. blue larger*
  126. blue oof, 15M
  127. blue I feel like there's room for optimisation there, this can't be all the markdown files. I think it's shiki mostly
  128. blue in dev mode though, the server is 4.7M which is still too much
  129. blue the docs dir is 736.0 KiB
  130. blue I guess that compiles to a lot of HTML?
  131. blue so an idea I have for the website so it's faster in dev mode, is to not bundle in the .md files, but import from source directly
  132. blue that also means esbuild doesn't need to recreate 4.7M when I change a single md
  133. blue ideally really, in dev mode the server.js should be tiny
  134. blue so basically in the end it's all in memory, right. whether it's a 4.7 file or the different md imports held by esbuild
  135. blue but the point being, if you change a single md, esbuild should immediately recompile it only
  136. blue another cool idea would be to compile-on-demand, that would also speed up dev mode
  137. blue so if I never access /docs/i18n, it doesn't get compiled, no idea how to do that though
  138. phaleth are .md files currently bundled and the html is generated at runtime per request?
  139. phaleth for prod I mean
  140. blue yes, basically
  141. blue https://github.com/primate-run/primate/issues/253
  142. nevet Proposal: `--target=static` (SSG output + client-only runtime) · Issue #253 · primate-run/primate
  143. blue that's why we have this
  144. phaleth ah, ok, so that's why bun was struggling there with the response time https://images4.imagebam.com/b9/ae/45/ME1D4GWQ_o.png now deno deployed over an hour ago is fast enough
  145. phaleth no need to rewrite bun in rust when we can just use deno
  146. blue heh
  147. blue the thing is, phaleth
  148. blue if we land https://github.com/primate-run/primate/issues/253
  149. nevet Proposal: `--target=static` (SSG output + client-only runtime) · Issue #253 · primate-run/primate
  150. blue we technically don't really need node/deno/bun to run it
  151. blue just to build it
  152. phaleth yeah, that'd be great
  153. blue it'll just be a bunch of html files
  154. blue that nginx can serve
  155. blue I don't know how fetch navigation would then work, but maybe it's not necessary
  156. blue the delta between loading the entire html page, essentially if woff/css is externalised, vs loading 'just' the md content as html in json, isn't very big
  157. blue we would need a bit of dynamics, for theme change (probably localstorage again?)
  158. phaleth yeah, that's the thing, client side rendering would always result in flash
  159. blue ya
  160. blue technically could compile both dark and light separately, and have nginx deliver one based on the cookie? is that a thing? I dunno
  161. phaleth nginx can read headers and decide on paths based on that, the web browser could store theme to local storage and set a custom header
  162. phaleth but that'd require nginx specific configuration
  163. blue that's great, then potentially we could solve that
  164. phaleth I think it's just better not to bother storing the theme, but always take whatever theme the browser is set to, the theme switch can still remain on the website
  165. phaleth but does the browser send that information on every request? no clue
  166. blue if it's a cookie, yes
  167. phaleth actually css can detect that: @media (prefers-color-scheme: dark) { ... }
  168. phaleth https://caniuse.com/?search=prefers-color-scheme
  169. nevet "prefers-color-scheme" | Can I use... Support tables for HTML5, CSS3, etc
  170. phaleth yeah, so then always load css first and that's it, no reason to bother doing anything server side
  171. phaleth I guess I should try that
  172. blue ya
  173. phaleth I guess this is the solution https://caniuse.com/?search=light-dark
  174. nevet "light-dark" | Can I use... Support tables for HTML5, CSS3, etc
  175. phaleth ok, that just doesn't solve the flash problem either
  176. bot <discord:blue> Ya
  177. blue dreamreal: I think markdown db makes a lot of sense if I can have it flattened/rendered down into the bundle, in production
  178. blue the one angle I haven't got sorted out yet is reloading the page in dev mode, because that'd require fs watching of the .md files

Search posts