diff --git a/docs/examples/index.md b/docs/examples/index.md index a9d81c34..2671987d 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -13,3 +13,4 @@ like to see here, please open - [Writing tests](./examples/writing-tests) - [Changing the source directory](./examples/changing-the-src-dir) - [Initializing the server](./examples/init-the-server) +- [Using Fresh canary version](./examples/using-fresh-canary-version) diff --git a/docs/examples/using-fresh-canary-version.md b/docs/examples/using-fresh-canary-version.md new file mode 100644 index 00000000..464e8d7c --- /dev/null +++ b/docs/examples/using-fresh-canary-version.md @@ -0,0 +1,78 @@ +--- +description: | + For cases where the latest release doesn't fit your needs. +--- + +Pretend you have a use case where you need to modify your project to use a +canary version of Fresh. Or you want to use a slightly different initialization +script. This page has you covered. + +## Canary Fresh in `deno.json` + +### Specific commit + +Let's say you like living life in the fast lane, and want a particular commit. +How can you modify your project to no longer use the current release, but +instead this one particular commit? Just make the following changes to your +`deno.json`: + +```diff + "update": "deno run -A -r https://fresh.deno.dev/update ." + }, + "imports": { +- "$fresh/": "https://deno.land/x/fresh@1.2.0/", ++ "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/the-particular-commit-hash-here/", + "preact": "https://esm.sh/preact@10.15.1", + "preact/": "https://esm.sh/preact@10.15.1/", + "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.1.0", +``` + +### Forked Fresh + +Or what if you have a PR created but it's not getting merged into `main`. Don't +worry, you can use the same approach to reference any branch in a fork as well. +Here's an example of referencing a feature in a forked repository that hasn't +been merged yet (at the time of writing this): + +```diff + "update": "deno run -A -r https://fresh.deno.dev/update ." + }, + "imports": { +- "$fresh/": "https://deno.land/x/fresh@1.2.0/", ++ "$fresh/": "https://raw.githubusercontent.com/deer/fresh/state_in_props/", + "preact": "https://esm.sh/preact@10.15.1", + "preact/": "https://esm.sh/preact@10.15.1/", + "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.1.0", +``` + +## Creating a new project + +What if you're getting into open source development, and you've of course +decided to contribute to the best, freshest project around. Maybe you want to +create a test project based on your local changes. + +### Creating a project from source + +Instead of doing it like this: + +```sh +deno run -A -r https://fresh.deno.dev/ +``` + +do it like this: + +```sh +deno run -A -r path/to/fresh/init.ts +``` + +(or wherever your local code lives) + +### Creating a project from the latest commit + +Of course there's no reason why you have to check out the Fresh source. You can +create a project from the latest commit by combining the techniques on this page +like this: + +```sh +deno run -A -r https://raw.githubusercontent.com/denoland/fresh/main/init.ts +``` diff --git a/docs/toc.json b/docs/toc.json index 62dcb437..5e0f8363 100644 --- a/docs/toc.json +++ b/docs/toc.json @@ -45,7 +45,8 @@ ["setting-the-language", "Setting the language"], ["writing-tests", "Writing tests"], ["changing-the-src-dir", "Changing the source directory"], - ["init-the-server", "Initializing the server"] + ["init-the-server", "Initializing the server"], + ["using-fresh-canary-version", "Using Fresh canary version"] ] } }