Skip to content
This repository was archived by the owner on Sep 21, 2025. It is now read-only.

Commit 2c40664

Browse files
Update Deno to 2.1 LTS!
1 parent 1226284 commit 2c40664

File tree

10 files changed

+180
-41
lines changed

10 files changed

+180
-41
lines changed

.dvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.46.3
1+
2.1.2

.github/FUNDING.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
github: [BrunoBernardino]
2-
custom: ["https://paypal.me/brunobernardino", "https://gist.github.com/BrunoBernardino/ff5b54c13dd96ac7f9fee6fbfd825b09"]
2+
custom: [
3+
'https://paypal.me/brunobernardino',
4+
'https://gist.github.com/BrunoBernardino/ff5b54c13dd96ac7f9fee6fbfd825b09',
5+
]

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10-
- uses: denoland/setup-deno@v1
10+
- uses: denoland/setup-deno@v2
1111
with:
1212
deno-version-file: .dvmrc
1313
- run: |

deno.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"react-dom": "https://esm.sh/[email protected]",
3737
"react-dom/": "https://esm.sh/[email protected]/",
3838

39-
"std/assert/equals": "jsr:@std/[email protected].6/equals",
40-
"std/http/file-server": "jsr:@std/[email protected].7/file-server",
41-
"deno/emit": "jsr:@deno/emit@0.45.0"
39+
"std/assert/equals": "jsr:@std/[email protected].8/equals",
40+
"std/http/file-server": "jsr:@std/[email protected].11/file-server",
41+
"deno/emit": "jsr:@deno/emit@0.46.0"
4242
}
4343
}

pages/form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function pageAction(request: Request, match: URLPatternResult) {
2222
throw new Error('The random value needs to have "something" in it');
2323
}
2424
} catch (error) {
25-
errorMessage = error.toString();
25+
errorMessage = error instanceof Error ? error.toString() : 'Unknown error';
2626
}
2727

2828
const errorHtml = errorMessage

