Skip to content

Commit 51a4ef7

Browse files
authored
chore: upgrade to Fresh 2 (#558)
1 parent 563c08a commit 51a4ef7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3105
-1867
lines changed

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ making changes to the API.
114114

115115
### Running jsr
116116

117-
1. `deno task services:macos`, `deno task services:macos:amd` or `deno task services:linux` in one terminal
117+
1. `deno task services:macos`, `deno task services:macos:amd` or
118+
`deno task services:linux` in one terminal
118119
2. `deno task dev:api` in another terminal
119120
3. `deno task dev:frontend` in another terminal
120121

@@ -135,10 +136,12 @@ registry with data is to publish
135136
[deno_std](https://github.com/denoland/deno_std) to the registry. This can be
136137
done via the following steps:
137138

138-
1. Make sure to [make yourself a staff user/admin](#making-yourself-a-staff-useradmin).
139+
1. Make sure to
140+
[make yourself a staff user/admin](#making-yourself-a-staff-useradmin).
139141
2. Navigate to your profile page and copy the UUID from the URL.
140-
3. Assign the `std` scope to your user through the [admin panel](http://jsr.test/admin/scopes/assign)
141-
by using the UUID from the previous step.
142+
3. Assign the `std` scope to your user through the
143+
[admin panel](http://jsr.test/admin/scopes/assign) by using the UUID from the
144+
previous step.
142145
4. Clone https://github.com/denoland/deno_std in the same parent folder as the
143146
`jsr` project.
144147
5. Run `JSR_URL=http://jsr.test deno publish` to publish all of the @std

deno.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"services:linux": "docker compose up & ./tools/bin/linux-amd64/fake-gcs-server -scheme http -port 4080 -filesystem-root=.gcs & ./tools/server.ts",
66
"services:linux-no-postgres": "docker compose up jaeger & ./tools/bin/linux-amd64/fake-gcs-server -scheme http -port 4080 -filesystem-root=.gcs & ./tools/server.ts",
77
"dev:api": "cd api && cargo run",
8-
"dev:frontend": "cd frontend && OLTP_ENDPOINT=http://localhost:4318 deno task start",
9-
"prod:frontend": "deno run -A --watch ./tools/prod_proxy.ts & cd frontend && API_ROOT=https://api.jsr.io deno task start",
10-
"lint": "deno task lint:frontend && deno task lint:license",
11-
"lint:frontend": "cd frontend && deno lint && deno check --allow-import=googleapis.deno.dev,deno.land,jsr.io,esm.sh main.ts",
8+
"dev:frontend": "cd frontend && OLTP_ENDPOINT=http://localhost:4318 deno task dev",
9+
"prod:frontend": "deno run -A --watch ./tools/prod_proxy.ts & cd frontend && API_ROOT=https://api.jsr.io deno task dev",
10+
"lint": "deno task lint:frontend && deno task lint:tools && deno task lint:license",
11+
"lint:frontend": "cd frontend && deno lint && deno check --allow-import=googleapis.deno.dev,deno.land,jsr.io dev.ts main.ts routes/**/*.tsx routes/**/*.ts",
12+
"lint:tools": "deno lint tools/ && deno check --allow-import=googleapis.deno.dev,deno.land,jsr.io tools/**/*.ts",
1213
"lint:license": "deno run --allow-read jsr:@kt3k/[email protected]/main -q",
1314
"lint:license:fix": "deno run --allow-read --allow-write jsr:@kt3k/[email protected]/main -q --inject",
1415
"tools:orama:package_reindex": "deno run --allow-env --allow-net tools/orama_package_reindex.ts",
@@ -34,15 +35,14 @@
3435
"target/",
3536
"api/testdata/",
3637
".gcs/",
37-
"frontend/_fresh"
38+
"frontend/_fresh",
39+
"e2e/vendor"
3840
],
39-
"compilerOptions": {
40-
"jsx": "react-jsx",
41-
"jsxImportSource": "npm:preact"
42-
},
4341
"imports": {
44-
"@deno/gfm": "jsr:@deno/gfm@^0.8.0",
45-
"github-slugger": "npm:github-slugger@^2.0",
46-
"std/": "https://deno.land/[email protected]/"
42+
"@deno/gfm": "jsr:@deno/gfm@^0.10.0",
43+
"@std/async": "jsr:@std/async@^1.0.8",
44+
"@std/front-matter": "jsr:@std/front-matter@^1.0.5",
45+
"@std/path": "jsr:@std/path@^1.0.8",
46+
"github-slugger": "npm:github-slugger@^2.0.0"
4747
}
4848
}

deno.lock

+46-216
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
FROM denoland/deno:alpine-2.0.3
1+
FROM denoland/deno:alpine-2.0.5
2+
23
WORKDIR /app
3-
RUN mkdir /deno_dir
4-
ENV DENO_DIR /deno_dir
54

65
COPY . .
76

87
RUN deno task build
9-
RUN deno cache --allow-import main.ts
8+
RUN rm -rf $DENO_DIR
9+
RUN deno install --allow-import -e main.ts
10+
11+
RUN timeout 2s deno run -A --cached-only main.ts || true
1012

1113
CMD ["run", "-A", "--cached-only", "main.ts"]

frontend/README.md

-16
This file was deleted.

frontend/components/HomepageHero.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2-
import { asset, Head } from "$fresh/runtime.ts";
2+
import { asset } from "fresh/runtime";
33
import { GlobalSearch } from "../islands/GlobalSearch.tsx";
44
import { HomepageHeroParticles } from "../islands/HomepageHeroParticles.tsx";
55
import { AnimatedLogo } from "./AnimatedLogo.tsx";
@@ -28,11 +28,9 @@ export function HomepageHero(
2828
class="w-screen -ml-[calc(50vw-50%)] -mt-6 bg-repeat py-32 lg:pt-48 relative before:absolute before:left-0 before:right-0 before:h-32 before:bg-gradient-to-t before:from-white before:bottom-0 before:z-10 before:pointer-events-none"
2929
id="particles-js"
3030
>
31-
<HomepageHeroParticles />
32-
<Head>
33-
<script src={asset("/scripts/particles.js")} defer></script>
34-
</Head>
31+
<script src={asset("/scripts/particles.js")} defer></script>
3532
<style>{canvasStyle}</style>
33+
<HomepageHeroParticles />
3634
<div class="section-x-inset-xl flex flex-col items-center justify-center gap-12 relative pointer-events-none">
3735
<div class="text-center">
3836
<h1 class="relative z-10 flex flex-col items-center gap-6 lg:gap-8">

frontend/components/List.tsx

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
22
import { PaginationData } from "../util.ts";
3-
import { Head } from "$fresh/src/runtime/head.ts";
43
import { ChevronRight } from "./icons/ChevronRight.tsx";
54
import { ComponentChildren } from "preact";
65

@@ -78,18 +77,6 @@ function Pagination(
7877
class="flex items-center justify-between border-t border-jsr-cyan-900/10 bg-white px-4 py-3 sm:px-6"
7978
aria-label="Pagination"
8079
>
81-
<Head>
82-
{hasPrevious && (
83-
<link rel="prev" href={prevURL.pathname + prevURL.search} />
84-
)}
85-
{hasNext && (
86-
<link
87-
rel="next"
88-
href={nextURL.pathname + nextURL.search}
89-
/>
90-
)}
91-
</Head>
92-
9380
<div class="hidden sm:block">
9481
<p class="text-sm text-jsr-gray-700">
9582
{start + itemsCount === 0 ? "No results found" : (
@@ -103,7 +90,7 @@ function Pagination(
10390
</p>
10491
</div>
10592
<div class="flex flex-1 justify-between sm:justify-end">
106-
{pagination.page > 1
93+
{hasPrevious
10794
? (
10895
<a
10996
href={prevURL.pathname + prevURL.search}
@@ -113,7 +100,7 @@ function Pagination(
113100
</a>
114101
)
115102
: <span />}
116-
{itemsCount >= pagination.limit
103+
{hasNext
117104
? (
118105
<a
119106
href={nextURL.pathname + nextURL.search}

frontend/components/Markdown.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
2-
import { Marked, render } from "$gfm";
3-
import { markedSmartypants } from "$marked-smartypants";
2+
import { Marked, render } from "@deno/gfm";
3+
import { markedSmartypants } from "marked-smartypants";
44

5-
import "https://esm.sh/prismjs@1.29.0/components/prism-json?no-check";
6-
import "https://esm.sh/prismjs@1.29.0/components/prism-typescript?no-check";
7-
import "https://esm.sh/prismjs@1.29.0/components/prism-jsx?no-check";
8-
import "https://esm.sh/prismjs@1.29.0/components/prism-tsx?no-check";
9-
import "https://esm.sh/prismjs@1.29.0/components/prism-bash?no-check";
10-
import "https://esm.sh/prismjs@1.29.0/components/prism-diff?no-check";
5+
import "prismjs/components/prism-json.js";
6+
import "prismjs/components/prism-typescript.js";
7+
import "prismjs/components/prism-jsx.js";
8+
import "prismjs/components/prism-tsx.js";
9+
import "prismjs/components/prism-bash.js";
10+
import "prismjs/components/prism-diff.js";
1111

1212
Marked.marked.use(markedSmartypants());
1313

frontend/components/Table.tsx

-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
22

33
import { ComponentChild, ComponentChildren } from "preact";
4-
import { Head } from "$fresh/runtime.ts";
54
import { ChevronLeft } from "./icons/ChevronLeft.tsx";
65
import { ChevronRight } from "./icons/ChevronRight.tsx";
76
import { PaginationData } from "../util.ts";
@@ -80,18 +79,6 @@ function Pagination(
8079

8180
return (
8281
<div class="flex items-center gap-3 text-jsr-gray-700">
83-
<Head>
84-
{hasPrevious && (
85-
<link rel="prev" href={prevURL.pathname + prevURL.search} />
86-
)}
87-
{hasNext && (
88-
<link
89-
rel="next"
90-
href={nextURL.pathname + nextURL.search}
91-
/>
92-
)}
93-
</Head>
94-
9582
{hasPrevious && (
9683
<a
9784
href={prevURL.pathname + prevURL.search}

frontend/deno.json

+39-27
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,62 @@
11
{
2-
"lock": false,
32
"nodeModulesDir": "auto",
43
"tasks": {
54
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
6-
"start": "deno run -A --watch=static/,routes/ dev.ts",
5+
"dev": "deno run -A --watch=static/,routes/ dev.ts",
76
"build": "deno run -A dev.ts build",
8-
"preview": "deno run -A main.ts",
9-
"update": "deno run -A -r https://fresh.deno.dev/update ."
7+
"start": "deno run -A main.ts",
8+
"update": "deno run -A -r jsr:@fresh/update ."
109
},
1110
"lint": {
1211
"rules": {
13-
"tags": [
14-
"fresh",
15-
"recommended"
16-
]
12+
"tags": ["fresh", "recommended"]
1713
}
1814
},
1915
"imports": {
20-
"$fresh/": "https://deno.land/x/[email protected]/",
21-
"preact": "npm:[email protected]",
16+
"fresh": "jsr:@fresh/core@^2.0.0-alpha.25",
17+
"@fresh/plugin-tailwind": "jsr:@fresh/plugin-tailwind@^0.0.1-alpha.7",
18+
19+
"preact": "npm:preact@^10",
2220
"preact-render-to-string": "npm:[email protected]",
2321
"@preact/signals": "npm:@preact/[email protected]",
24-
"@preact/signals-core": "npm:@preact/[email protected]",
25-
"$std/path": "jsr:@std/path@1",
26-
"$std/http": "jsr:@std/http@1",
27-
"$std/front-matter": "jsr:@std/front-matter@1",
28-
"$std/semver": "jsr:@std/semver@1",
29-
"$std/": "https://deno.land/[email protected]/",
30-
"$twas": "npm:[email protected]",
31-
"$gfm": "jsr:@deno/[email protected]",
32-
"$oak_commons": "https://deno.land/x/[email protected]/negotiation.ts",
33-
"$marked-smartypants": "npm:[email protected]",
22+
23+
"@std/path": "jsr:@std/path@1",
24+
"@std/http": "jsr:@std/http@1",
25+
"@std/front-matter": "jsr:@std/front-matter@1",
26+
"@std/semver": "jsr:@std/semver@1",
27+
28+
"twas": "npm:twas@^2.1.3",
3429
"$tabler_icons/": "https://deno.land/x/[email protected]/tsx/",
3530
"$imagescript": "https://deno.land/x/[email protected]/mod.ts",
31+
32+
"@deno/gfm": "jsr:@deno/[email protected]",
33+
"marked-smartypants": "npm:[email protected]",
34+
"prismjs": "npm:prismjs@^1.29.0",
35+
3636
"@orama/orama": "npm:@orama/orama@^2",
37-
"@orama/highlight": "npm:@orama/highlight@^0.1",
37+
"@orama/highlight": "npm:@orama/highlight@^0.1.8",
3838
"@oramacloud/client": "npm:@oramacloud/client@^1",
39+
3940
"tailwindcss": "npm:[email protected]",
4041
"postcss": "npm:[email protected]"
4142
},
4243
"compilerOptions": {
43-
"jsx": "react-jsx",
44-
"jsxImportSource": "preact"
44+
"lib": [
45+
"dom",
46+
"dom.iterable",
47+
"dom.asynciterable",
48+
"deno.ns"
49+
],
50+
"jsx": "precompile",
51+
"jsxImportSource": "preact",
52+
"jsxPrecompileSkipElements": [
53+
"a",
54+
"img",
55+
"source",
56+
"body",
57+
"html",
58+
"head"
59+
]
4560
},
46-
"exclude": [
47-
"_fresh/",
48-
"**/_fresh/*"
49-
]
61+
"exclude": ["_fresh/", "**/_fresh/*"]
5062
}

0 commit comments

Comments
 (0)