Skip to content

Commit c0bee88

Browse files
committed
added temp boilerplate codes and shims.
1 parent 5000746 commit c0bee88

36 files changed

+381
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ etc/coverage/*.json
2626
etc/coverage/cov_profile.lcov
2727

2828
# hidden
29-
tmp/
29+
tmp/_hidden/

src/shims/error-event/error-event.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Taken from: https://github.com/oakserver/oak/blob/main/node_shims.ts
2+
// Copyright 2018-2022 the oak authors. All rights reserved. MIT license.
3+
4+
export class ErrorEvent extends Event {
5+
#message: string;
6+
#filename: string;
7+
#lineno: number;
8+
#colno: number;
9+
// deno-lint-ignore no-explicit-any
10+
#error: any;
11+
12+
get message(): string {
13+
return this.#message;
14+
}
15+
get filename(): string {
16+
return this.#filename;
17+
}
18+
get lineno(): number {
19+
return this.#lineno;
20+
}
21+
get colno(): number {
22+
return this.#colno;
23+
}
24+
// deno-lint-ignore no-explicit-any
25+
get error(): any {
26+
return this.#error;
27+
}
28+
29+
constructor(type: string, eventInitDict: ErrorEventInit = {}) {
30+
super(type, eventInitDict);
31+
const { message = "error", filename = "", lineno = 0, colno = 0, error } =
32+
eventInitDict;
33+
this.#message = message;
34+
this.#filename = filename;
35+
this.#lineno = lineno;
36+
this.#colno = colno;
37+
this.#error = error;
38+
}
39+
}

src/shims/error-event/oak-LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018-2022 the oak authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

tmp/boilerplate/.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*.md]
4+
trim_trailing_whitespace = false
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true

tmp/boilerplate/.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text eol=lf
3+
4+
*.png binary
5+
*.jpg binary
6+
*.ico binary
7+
*.jpg binary
8+
*.eot binary
9+
*.ttf binary
10+
*.woff binary
11+
*.woff2 binary

tmp/boilerplate/.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# OS-specific files
4+
.DS_Store
5+
Thumbs.db
6+
7+
# Editor metadata
8+
.vscode/*
9+
!.vscode/extensions.json
10+
!.vscode/settings.json
11+
.idea/
12+
13+
# local API keys and secrets
14+
.env.local
15+
.env.*.local
16+
17+
# sensitive files
18+
*.pem
19+
*.swp
20+
21+
# typescript
22+
*.tsbuildinfo
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"denoland.vscode-deno"
4+
]
5+
}

tmp/boilerplate/.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"deno.enable": true,
3+
"deno.lint": true,
4+
"deno.unstable": true,
5+
"editor.defaultFormatter": "denoland.vscode-deno"
6+
}

tmp/boilerplate/deno.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true
4+
},
5+
"lint": {
6+
"files": {
7+
"include": [
8+
"src/",
9+
"mod.ts",
10+
"*.md",
11+
"*.json"
12+
],
13+
"exclude": []
14+
},
15+
"rules": {
16+
"tags": [
17+
"recommended"
18+
],
19+
"include": [],
20+
"exclude": []
21+
}
22+
},
23+
"fmt": {
24+
"files": {
25+
"include": [
26+
"src/",
27+
"mod.ts",
28+
"*.md",
29+
"*.json"
30+
],
31+
"exclude": []
32+
}
33+
},
34+
"test": {
35+
"files": {
36+
"include": [
37+
"src/"
38+
],
39+
"exclude": []
40+
}
41+
},
42+
"tasks": {
43+
"test": "deno test ./src/ --coverage=./etc/cov_profile",
44+
"test:coverage": "deno coverage ./etc/cov_profile",
45+
"test:generate-lcov": "deno coverage ./etc/cov_profile --lcov > ./etc/cov_profile/cov_profile.lcov",
46+
"bench": "deno bench ./src/ --unstable",
47+
"start": "deno run -A --watch=src/,public/ dev.ts"
48+
},
49+
"importMap": "./import_map.json"
50+
}

tmp/boilerplate/dev.ts

Whitespace-only changes.

tmp/boilerplate/etc/cov_profile/.gitkeep

Whitespace-only changes.

tmp/boilerplate/hex.config.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const hexConfig = {
2+
urls: {
3+
structure: "/[lang]/[...path]",
4+
rewrites: [
5+
// {
6+
// source: "/",
7+
// destination: "/en/"
8+
// }
9+
],
10+
},
11+
12+
i18n: {
13+
languages: [
14+
"en",
15+
"tr"
16+
]
17+
},
18+
};
19+
20+
export { hexConfig as default, hexConfig };

tmp/boilerplate/import_map.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"imports": {
3+
"_@hex/": "https://deno.land/x/hex/",
4+
"@hex/": "../../src/",
5+
"@app/": "./src/"
6+
}
7+
}

tmp/boilerplate/public/favicon.ico

408 Bytes
Binary file not shown.

tmp/boilerplate/public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Allow: /

tmp/boilerplate/src/app/[...static]/index.module.css

Whitespace-only changes.

tmp/boilerplate/src/app/[...static]/index.translations.ts

Whitespace-only changes.

tmp/boilerplate/src/app/[...static]/index.tsx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const staticPage = {
2+
nameSingular: "StaticPage",
3+
namePlural: "StaticPages",
4+
filePathPattern: "./content/**/*.md",
5+
fields: {
6+
title: {
7+
type: "string",
8+
description: "The title of the static page",
9+
required: true,
10+
},
11+
date: {
12+
type: "date",
13+
description: "The date of the static page",
14+
required: true,
15+
},
16+
url: {
17+
type: "string",
18+
description: "The url of the static page",
19+
resolve: (item) => {
20+
const [, title, lang] = /static\/([^\.]*)\.(.*)/.exec(
21+
item.filePath,
22+
);
23+
24+
return `/${lang}/${title}`;
25+
},
26+
},
27+
},
28+
};
29+
30+
export { staticPage, staticPage as default };