pages/web-component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function generateHtmlContent() {
2323
That means you can press the button to set its value to a random positive integer (up to 10000), fetched via an API route.
2424
</p>
2525
<p>
26-
It uses Just-In-Time (JIT) transpiled TypeScript inspired by <a href="https://github.com/ayame113/ts-serve">ts-serve</a>, and <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</a>.
26+
It uses Just-In-Time (JIT) transpiled TypeScript inspired by <a href="https://github.com/ayame113/ts-serve">ts-serve</a>, and <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</a> (<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is">it doesn't work on Safari</a>).
2727
</p>
2828
<p>Enjoy it!</p>
2929
<button is="app-button">

public/css/style.css

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,129 @@
11
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2-
html {line-height: 1.15;-webkit-text-size-adjust: 100%;}body {margin: 0;}main {display: block;}h1 {font-size: 2em;margin: 0.67em 0;}hr {box-sizing: content-box;height: 0;overflow: visible;}pre {font-family: monospace, monospace;font-size: 1em;}a {background-color: transparent;}abbr[title] {border-bottom: none;text-decoration: underline;text-decoration: underline dotted;}b, strong {font-weight: bolder;}code, kbd, samp {font-family: monospace, monospace;font-size: 1em;}small {font-size: 80%;}sub, sup {font-size: 75%;line-height: 0;position: relative;vertical-align: baseline;}sub {bottom: -0.25em;}sup {top: -0.5em;}img {border-style: none;}button, input, optgroup, select, textarea {font-family: inherit;font-size: 100%;line-height: 1.15;margin: 0;}button, input {overflow: visible;}button, select {text-transform: none;}button, [type="button"], [type="reset"], [type="submit"] {-webkit-appearance: button;}button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner {border-style: none;padding: 0;}button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring {outline: 1px dotted ButtonText;}fieldset {padding: 0.35em 0.75em 0.625em;}legend {box-sizing: border-box;color: inherit;display: table;max-width: 100%;padding: 0;white-space: normal;}progress {vertical-align: baseline;}textarea {overflow: auto;}[type="checkbox"], [type="radio"] {box-sizing: border-box;padding: 0;}[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button {height: auto;}[type="search"] {-webkit-appearance: textfield;outline-offset: -2px;}[type="search"]::-webkit-search-decoration {-webkit-appearance: none;}::-webkit-file-upload-button {-webkit-appearance: button;font: inherit;}details {display: block;}summary {display: list-item;}template {display: none;}[hidden] {display: none;}
2+
html {
3+
line-height: 1.15;
4+
-webkit-text-size-adjust: 100%;
5+
}
6+
body {
7+
margin: 0;
8+
}
9+
main {
10+
display: block;
11+
}
12+
h1 {
13+
font-size: 2em;
14+
margin: 0.67em 0;
15+
}
16+
hr {
17+
box-sizing: content-box;
18+
height: 0;
19+
overflow: visible;
20+
}
21+
pre {
22+
font-family: monospace, monospace;
23+
font-size: 1em;
24+
}
25+
a {
26+
background-color: transparent;
27+
}
28+
abbr[title] {
29+
border-bottom: none;
30+
text-decoration: underline;
31+
text-decoration: underline dotted;
32+
}
33+
b, strong {
34+
font-weight: bolder;
35+
}
36+
code, kbd, samp {
37+
font-family: monospace, monospace;
38+
font-size: 1em;
39+
}
40+
small {
41+
font-size: 80%;
42+
}
43+
sub, sup {
44+
font-size: 75%;
45+
line-height: 0;
46+
position: relative;
47+
vertical-align: baseline;
48+
}
49+
sub {
50+
bottom: -0.25em;
51+
}
52+
sup {
53+
top: -0.5em;
54+
}
55+
img {
56+
border-style: none;
57+
}
58+
button, input, optgroup, select, textarea {
59+
font-family: inherit;
60+
font-size: 100%;
61+
line-height: 1.15;
62+
margin: 0;
63+
}
64+
button, input {
65+
overflow: visible;
66+
}
67+
button, select {
68+
text-transform: none;
69+
}
70+
button, [type='button'], [type='reset'], [type='submit'] {
71+
-webkit-appearance: button;
72+
}
73+
button::-moz-focus-inner,
74+
[type='button']::-moz-focus-inner,
75+
[type='reset']::-moz-focus-inner,
76+
[type='submit']::-moz-focus-inner {
77+
border-style: none;
78+
padding: 0;
79+
}
80+
button:-moz-focusring, [type='button']:-moz-focusring, [type='reset']:-moz-focusring, [type='submit']:-moz-focusring {
81+
outline: 1px dotted ButtonText;
82+
}
83+
fieldset {
84+
padding: 0.35em 0.75em 0.625em;
85+
}
86+
legend {
87+
box-sizing: border-box;
88+
color: inherit;
89+
display: table;
90+
max-width: 100%;
91+
padding: 0;
92+
white-space: normal;
93+
}
94+
progress {
95+
vertical-align: baseline;
96+
}
97+
textarea {
98+
overflow: auto;
99+
}
100+
[type='checkbox'], [type='radio'] {
101+
box-sizing: border-box;
102+
padding: 0;
103+
}
104+
[type='number']::-webkit-inner-spin-button, [type='number']::-webkit-outer-spin-button {
105+
height: auto;
106+
}
107+
[type='search'] {
108+
-webkit-appearance: textfield;
109+
outline-offset: -2px;
110+
}
111+
[type='search']::-webkit-search-decoration {
112+
-webkit-appearance: none;
113+
}
114+
::-webkit-file-upload-button {
115+
-webkit-appearance: button;
116+
font: inherit;
117+
}
118+
details {
119+
display: block;
120+
}
121+
summary {
122+
display: list-item;
123+
}
124+
template {
125+
display: none;
126+
}
127+
[hidden] {
128+
display: none;
129+
}

public/scss/style.scss

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@
1313

1414
html,
1515
body {
16-
font: 16px/16px 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
17-
'Fira Sans', 'Droid Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
16+
font:
17+
16px/16px 'Segoe UI',
18+
'Roboto',
19+
'Oxygen',
20+
'Ubuntu',
21+
'Cantarell',
22+
'Fira Sans',
23+
'Droid Sans',
24+
'Helvetica Neue',
25+
Helvetica,
26+
Arial,
27+
sans-serif;
1828
background: var(--color-background);
1929
background-size: cover;
2030
color: var(--color-text);
@@ -84,12 +94,12 @@ header {
8494
color: var(--color-link-hover);
8595
}
8696

87-
@media only screen and (min-width : 600px) {
97+
@media only screen and (min-width: 600px) {
8898
margin: 0 0.3rem;
8999
}
90100
}
91101

92-
@media only screen and (min-width : 600px) {
102+
@media only screen and (min-width: 600px) {
93103
display: flex;
94104
flex: 1;
95105
flex-wrap: nowrap;
@@ -98,7 +108,7 @@ header {
98108
}
99109
}
100110

101-
@media only screen and (min-width : 600px) {
111+
@media only screen and (min-width: 600px) {
102112
display: flex;
103113
flex: 1;
104114
flex-wrap: nowrap;
@@ -132,9 +142,9 @@ footer {
132142
font-weight: bold;
133143
}
134144

135-
@media only screen and (min-width : 600px) {
145+
@media only screen and (min-width: 600px) {
136146
margin: 0 0 1rem;
137-
147+
138148
&:after {
139149
content: '/';
140150
display: inline-block;
@@ -144,7 +154,7 @@ footer {
144154
}
145155
}
146156

147-
@media only screen and (min-width : 600px) {
157+
@media only screen and (min-width: 600px) {
148158
display: flex;
149159
flex: 1;
150160
flex-wrap: nowrap;
@@ -164,7 +174,7 @@ footer {
164174
text-decoration: none;
165175
}
166176

167-
@media only screen and (min-width : 600px) {
177+
@media only screen and (min-width: 600px) {
168178
margin-top: 1rem;
169179
}
170180
}
@@ -196,7 +206,7 @@ fieldset {
196206
transition: all 100ms ease-in-out;
197207
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
198208

199-
&> label {
209+
& > label {
200210
font-size: 1rem;
201211
display: block;
202212
margin-bottom: 0.5rem;
@@ -208,15 +218,15 @@ fieldset {
208218
}
209219
}
210220

211-
input[type="text"],
212-
input[type="date"],
213-
input[type="datetime"],
214-
input[type="email"],
215-
input[type="number"],
216-
input[type="search"],
217-
input[type="time"],
218-
input[type="url"],
219-
input[type="password"],
221+
input[type='text'],
222+
input[type='date'],
223+
input[type='datetime'],
224+
input[type='email'],
225+
input[type='number'],
226+
input[type='search'],
227+
input[type='time'],
228+
input[type='url'],
229+
input[type='password'],
220230
textarea,
221231
select {
222232
box-sizing: border-box;
@@ -261,7 +271,7 @@ fieldset {
261271

262272
svg path, svg rect {
263273
fill: rgba(0, 0, 0, 0.8);
264-
filter: drop-shadow( 0 0 5px #000);
274+
filter: drop-shadow(0 0 5px #000);
265275
}
266276

267277
&.hide {
@@ -279,7 +289,7 @@ fieldset {
279289
border-bottom: 3px solid rgb(161, 0, 0);
280290
color: var(--color-text);
281291
background-image: linear-gradient(rgb(255, 166, 166), #faa);
282-
box-shadow: 0 5px 10px rgba(0, 0, 0, .3);
292+
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
283293

284294
h3, p {
285295
font-size: 1.1rem;
@@ -315,7 +325,7 @@ fieldset {
315325
line-height: 1.7rem;
316326
margin-bottom: 1rem;
317327
}
318-
328+
319329
&:last-of-type {
320330
border: none;
321331
}

public/sitemap.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
33
<url>
44
<loc>https://simple-deno-website-boilerplate.onbrn.com/</loc>
5-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
5+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
66
<priority>1.0</priority>
77
</url>
88
<url>
99
<loc>https://simple-deno-website-boilerplate.onbrn.com/ssr</loc>
10-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
10+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
1111
<priority>0.8</priority>
1212
</url>
1313
<url>
1414
<loc>https://simple-deno-website-boilerplate.onbrn.com/dynamic</loc>
15-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
15+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
1616
<priority>0.8</priority>
1717
</url>
1818
<url>
1919
<loc>https://simple-deno-website-boilerplate.onbrn.com/form</loc>
20-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
20+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
2121
<priority>0.8</priority>
2222
</url>
2323
<url>
2424
<loc>https://simple-deno-website-boilerplate.onbrn.com/web-component</loc>
25-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
25+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
2626
<priority>0.8</priority>
2727
</url>
2828
<url>
2929
<loc>https://simple-deno-website-boilerplate.onbrn.com/react</loc>
30-
<lastmod>2024-10-07T12:56:16.058Z</lastmod>
30+
<lastmod>2024-11-29T12:56:16.058Z</lastmod>
3131
<priority>0.8</priority>
3232
</url>
3333
</urlset>

routes.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ function createBasicRouteHandler(id: string, pathname: string) {
5555
// NOTE: Use this instead once https://github.com/denoland/deploy_feedback/issues/433 is closed
5656
// const { pageContent, pageAction }: Page = await import(`./pages/${id}.ts`);
5757

58-
// @ts-ignore necessary because of the comment above
59-
const { pageContent, pageAction }: Page = pages[id];
58+
const { pageContent, pageAction }: Page = pages[id as keyof typeof pages];
6059

6160
if (request.method !== 'GET') {
6261
return pageAction(request, match) as Response;
@@ -72,7 +71,7 @@ function createBasicRouteHandler(id: string, pathname: string) {
7271

7372
return basicLayoutResponse(htmlContent, { currentPath: match.pathname.input, titlePrefix });
7473
} catch (error) {
75-
if (error.toString().includes('NotFound')) {
74+
if ((error instanceof Error) && error.toString().includes('NotFound')) {
7675
const { htmlContent, titlePrefix } = notFoundPage.pageContent();
7776

7877
return basicLayoutResponse(htmlContent, { titlePrefix, currentPath: match.pathname.input }, 404);
@@ -141,7 +140,7 @@ const routes: Routes = {
141140
response.headers.set('cache-control', `max-age=${oneDayInSeconds}, public`);
142141
return response;
143142
} catch (error) {
144-
if (error.toString().includes('NotFound')) {
143+
if ((error instanceof Error) && error.toString().includes('NotFound')) {
145144
return new Response('Not Found', { status: 404 });
146145
}
147146

0 commit comments

Comments
 (0)