-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: really basic full-stack application
- Loading branch information
Showing
16 changed files
with
346 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.js | ||
*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-present The Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @typed/fx-tracing | ||
|
||
> WIP | ||
Docs: https://tylors.github.io/typed/docs/fx-tracing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@typed/example-counter", | ||
"private": true, | ||
"version": "0.0.0", | ||
"description": "", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tylors/typed.git" | ||
}, | ||
"homepage": "https://github.com/tylors/typed", | ||
"scripts": { | ||
"build": "vavite", | ||
"start": "vite --config ./vite.config.mts serve --force src" | ||
}, | ||
"keywords": [], | ||
"author": "Typed contributors", | ||
"license": "MIT", | ||
"sideEffects": [], | ||
"dependencies": { | ||
"@effect/platform": "^0.66.2", | ||
"@effect/platform-node": "^0.61.3", | ||
"@typed/core": "workspace:*", | ||
"@typed/fx": "workspace:*", | ||
"@typed/route": "workspace:*", | ||
"@typed/router": "workspace:*", | ||
"@typed/template": "workspace:*", | ||
"effect": "3.8.4" | ||
}, | ||
"devDependencies": { | ||
"tsx": "^4.19.1", | ||
"vavite": "^4.1.1", | ||
"@typed/vite-plugin": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as Fx from "@typed/fx" | ||
import * as RefSubject from "@typed/fx/RefSubject" | ||
import * as Route from "@typed/route" | ||
import * as Router from "@typed/router" | ||
import { html } from "@typed/template" | ||
|
||
const CounterRoute = Route.literal("counter") | ||
const Counter = Fx.gen(function*() { | ||
const count = yield* RefSubject.of(0) | ||
|
||
return html`<div> | ||
<p>Count: ${count}</p> | ||
<button onclick=${RefSubject.decrement(count)}>-</button> | ||
<button onclick=${RefSubject.increment(count)}>+</button> | ||
</div>` | ||
}) | ||
|
||
const HelloRoute = Route.home | ||
const Hello = html`<h1>Hello World</h1>` | ||
|
||
export const router = Router | ||
.match(CounterRoute, () => Counter) | ||
.match(HelloRoute, () => Hello) | ||
|
||
export const App = router.pipe(Router.redirectTo(HelloRoute)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { fromWindow } from "@typed/core" | ||
import { hydrateToLayer } from "@typed/template" | ||
import { Effect, Layer } from "effect" | ||
import { App } from "./app" | ||
|
||
App.pipe( | ||
hydrateToLayer, | ||
Layer.provide(fromWindow(window)), | ||
Layer.launch, | ||
Effect.scoped, | ||
Effect.runFork | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Fx, RenderEvent } from "@typed/core" | ||
import { html } from "@typed/core" | ||
import * as Node from "@typed/core/Node" | ||
import type { LayoutParams } from "@typed/core/Platform" | ||
import { toServerRouter } from "@typed/core/Platform" | ||
import { router } from "./app" | ||
|
||
const layout = <Content extends Fx.Fx<RenderEvent | null, any, any>>({ content, script }: LayoutParams<Content>) => | ||
html`<!doctype html> | ||
<html> | ||
<head> | ||
<title>Simple Fullstack</title> | ||
</head> | ||
<body> | ||
${content} | ||
${script} | ||
</body> | ||
</html>` | ||
|
||
toServerRouter(router, { layout, clientEntry: "browser" }).pipe( | ||
Node.listen({ port: 3000, serverDirectory: import.meta.dirname }), | ||
Node.run | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"extends": [ | ||
"../../tsconfig.base.json" | ||
], | ||
"compilerOptions": { | ||
"outDir": "build/esm", | ||
"declarationDir": "build/dts", | ||
"tsBuildInfoFile": "build/tsbuildinfo/esm.tsbuildinfo", | ||
"rootDir": "src" | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../../packages/core/tsconfig.build.json" | ||
}, | ||
{ | ||
"path": "../../packages/fx/tsconfig.build.json" | ||
}, | ||
{ | ||
"path": "../../packages/route/tsconfig.build.json" | ||
}, | ||
{ | ||
"path": "../../packages/router/tsconfig.build.json" | ||
}, | ||
{ | ||
"path": "../../packages/template/tsconfig.build.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"tsBuildInfoFile": "build/tsbuildinfo/tsconfig.tsbuildinfo" | ||
}, | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.build.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { makeTypedPlugin } from "@typed/vite-plugin" | ||
import { join } from "path" | ||
import { defineConfig } from "vite" | ||
|
||
const foldersToExclude = ["tempo-data", "data", "dist", "node_modules"].map((folder) => | ||
join(import.meta.dirname, `${folder}/**`) | ||
) | ||
|
||
export default defineConfig({ | ||
envDir: import.meta.dirname, | ||
server: { | ||
host: "0.0.0.0", | ||
watch: { | ||
ignored: foldersToExclude | ||
} | ||
}, | ||
plugins: [ | ||
makeTypedPlugin({ | ||
clientEntries: { | ||
browser: "./src/browser.ts" | ||
}, | ||
serverEntry: "./src/server.ts", | ||
tsconfig: "tsconfig.build.json" | ||
}) | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference types="vitest" /> | ||
|
||
import { dirname } from "path" | ||
import { fileURLToPath } from "url" | ||
import { defineConfig, mergeConfig } from "vite" | ||
import { makeTestConfig } from "../../vitest-make-config.mjs" | ||
|
||
const directory = dirname(fileURLToPath(import.meta.url)) | ||
const config = mergeConfig( | ||
makeTestConfig(directory), | ||
defineConfig({ | ||
test: {} | ||
}) | ||
) | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
], | ||
"references": [ | ||
{ | ||
"path": "../core/tsconfig.build.json" | ||
"path": "../core/tsconfig.test.json" | ||
} | ||
] | ||
} |
Oops, something went wrong.