denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.54k stars 648 forks source link

showcase: add rfui.deno.dev #2205

Closed adamzerner closed 10 months ago

adamzerner commented 10 months ago

Add RFUI (https://rfui.deno.dev/)

adamzerner commented 10 months ago

Hey guys. How do images work? I tried to add one for FilterHN as well, but couldn't figure it out.

marvinhagemeister commented 10 months ago

@adamzerner There is a screenshot task in the top level deno.json that creates a screenshot from the URL you feed to it and saves it in the expected format for the showcase sites.

adamzerner commented 10 months ago

@marvinhagemeister Is this documented in more detail anywhere? If not, would you mind elaborating on how that works?

I wasn't able to infer how it works by looking at the task in deno.json. Also, I am seeing the other values for image (eg. "image": "living-pixel") are not URLs, so I'm not sure how to get the task to successfully work. And it looks like the URL isn't enough because it didn't work for FilterHN.

Screenshot 2024-01-03 at 11 51 38 AM
marvinhagemeister commented 10 months ago

Good catch, I've fixed the missing screenshots in https://github.com/denoland/fresh/pull/2211 .

The value in "image": "foobar" is the filename that is used to look up the appropriate image. Example:

{
  "title": "Example",
  "link": "https://example.com/",
  "image": "example"
}

Then run deno task screenshot https://example.com example to generate the images. The first argument is the url to the site, and the second whatever you set in the json under image. If you run the task without any arguments a short help output is displayed.

adamzerner commented 10 months ago

@marvinhagemeister Thank you for explaining. That makes sense. I was able to get those images added to this PR.

Note: I had to run something for Puppeteer. It may be worth mentioning that too in the docs.

code/fresh [patch-2] » deno task screenshot https://rfui.deno.dev/ rfui
Task screenshot deno run -A www/utils/screenshot.ts "https://rfui.deno.dev/" "rfui"
error: Uncaught (in promise) Error: Could not find browser revision 1022525. Run "PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts" to download a supported browser binary.
      if (missingText) throw new Error(missingText);
                             ^
    at ChromeLauncher.launch (https://deno.land/x/puppeteer@16.2.0/src/deno/Launcher.ts:99:30)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async file:///Users/adamzerner/code/fresh/www/utils/screenshot.ts:24:17
code/fresh [patch-2] » PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts
 100.00%                                                    9.4s 124183342/124183342
Downloaded chrome 1022525 to /Users/adamzerner/Library/Caches/deno/deno_puppeteer/chromium/mac-1022525/chrome-mac/Chromium.app/Contents/MacOS/Chromium from https://storage.googleapis.com/chromium-browser-snapshots/Mac/1022525/chrome-mac.zip
code/fresh [patch-2] » deno task screenshot https://rfui.deno.dev/ rfui
Task screenshot deno run -A www/utils/screenshot.ts "https://rfui.deno.dev/" "rfui"