From 72dd83d184246ea3d65c6805c2857d8413fc4fa0 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Thu, 8 Aug 2024 16:18:47 +0200 Subject: [PATCH 1/4] updating copy for reloading modules --- .../basics/modules/reloading_modules.md | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/runtime/manual/basics/modules/reloading_modules.md b/runtime/manual/basics/modules/reloading_modules.md index 1d52927c4..52e9a494a 100644 --- a/runtime/manual/basics/modules/reloading_modules.md +++ b/runtime/manual/basics/modules/reloading_modules.md @@ -5,23 +5,17 @@ oldUrl: - /runtime/manual/linkingtoexternal_code --- -By default, a module in the cache will be reused without fetching or -re-compiling it. Sometimes this is not desirable and you can force deno to -refetch and recompile modules into the cache. You can invalidate your local -`DENO_DIR` cache using the `--reload` flag of the `deno cache` subcommand. It's -usage is described below: +By default, Deno uses a global cache directory (`DENO_DIR`) for downloaded dependencies. This cache is shared across all projects. -## To reload everything +You can force deno to refetch and recompile modules into the cache using the `--reload` flag of the `deno cache` or `deno run` subcommand. ```bash +# Reload everything deno cache --reload my_module.ts +# Reload a specific module +deno cache --reload=jsr:@std/fs my_module.ts ``` -## To reload specific modules - -Sometimes we want to upgrade only some modules. You can control it by passing an -argument to a `--reload` flag. +## Vendoring -```bash -deno cache --reload=jsr:@std/fs my_module.ts -``` +To create a cache directory per project, set `"vendor": true` in your `deno.json`. [Read more about vendoring](../vendoring/). From f3c3afaf57b139c4d3ef1b7b1286844dd28cb801 Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Thu, 8 Aug 2024 16:20:27 +0200 Subject: [PATCH 2/4] fmt --- runtime/manual/basics/modules/reloading_modules.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/manual/basics/modules/reloading_modules.md b/runtime/manual/basics/modules/reloading_modules.md index 52e9a494a..bd947e04d 100644 --- a/runtime/manual/basics/modules/reloading_modules.md +++ b/runtime/manual/basics/modules/reloading_modules.md @@ -5,9 +5,11 @@ oldUrl: - /runtime/manual/linkingtoexternal_code --- -By default, Deno uses a global cache directory (`DENO_DIR`) for downloaded dependencies. This cache is shared across all projects. +By default, Deno uses a global cache directory (`DENO_DIR`) for downloaded +dependencies. This cache is shared across all projects. -You can force deno to refetch and recompile modules into the cache using the `--reload` flag of the `deno cache` or `deno run` subcommand. +You can force deno to refetch and recompile modules into the cache using the +`--reload` flag of the `deno cache` or `deno run` subcommand. ```bash # Reload everything @@ -18,4 +20,5 @@ deno cache --reload=jsr:@std/fs my_module.ts ## Vendoring -To create a cache directory per project, set `"vendor": true` in your `deno.json`. [Read more about vendoring](../vendoring/). +To create a cache directory per project, set `"vendor": true` in your +`deno.json`. [Read more about vendoring](../vendoring/). From 912ca8606d20d3731bc4c01d7bda92df6e4380dc Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Mon, 12 Aug 2024 18:33:09 +0100 Subject: [PATCH 3/4] updating by-example examples to use a hosted version of the file instead of github raw to make urls a bit prettier --- _config.ts | 1 + by-example/dependency-management.ts | 1 - by-example/import-export.ts | 1 - examples.page.tsx | 23 +++++++++-------------- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/_config.ts b/_config.ts index 13e95a403..0559a2d5e 100644 --- a/_config.ts +++ b/_config.ts @@ -81,6 +81,7 @@ site.copy("deno.json"); site.copy("go.json"); site.copy("server.ts"); site.copy("middleware.ts"); +site.copy("by-example"); site.use(redirects({ output: "json", diff --git a/by-example/dependency-management.ts b/by-example/dependency-management.ts index 762096031..6a59ddade 100644 --- a/by-example/dependency-management.ts +++ b/by-example/dependency-management.ts @@ -3,7 +3,6 @@ * @difficulty beginner * @tags cli, deploy * @resource {/examples/import-export} Example: Importing & Exporting - * @run * @group Basics * * It is unwieldy to have to import the same remote module over and over again. diff --git a/by-example/import-export.ts b/by-example/import-export.ts index 70209b723..169f03564 100644 --- a/by-example/import-export.ts +++ b/by-example/import-export.ts @@ -2,7 +2,6 @@ * @title Importing & Exporting * @difficulty beginner * @tags cli, deploy - * @run * @resource {/examples/dependency-management} Example: Dependency Management * @resource {https://docs.deno.com/runtime/manual/basics/modules} Manual: Modules * @group Basics diff --git a/examples.page.tsx b/examples.page.tsx index 33a2ab80b..4670783ce 100644 --- a/examples.page.tsx +++ b/examples.page.tsx @@ -54,12 +54,10 @@ export default function* (_data: Lume.Data, helpers: Lume.Helpers) { ).join("\n"); const url = - `https://github.com/denoland/deno-docs/blob/main/by-example/${example.name}${ - example.parsed.files.length > 1 ? "/main" : "" + `https://github.com/denoland/deno-docs/blob/main/by-example/${example.name}${example.parsed.files.length > 1 ? "/main" : "" }`; const rawUrl = - `https://raw.githubusercontent.com/denoland/deno-docs/main/by-example/${example.name}${ - example.parsed.files.length > 1 ? "/main" : "" + `https://docs.deno.com/by-example/${example.name}${example.parsed.files.length > 1 ? "/main" : "" }`; yield { @@ -299,22 +297,19 @@ function SnippetComponent(props: { return (
{props.snippet.text}
{props.filename && ( {props.filename} @@ -322,7 +317,7 @@ function SnippetComponent(props: {
{props.snippet.code && (
-
+
)}
From c6f5faaec51a3b43aeece7c77ed8d30d22fa938e Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Mon, 12 Aug 2024 18:35:43 +0100 Subject: [PATCH 4/4] fmt --- examples.page.tsx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/examples.page.tsx b/examples.page.tsx index 4670783ce..af49d2231 100644 --- a/examples.page.tsx +++ b/examples.page.tsx @@ -54,11 +54,12 @@ export default function* (_data: Lume.Data, helpers: Lume.Helpers) { ).join("\n"); const url = - `https://github.com/denoland/deno-docs/blob/main/by-example/${example.name}${example.parsed.files.length > 1 ? "/main" : "" - }`; - const rawUrl = - `https://docs.deno.com/by-example/${example.name}${example.parsed.files.length > 1 ? "/main" : "" + `https://github.com/denoland/deno-docs/blob/main/by-example/${example.name}${ + example.parsed.files.length > 1 ? "/main" : "" }`; + const rawUrl = `https://docs.deno.com/by-example/${example.name}${ + example.parsed.files.length > 1 ? "/main" : "" + }`; yield { url: `/examples/${example.label}/index.html`, @@ -297,19 +298,22 @@ function SnippetComponent(props: { return (
{props.snippet.text}
{props.filename && ( {props.filename}