Submit

Back to the channels

#primate

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