tmp/boilerplate/src/app/_unhandled/index.module.css

Whitespace-only changes.

tmp/boilerplate/src/app/_unhandled/index.translations.ts

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { type Context, results } from "@hex/web/page";
2+
import { type Language } from "@hex/i18n";
3+
4+
interface PageProps {
5+
lang: Language;
6+
}
7+
8+
const Page = function HomeIndex(ctx: Context<PageProps>) {
9+
return results.reactView(
10+
<div>
11+
<h1>Homepage</h1>
12+
</div>,
13+
{
14+
title: "Homepage",
15+
description: "This is the homepage",
16+
layout: "@app/shared/layout/layout.tsx",
17+
},
18+
);
19+
};
20+
21+
export { Page, Page as default };

tmp/boilerplate/src/app/global.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: slategray;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from "https://jspm.dev/react@17.0.2";
2+
3+
import {
4+
dumper,
5+
dumperReact,
6+
executeFromCli,
7+
type HexFunctionInput,
8+
results,
9+
} from "@hex/functions/mod.ts";
10+
import { type Language } from "@hex/i18n/mod.ts";
11+
12+
interface PageProps {
13+
lang: Language;
14+
}
15+
16+
const Page = function HomeIndex(input: HexFunctionInput<PageProps>) {
17+
return results.reactView(
18+
<div>
19+
<h1>Homepage</h1>
20+
</div>,
21+
{
22+
title: "Homepage",
23+
description: "This is the homepage",
24+
layout: "@app/shared/layout/layout.tsx",
25+
},
26+
);
27+
};
28+
29+
const result = executeFromCli(Page);
30+
// dumper(result);
31+
dumperReact(result);
32+
33+
export { Page, Page as default };

tmp/boilerplate/src/app/home/index.module.css

Whitespace-only changes.

tmp/boilerplate/src/app/home/index.translations.ts

Whitespace-only changes.
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from "https://jspm.dev/react@17.0.2";
2+
3+
import {
4+
dumper,
5+
dumperReact,
6+
executeFromCli,
7+
type HexFunctionInput,
8+
results,
9+
} from "@hex/functions/mod.ts";
10+
import { type Language } from "@hex/i18n/mod.ts";
11+
12+
interface PageProps {
13+
lang: Language;
14+
}
15+
16+
const Page = function HomeIndex(input: HexFunctionInput<PageProps>) {
17+
return results.reactView(
18+
<div>
19+
<h1>Homepage</h1>
20+
</div>,
21+
{
22+
title: "Homepage",
23+
description: "This is the homepage",
24+
layout: "@app/shared/layout/layout.tsx",
25+
},
26+
);
27+
};
28+
29+
const result = executeFromCli(Page);
30+
// dumper(result);
31+
dumperReact(result);
32+
33+
export { Page, Page as default };

tmp/boilerplate/src/app/layout.tsx

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { BodyContents, HeadContents } from "@hex/web/page";
2+
import { type Language } from "@hex/i18n";
3+
4+
interface LayoutProps {
5+
lang: Language;
6+
children: JSX.Element;
7+
}
8+
9+
const Layout = function Layout(props: LayoutProps) {
10+
return (
11+
<html lang={props.lang.code}>
12+
<head>
13+
<meta charSet="utf-8" />
14+
<meta
15+
name="viewport"
16+
content="width=device-width, initial-scale=1.0"
17+
/>
18+
<link rel="icon" href="/favicon.ico" />
19+
20+
<HeadContents />
21+
</head>
22+
<body>
23+
<div id="app">
24+
<Routes content={props.children}>
25+
<PathBasedRoutes />
26+
</Routes>
27+
</div>
28+
29+
<BodyContents />
30+
</body>
31+
</html>
32+
);
33+
};
34+
35+
export { Layout, Layout as default };

tmp/boilerplate/src/app/stories/[slug]/index.module.css

Whitespace-only changes.

tmp/boilerplate/src/app/stories/[slug]/index.translations.ts

Whitespace-only changes.

tmp/boilerplate/src/app/stories/[slug]/index.tsx

Whitespace-only changes.

0 commit comments

Comments
 (0)