Back to Fresh

Using Fresh Canary Version

docs/1.x/examples/using-fresh-canary-version.md

2.3.31.7 KB
Original Source

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

Latest alpha version

The easiest way to use Fresh 2 canary is with the update command:

sh
deno run -A -r jsr:@fresh/[email protected] .

This will automatically update your deno.json to use the specified canary version.

Specific commit

If you need a particular commit (for testing specific fixes or features):

diff
   "tasks": {
     "update": "deno run -A -r jsr:@fresh/update ."
   },
   "imports": {
-    "$fresh/": "jsr:@fresh/core@^2.0.0",
+    "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/your-commit-hash/",
     "preact": "npm:preact@^10.26.9",
     "@preact/signals": "npm:@preact/signals@^2.2.0"
   }

Replace your-commit-hash with your desired commit hash.

Forked Fresh

For testing your own fork or PR:

diff
   "tasks": {
     "update": "deno run -A -r jsr:@fresh/update ."
   },
   "imports": {
-    "$fresh/": "https://deno.land/x/[email protected]/",
+    "$fresh/": "https://raw.githubusercontent.com/your-username/fresh/your-branch/",
     "preact": "https://esm.sh/[email protected]",
     "preact/": "https://esm.sh/[email protected]/",
   }

Creating a new project

Using JSR

sh
deno run -A -r jsr:@fresh/[email protected]

From local source

If you're developing Fresh itself:

sh
deno run -A -r ./init/src/init.ts