diff --git a/.vscode/import_map.json b/.vscode/import_map.json index 26d19a63..34db80f5 100644 --- a/.vscode/import_map.json +++ b/.vscode/import_map.json @@ -1,5 +1,7 @@ { - ".": "THIS FILE EXISTS ONLY FOR VSCODE! IT IS NOT USED AT RUNTIME.", + "scopes": { + "THIS FILE EXISTS ONLY FOR VSCODE! IT IS NOT USED AT RUNTIME": {} + }, "imports": { "$fresh/": "../", diff --git a/deno.jsonc b/deno.json similarity index 71% rename from deno.jsonc rename to deno.json index cf82765a..062b8d16 100644 --- a/deno.jsonc +++ b/deno.json @@ -5,5 +5,9 @@ "www": "deno run -A --watch=static/,routes/ www/dev.ts", "screenshot": "deno run -A www/utils/screenshot.ts" }, - "importMap": "./tests/fixture/import_map.json" + "importMap": "./.vscode/import_map.json", + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "preact" + } } diff --git a/examples/counter/deno.json b/examples/counter/deno.json index 673d9eb5..8d9ac336 100644 --- a/examples/counter/deno.json +++ b/examples/counter/deno.json @@ -2,5 +2,9 @@ "tasks": { "start": "deno run -A --watch=static/,routes/ dev.ts" }, - "importMap": "./import_map.json" + "importMap": "./import_map.json", + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "preact" + } } diff --git a/examples/counter/fresh.gen.ts b/examples/counter/fresh.gen.ts index d11e969a..8d5fc01d 100644 --- a/examples/counter/fresh.gen.ts +++ b/examples/counter/fresh.gen.ts @@ -2,6 +2,7 @@ // This file SHOULD be checked into source version control. // This file is automatically updated during development when running `dev.ts`. +import config from "./deno.json" assert { type: "json" }; import * as $0 from "./routes/index.tsx"; import * as $$0 from "./islands/Counter.tsx"; @@ -13,6 +14,7 @@ const manifest = { "./islands/Counter.tsx": $$0, }, baseUrl: import.meta.url, + config, }; export default manifest; diff --git a/examples/counter/islands/Counter.tsx b/examples/counter/islands/Counter.tsx index d0878396..8f78ff43 100644 --- a/examples/counter/islands/Counter.tsx +++ b/examples/counter/islands/Counter.tsx @@ -1,5 +1,3 @@ -/** @jsx h */ -import { h } from "preact"; import { useState } from "preact/hooks"; import { IS_BROWSER } from "$fresh/runtime.ts"; diff --git a/examples/counter/routes/index.tsx b/examples/counter/routes/index.tsx index 2e3b4b28..46a70ce1 100644 --- a/examples/counter/routes/index.tsx +++ b/examples/counter/routes/index.tsx @@ -1,5 +1,3 @@ -/** @jsx h */ -import { h } from "preact"; import Counter from "../islands/Counter.tsx"; export default function Home() { diff --git a/init.ts b/init.ts index 7c73315a..3626387c 100644 --- a/init.ts +++ b/init.ts @@ -1,23 +1,8 @@ -import { gte, join, parse, resolve } from "./src/dev/deps.ts"; +import { join, parse, resolve } from "./src/dev/deps.ts"; import { error } from "./src/dev/error.ts"; -import { collect, generate } from "./src/dev/mod.ts"; +import { collect, ensureMinDenoVersion, generate } from "./src/dev/mod.ts"; -const MIN_VERSION = "1.23.0"; - -// Check that the minimum supported Deno version is being used. -if (!gte(Deno.version.deno, MIN_VERSION)) { - let message = - `Deno version ${MIN_VERSION} or higher is required. Please update Deno.\n\n`; - - if (Deno.execPath().includes("homebrew")) { - message += - "You seem to have installed Deno via homebrew. To update, run: `brew upgrade deno`\n"; - } else { - message += "To update, run: `deno upgrade`\n"; - } - - error(message); -} +ensureMinDenoVersion(); const help = `fresh-init @@ -110,9 +95,7 @@ await Deno.writeTextFile( IMPORT_MAP_JSON, ); -const ROUTES_INDEX_TSX = `/** @jsx h */ -import { h } from "preact"; -import Counter from "../islands/Counter.tsx"; +const ROUTES_INDEX_TSX = `import Counter from "../islands/Counter.tsx"; export default function Home() { return ( @@ -136,10 +119,10 @@ await Deno.writeTextFile( ROUTES_INDEX_TSX, ); -const COMPONENTS_BUTTON_TSX = `/** @jsx h */ -import { h } from "preact"; +const COMPONENTS_BUTTON_TSX = `import { JSX } from "preact"; import { IS_BROWSER } from "$fresh/runtime.ts"; -export function Button(props: h.JSX.HTMLAttributes) { + +export function Button(props: JSX.HTMLAttributes) { return (