Chat Logs

  1. * phaleth joined #primate
  2. bluephaleth: yesteday the primate web machine automatically redeployed
  3. blueis that configured somewhere?
  4. bluealso hi
  5. bluealso, we need to change the deployment branch to 0.38, I accidently floated the unready 0.39 post
  6. blueI edited the Container image with --branch=0.38 on the git clone, but that did nothing
  7. phalethhi blue
  8. phalethno, I did the redeployment last evening
  9. blueoh ok, that makes sense
  10. phalethI'm trying deno for the primate website
  11. blueI 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. blueI 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. blueI mean by 0.40*
  14. phalethyeah, we should stay on tsgo
  15. phalethdo you know if this error https://upaste.de/raw/TbM comes from rcompat are would you be able to fix it?
  16. bluegenerally 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. blueso that should be easy with RP
  18. bluelet me look
  19. bluehm, that feels like deno not recognising that as a node import
  20. blueshould be "node:http", strictly speaking
  21. bluecould you paste line 117 here?
  22. phalethyeah, but it's an uglified code
  23. phalethdeno does not seems to like pnpm
  24. blueyeah. though there is `deno install`, fwiw
  25. phalethso there is a lot on that one line https://upaste.de/raw/AiH
  26. blueit's just deno is notoriously bad with symlinks and monorepos
  27. phalethok, but does deno install work with all those dependencies that have ^workspace as a version in package.json?
  28. blueno
  29. blueawait (Wo(a) ? import("https") : import("http"))
  30. bluethis seems wrong, it shouldn't end up in the deno bundle
  31. phaleththat's where the error comes from yes
  32. phalethit's not deno bundling it, it's pnpm
  33. phalethI'm just trying to run it with deno
  34. blueoh. yes, that has slim changes of working
  35. bluepnpm will bundle it for node
  36. blueyou know, maybe we should enable cross-building
  37. bluenpx primate build --target=deno
  38. bluethat's what you're looking for, right?
  39. phalethI have no idea, is that a thing?
  40. bluelet me show you
  41. phaleththe thing is there are these ^workspace deps in package json
  42. bluehttps://github.com/primate-run/primate/blob/master/packages/core/src/private/build/server/index.ts#L75
  43. blueyou see that line?
  44. blueif you build with pnpm, it'll be "node"
  45. bluethese conditions after which branch of rcompat is taken
  46. bluewhat you essentially want, is to able to say that you're building with pnpm, but the resulting bundle should be for deno
  47. blueas a quickhack, try changing taht line to "deno"
  48. blueso
  49. phalethok
  50. blue...conditions.deno
  51. bluethis would force rcompat to take deno paths where available
  52. blueand that http import would disappear
  53. phalethhttps://upaste.de/raw/r9r
  54. blueyes, that's not going to work because I haven't coded it yet
  55. blueinstead, edit it in the file
  56. phalethare there no universal package names for all runtimes?
  57. phalethor is npm:http the one?
  58. blueyes but you don't want that
  59. phalethor node:http one that deno can recognize
  60. blueyou want deno native abstractions
  61. blueDeno.serve
  62. phalethah, ok
  63. bluercompat is intentionally incompatible there
  64. bluebecause if you're on deno, you shuld take the deno path
  65. blueanywy, so to src/private/build/server/index.ts
  66. blueand change line 75 to `...conditions.deno`
  67. bluethen rebuild core
  68. blueand try again
  69. bluego to*
  70. blueI can edit that deno target fairly easily, but we'd better first test this
  71. phalethok, new error https://upaste.de/raw/rL7
  72. blueyes, you're not running it with deno
  73. phalethoh, right
  74. phalethhabit
  75. phalethyeah, that works
  76. phaleth$ deno run -A npm:primate serve
  77. phaleth» app url http://0.0.0.0:6161
  78. bluegreat. and it's using native deno functions
  79. blueI
  80. blueI
  81. blueI'll add crossbuilding to 0.39
  82. bluethat's a great idea
  83. bluebuild with bun, run with deno ;P
  84. phalethok, I'll just put that patch to the Containerfile for now
  85. bluealrighty
  86. phalethbuild with node run with deno
  87. phalethok, the 0.39 blogpost is gone
  88. blueya, I removed it
  89. phalethblue: can you merge some of those merge requests?
  90. phalethI mean pull requests
  91. phalethespecially the new one
  92. blueyes, will do phaleth
  93. bluephaleth: https://github.com/primate-run/primate/commit/08bbbe8d1231393060cb9fb8655b6ec949ee1593
  94. nevetcore: add crossbuilding · primate-run/primate@08bbbe8
  95. blueyou can drop your patch and use --target=deno
  96. blueI merged 2/3 of the prs
  97. bluehttps://github.com/primate-run/primate/pull/273
  98. nevetwebsite: remove unused dev dependencies by phaleth · Pull Request #273 · primate-run/primate
  99. bluethis I'm inclined to reject because I need the devdeps for the snippets, unless you have a better idea
  100. phalethok, I've closed that one
  101. bluetell me if that crossbuilding patch worked for you
  102. blueso I've built the angular app (apps/angular) for node, deno and bun
  103. phalethyeah, trying that now
  104. blueI get 3434572 bytes for bun, 3434973 bytes for deno and 3508428 bytes for node
  105. bluenote 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. phalethlooks good
  110. bluegreat
  111. blueyou know, the differences between the frontends are staggering
  112. bluean angular app is 3.3mb, react 1.1m, svelte clocks in at 458K
  113. blueand 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. bluereally I should check
  115. phalethyeah, the website is fine, the blog page responds fast now
  116. blueso without lucide, deno is 436K
  117. phalethright, I wish there was client side framework that was small
  118. bluebun is same
  119. bluenode is 508K, ew
  120. bluewell I guess that answers the question, node pulls in busboy and ws
  121. blueyou'd really expect a runtime in 2026 to support websockets and formdata properly
  122. bluebut still, 436K is way too much
  123. phalethif it's server side bundle then I don't care
  124. bluelet me check the website, it should be much large b/c of shiki
  125. bluelarger*
  126. blueoof, 15M
  127. blueI feel like there's room for optimisation there, this can't be all the markdown files. I think it's shiki mostly
  128. bluein dev mode though, the server is 4.7M which is still too much
  129. bluethe docs dir is 736.0 KiB
  130. blueI guess that compiles to a lot of HTML?
  131. blueso 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. bluethat also means esbuild doesn't need to recreate 4.7M when I change a single md
  133. blueideally really, in dev mode the server.js should be tiny
  134. blueso 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. bluebut the point being, if you change a single md, esbuild should immediately recompile it only
  136. blueanother cool idea would be to compile-on-demand, that would also speed up dev mode
  137. blueso if I never access /docs/i18n, it doesn't get compiled, no idea how to do that though
  138. phalethare .md files currently bundled and the html is generated at runtime per request?
  139. phalethfor prod I mean
  140. blueyes, basically
  141. bluehttps://github.com/primate-run/primate/issues/253
  142. nevetProposal: `--target=static` (SSG output + client-only runtime) · Issue #253 · primate-run/primate
  143. bluethat's why we have this
  144. phalethah, 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. phalethno need to rewrite bun in rust when we can just use deno
  146. blueheh
  147. bluethe thing is, phaleth
  148. blueif we land https://github.com/primate-run/primate/issues/253
  149. nevetProposal: `--target=static` (SSG output + client-only runtime) · Issue #253 · primate-run/primate
  150. bluewe technically don't really need node/deno/bun to run it
  151. bluejust to build it
  152. phalethyeah, that'd be great
  153. blueit'll just be a bunch of html files
  154. bluethat nginx can serve
  155. blueI don't know how fetch navigation would then work, but maybe it's not necessary
  156. bluethe 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. bluewe would need a bit of dynamics, for theme change (probably localstorage again?)
  158. phalethyeah, that's the thing, client side rendering would always result in flash
  159. blueya
  160. bluetechnically could compile both dark and light separately, and have nginx deliver one based on the cookie? is that a thing? I dunno
  161. phalethnginx 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. phalethbut that'd require nginx specific configuration
  163. bluethat's great, then potentially we could solve that
  164. phalethI 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. phalethbut does the browser send that information on every request? no clue
  166. blueif it's a cookie, yes
  167. phalethactually css can detect that: @media (prefers-color-scheme: dark) { ... }
  168. phalethhttps://caniuse.com/?search=prefers-color-scheme
  169. nevet"prefers-color-scheme" | Can I use... Support tables for HTML5, CSS3, etc
  170. phalethyeah, so then always load css first and that's it, no reason to bother doing anything server side
  171. phalethI guess I should try that
  172. blueya
  173. phalethI 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. phalethok, that just doesn't solve the flash problem either
  176. bot<discord:blue> Ya
  177. bluedreamreal: I think markdown db makes a lot of sense if I can have it flattened/rendered down into the bundle, in production
  178. bluethe 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