From 6e128d639079cc1a9326ba7ad45a954ca88a3239 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Mon, 25 Nov 2024 17:22:10 +0000 Subject: [PATCH 01/23] create pages for examples, tutorials and videos, refactor examples (#1191) --- _components/Header.tsx | 12 +- _includes/doc.tsx | 197 +----- _includes/layout.tsx | 4 +- _includes/renderCommand.tsx | 202 ++++++ examples.page.tsx | 599 ------------------ learn/_components/CopyButton.tsx | 20 + learn/_components/SnippetComponent.tsx | 59 ++ learn/_pages/ExamplePage.tsx | 136 ++++ learn/_pages/ExamplesPage.tsx | 126 ++++ learn/_pages/LandingPage.tsx | 10 + learn/_pages/TutorialsPage.tsx | 3 + learn/_pages/VideosPage.tsx | 3 + .../_pages/examples_test.ts | 2 +- .../examples}/aes-encryption.ts | 0 {examples => learn/examples}/benchmarking.ts | 0 .../examples}/byte-manipulation.ts | 0 .../examples}/checking-file-existence.ts | 0 {examples => learn/examples}/color-logging.ts | 0 .../examples}/command-line-arguments.ts | 0 .../examples}/create-remove-directories.ts | 0 {examples => learn/examples}/cron.ts | 0 .../examples}/data-processing.ts | 0 .../examples}/deleting-files.ts | 0 {examples => learn/examples}/deno-version.ts | 0 {examples => learn/examples}/dns-queries.ts | 0 .../examples}/environment-variables.ts | 0 .../examples}/exponential-backoff.ts | 0 {examples => learn/examples}/hashing.ts | 0 {examples => learn/examples}/hello-world.ts | 0 .../examples}/hex-base64-encoding.ts | 0 .../examples}/hmac-generate-verify.ts | 0 {examples => learn/examples}/hono.ts | 0 {examples => learn/examples}/http-requests.ts | 0 .../examples}/http-server-files.ts | 0 ...ver-oak-crud-middleware-with-sqlite3-db.ts | 0 .../examples}/http-server-routing.ts | 0 .../examples}/http-server-streaming.ts | 0 .../examples}/http-server-websocket.ts | 0 {examples => learn/examples}/http-server.ts | 0 {examples => learn/examples}/import-export.ts | 0 .../examples}/importing-json.ts | 0 {examples => learn/examples}/kv-watch.ts | 0 {examples => learn/examples}/kv.ts | 0 {examples => learn/examples}/mongo.ts | 0 .../examples}/moving-renaming-files.ts | 0 {examples => learn/examples}/node.ts | 0 {examples => learn/examples}/npm.ts | 0 .../examples}/openai-chat-completion.ts | 0 {examples => learn/examples}/os-signals.ts | 0 .../examples}/parsing-serializing-csv.ts | 0 .../examples}/parsing-serializing-json.ts | 0 .../examples}/parsing-serializing-toml.ts | 0 .../examples}/parsing-serializing-yaml.ts | 0 .../examples}/path-operations.ts | 0 {examples => learn/examples}/permissions.ts | 0 {examples => learn/examples}/pid.ts | 0 .../examples}/piping-streams.ts | 0 {examples => learn/examples}/postgres.ts | 0 {examples => learn/examples}/prompts.ts | 0 {examples => learn/examples}/queues.ts | 0 {examples => learn/examples}/reading-files.ts | 0 .../examples}/reading-system-metrics.ts | 0 {examples => learn/examples}/redis.ts | 0 {examples => learn/examples}/rsa-signature.ts | 0 {examples => learn/examples}/sqlite.ts | 0 .../examples}/streaming-files.ts | 0 .../examples}/subprocess-running-files.ts | 0 .../examples}/subprocesses-output.ts | 0 .../examples}/subprocesses-spawn.ts | 0 {examples => learn/examples}/supabase.ts | 0 {examples => learn/examples}/symlinks.ts | 0 {examples => learn/examples}/tcp-connector.ts | 0 .../examples}/tcp-echo-server.ts | 0 {examples => learn/examples}/tcp-listener.ts | 0 .../examples}/temporary-files.ts | 0 {examples => learn/examples}/timers.ts | 0 {examples => learn/examples}/tls-connector.ts | 0 {examples => learn/examples}/tls-listener.ts | 0 {examples => learn/examples}/typescript.ts | 0 {examples => learn/examples}/udp-connector.ts | 0 {examples => learn/examples}/udp-listener.ts | 0 {examples => learn/examples}/ulid.ts | 0 {examples => learn/examples}/unix-cat.ts | 0 .../examples}/unzip-gzipped-file.ts | 0 {examples => learn/examples}/url-parsing.ts | 0 {examples => learn/examples}/uuids.ts | 0 .../examples}/walking-directories.ts | 0 .../examples}/watching-files.ts | 0 {examples => learn/examples}/web-workers.ts | 0 {examples => learn/examples}/webassembly.ts | 0 {examples => learn/examples}/websocket.ts | 0 {examples => learn/examples}/writing-files.ts | 0 {examples => learn/examples}/writing-tests.ts | 0 learn/index.tsx | 88 +++ learn/types.ts | 57 ++ learn/utils/parseExample.ts | 163 +++++ orama.ts | 2 +- 97 files changed, 879 insertions(+), 804 deletions(-) create mode 100644 _includes/renderCommand.tsx delete mode 100644 examples.page.tsx create mode 100644 learn/_components/CopyButton.tsx create mode 100644 learn/_components/SnippetComponent.tsx create mode 100644 learn/_pages/ExamplePage.tsx create mode 100644 learn/_pages/ExamplesPage.tsx create mode 100644 learn/_pages/LandingPage.tsx create mode 100644 learn/_pages/TutorialsPage.tsx create mode 100644 learn/_pages/VideosPage.tsx rename examples_test.ts => learn/_pages/examples_test.ts (91%) rename {examples => learn/examples}/aes-encryption.ts (100%) rename {examples => learn/examples}/benchmarking.ts (100%) rename {examples => learn/examples}/byte-manipulation.ts (100%) rename {examples => learn/examples}/checking-file-existence.ts (100%) rename {examples => learn/examples}/color-logging.ts (100%) rename {examples => learn/examples}/command-line-arguments.ts (100%) rename {examples => learn/examples}/create-remove-directories.ts (100%) rename {examples => learn/examples}/cron.ts (100%) rename {examples => learn/examples}/data-processing.ts (100%) rename {examples => learn/examples}/deleting-files.ts (100%) rename {examples => learn/examples}/deno-version.ts (100%) rename {examples => learn/examples}/dns-queries.ts (100%) rename {examples => learn/examples}/environment-variables.ts (100%) rename {examples => learn/examples}/exponential-backoff.ts (100%) rename {examples => learn/examples}/hashing.ts (100%) rename {examples => learn/examples}/hello-world.ts (100%) rename {examples => learn/examples}/hex-base64-encoding.ts (100%) rename {examples => learn/examples}/hmac-generate-verify.ts (100%) rename {examples => learn/examples}/hono.ts (100%) rename {examples => learn/examples}/http-requests.ts (100%) rename {examples => learn/examples}/http-server-files.ts (100%) rename {examples => learn/examples}/http-server-oak-crud-middleware-with-sqlite3-db.ts (100%) rename {examples => learn/examples}/http-server-routing.ts (100%) rename {examples => learn/examples}/http-server-streaming.ts (100%) rename {examples => learn/examples}/http-server-websocket.ts (100%) rename {examples => learn/examples}/http-server.ts (100%) rename {examples => learn/examples}/import-export.ts (100%) rename {examples => learn/examples}/importing-json.ts (100%) rename {examples => learn/examples}/kv-watch.ts (100%) rename {examples => learn/examples}/kv.ts (100%) rename {examples => learn/examples}/mongo.ts (100%) rename {examples => learn/examples}/moving-renaming-files.ts (100%) rename {examples => learn/examples}/node.ts (100%) rename {examples => learn/examples}/npm.ts (100%) rename {examples => learn/examples}/openai-chat-completion.ts (100%) rename {examples => learn/examples}/os-signals.ts (100%) rename {examples => learn/examples}/parsing-serializing-csv.ts (100%) rename {examples => learn/examples}/parsing-serializing-json.ts (100%) rename {examples => learn/examples}/parsing-serializing-toml.ts (100%) rename {examples => learn/examples}/parsing-serializing-yaml.ts (100%) rename {examples => learn/examples}/path-operations.ts (100%) rename {examples => learn/examples}/permissions.ts (100%) rename {examples => learn/examples}/pid.ts (100%) rename {examples => learn/examples}/piping-streams.ts (100%) rename {examples => learn/examples}/postgres.ts (100%) rename {examples => learn/examples}/prompts.ts (100%) rename {examples => learn/examples}/queues.ts (100%) rename {examples => learn/examples}/reading-files.ts (100%) rename {examples => learn/examples}/reading-system-metrics.ts (100%) rename {examples => learn/examples}/redis.ts (100%) rename {examples => learn/examples}/rsa-signature.ts (100%) rename {examples => learn/examples}/sqlite.ts (100%) rename {examples => learn/examples}/streaming-files.ts (100%) rename {examples => learn/examples}/subprocess-running-files.ts (100%) rename {examples => learn/examples}/subprocesses-output.ts (100%) rename {examples => learn/examples}/subprocesses-spawn.ts (100%) rename {examples => learn/examples}/supabase.ts (100%) rename {examples => learn/examples}/symlinks.ts (100%) rename {examples => learn/examples}/tcp-connector.ts (100%) rename {examples => learn/examples}/tcp-echo-server.ts (100%) rename {examples => learn/examples}/tcp-listener.ts (100%) rename {examples => learn/examples}/temporary-files.ts (100%) rename {examples => learn/examples}/timers.ts (100%) rename {examples => learn/examples}/tls-connector.ts (100%) rename {examples => learn/examples}/tls-listener.ts (100%) rename {examples => learn/examples}/typescript.ts (100%) rename {examples => learn/examples}/udp-connector.ts (100%) rename {examples => learn/examples}/udp-listener.ts (100%) rename {examples => learn/examples}/ulid.ts (100%) rename {examples => learn/examples}/unix-cat.ts (100%) rename {examples => learn/examples}/unzip-gzipped-file.ts (100%) rename {examples => learn/examples}/url-parsing.ts (100%) rename {examples => learn/examples}/uuids.ts (100%) rename {examples => learn/examples}/walking-directories.ts (100%) rename {examples => learn/examples}/watching-files.ts (100%) rename {examples => learn/examples}/web-workers.ts (100%) rename {examples => learn/examples}/webassembly.ts (100%) rename {examples => learn/examples}/websocket.ts (100%) rename {examples => learn/examples}/writing-files.ts (100%) rename {examples => learn/examples}/writing-tests.ts (100%) create mode 100644 learn/index.tsx create mode 100644 learn/types.ts create mode 100644 learn/utils/parseExample.ts diff --git a/_components/Header.tsx b/_components/Header.tsx index bfd323477..10393cc62 100644 --- a/_components/Header.tsx +++ b/_components/Header.tsx @@ -50,16 +50,16 @@ export default function Header({ />