Initial version (#1)
All checks were successful
Build / build (push) Successful in 41s
Lint / lint (push) Successful in 13s

Co-authored-by: Julien Valverdé <julien.valverde@mailo.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2025-09-18 01:26:10 +02:00
parent ab2fff9a9f
commit c0cac90a66
47 changed files with 1633 additions and 0 deletions

34
packages/common/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules
# output
out
dist
*.tgz
# code coverage
coverage
*.lcov
# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# caches
.eslintcache
.cache
*.tsbuildinfo
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

View File

@@ -0,0 +1,18 @@
{
"name": "@website/common",
"private": true,
"type": "module",
"exports": {
"./config": "./src/config/index.ts",
"./webrpc": "./src/webrpc/index.ts",
"./*": "./src/*.ts"
},
"scripts": {
"lint:tsc": "tsc --noEmit",
"clean:modules": "rm -rf node_modules"
},
"dependencies": {
"@effect/rpc": "^0.69.2",
"effect": "^3.17.13"
}
}

View File

@@ -0,0 +1,4 @@
import { Config } from "effect"
export const webRpcHttpPath = Config.succeed("/rpc/web" as const)

View File

@@ -0,0 +1 @@
export * as CommonConfig from "./CommonConfig"

View File

@@ -0,0 +1,11 @@
import { Rpc, RpcGroup } from "@effect/rpc"
import { Schema } from "effect"
export class PingV1 extends Rpc.make("Test.PingV1", {
success: Schema.Literal("pong"),
}) {}
export class WebRpcTest extends RpcGroup.make(
PingV1,
) {}

View File

@@ -0,0 +1,10 @@
import { RpcSerialization } from "@effect/rpc"
import * as WebRpcTest from "./WebRpcTest"
export class WebRpc extends WebRpcTest.WebRpcTest {}
export const WebRpcSerializationDevelopment = RpcSerialization.layerJson
export const WebRpcSerializationProduction = RpcSerialization.layerNdjson
export * as WebRpcTest from "./WebRpcTest"

View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,
"plugins": [
{ "name": "@effect/language-service" }
]
}
}