diff --git a/README.md b/README.md index 18a103ca..c9926e8f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +> :warning: DO NOT USE. THIS DOES NOT WORK, and is just a POC for JIT JS +> bundling. + # fresh Preact, but super edgy. @@ -25,7 +28,7 @@ To install, run the following command. This will add `fresh` CLI to your PATH. Make sure to have Deno 1.9.1 or later installed. ```sh -deno install -A -f https://deno.land/x/fresh/cli.ts +deno install -A -f --no-check https://deno.land/x/fresh/cli.ts ``` ## Getting started diff --git a/example/README.md b/example/README.md new file mode 100644 index 00000000..d9095a25 --- /dev/null +++ b/example/README.md @@ -0,0 +1,22 @@ +# fresh project + +### Usage + +Install deployctl: + +``` +deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts +``` + +Start the project: + +``` +deployctl run --no-check --watch server.ts +``` + +After adding, removing, or moving a page in the `pages` directory, run: + +``` +fresh routes +``` + diff --git a/example/pages/[name].tsx b/example/pages/[name].tsx index f40c8cf3..e03bf76b 100644 --- a/example/pages/[name].tsx +++ b/example/pages/[name].tsx @@ -1,12 +1,11 @@ -import { h, PageProps, useState } from "../deps.ts"; +import { h } from "../deps.ts"; -export default function Home(props: PageProps) { - const [counter, setCounter] = useState(0); - - return ( -
- Hello {props.params.name}! {counter}{" "} - -
- ); +interface Props { + params: { + name: string; + }; +} + +export default function Greet(props: Props) { + return
Hello {props.params.name}
; } diff --git a/example/pages/index.tsx b/example/pages/index.tsx index 0f7b1d68..c765d64c 100644 --- a/example/pages/index.tsx +++ b/example/pages/index.tsx @@ -1,5 +1,22 @@ -import { h } from "../deps.ts"; +import { h, useState } from "../deps.ts"; -export default function Home(props: {}) { - return
Hello World!
; +export default function Home() { + return ( +
+

+ Welcome to `fresh`. Try update this message in the ./pages/index.tsx + file, and refresh. +

+ +
+ ); +} + +function Counter() { + const [count, setCount] = useState(0); + return
+

{count}

+ + +
; } diff --git a/example/server.ts b/example/server.ts index d4093aca..2b41ef2d 100644 --- a/example/server.ts +++ b/example/server.ts @@ -1,3 +1,7 @@ +// DO NOT EDIT. This file is generated by `fresh`. +// This file SHOULD be checked into source version control. +// To update this file, run `fresh routes`. + import { setup } from "../server.ts"; import * as $0 from "./pages/[name].tsx"; diff --git a/example/tsconfig.json b/example/tsconfig.json new file mode 100644 index 00000000..bc269e44 --- /dev/null +++ b/example/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "jsxFactory": "h", + "jsxFragmentFactory": "Fragment" + } +} \ No newline at end of file