commit b736140b4850a6f8f1353857cabc2c5be9d49a55 Author: Julien Valverdé Date: Sun Dec 28 14:30:54 2025 +0100 Add initial files diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml new file mode 100644 index 0000000..c13cd5d --- /dev/null +++ b/.gitea/workflows/lint.yaml @@ -0,0 +1,18 @@ +name: Lint +run-name: Lint +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + - name: Clone repo + uses: actions/checkout@v6 + - name: Install dependencies + run: bun install --frozen-lockfile + - name: Lint TypeScript + run: bun lint:tsc + - name: Lint Biome + run: bun lint:biome diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml new file mode 100644 index 0000000..ed4fbde --- /dev/null +++ b/.gitea/workflows/publish.yaml @@ -0,0 +1,30 @@ +name: Publish +run-name: Publish +on: + push: + branches: + - master + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + - name: Clone repo + uses: actions/checkout@v6 + - name: Install dependencies + run: bun install --frozen-lockfile + - name: Lint TypeScript + run: bun lint:tsc + - name: Lint Biome + run: bun lint:biome + - name: Build + run: bun run build + - name: Publish react-godot-renderer + uses: JS-DevTools/npm-publish@v4 + with: + package: packages/react-godot-renderer + access: public + token: ${{ secrets.NPM_TOKEN }} + registry: https://registry.npmjs.org diff --git a/.gitea/workflows/test-build.yaml b/.gitea/workflows/test-build.yaml new file mode 100644 index 0000000..729eb00 --- /dev/null +++ b/.gitea/workflows/test-build.yaml @@ -0,0 +1,27 @@ +name: Test build +run-name: Test build +on: + pull_request: + +jobs: + test-build: + runs-on: ubuntu-latest + steps: + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: "24" + - name: Clone repo + uses: actions/checkout@v6 + - name: Install dependencies + run: bun install --frozen-lockfile + - name: Lint TypeScript + run: bun lint:tsc + - name: Lint Biome + run: bun lint:biome + - name: Build + run: bun run build + - name: Pack + run: bun pack diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2519628 --- /dev/null +++ b/.gitignore @@ -0,0 +1,133 @@ +# ---> Node +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +.turbo diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..723e209 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib", + "editor.codeActionsOnSave": { + "source.fixAll.biome": "explicit" + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fe6b51e --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 Thilawyn + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..617c408 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Effect FC Monorepo + +[Effect-TS](https://effect.website/) integration for React 19+ that allows you to write function components using Effect generators. + +This monorepo contains: +- [The `effect-fc` library](packages/effect-fc) +- [An example project](packages/example) diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..2621baf --- /dev/null +++ b/biome.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://biomejs.dev/schemas/latest/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false + }, + "formatter": { + "enabled": false + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { + "useShorthandFunctionType": "off" + }, + "suspicious": { + "noExplicitAny": "off", + "noShadowRestrictedNames": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..d39adf8 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "@react-godot-renderer/monorepo", + "packageManager": "bun@1.3.3", + "private": true, + "workspaces": [ + "./packages/*" + ], + "scripts": { + "build": "turbo build", + "lint:tsc": "turbo lint:tsc", + "lint:biome": "turbo lint:biome", + "pack": "turbo pack", + "clean:cache": "turbo clean:cache", + "clean:dist": "turbo clean:dist", + "clean:modules": "turbo clean:modules && rm -rf node_modules" + }, + "devDependencies": { + "@biomejs/biome": "^2.3.8", + "@effect/language-service": "^0.60.0", + "@types/bun": "^1.3.3", + "npm-check-updates": "^19.1.2", + "npm-sort": "^0.0.4", + "turbo": "^2.6.1", + "typescript": "^5.9.3" + } +} diff --git a/packages/example/biome.json b/packages/example/biome.json new file mode 100644 index 0000000..77ba81c --- /dev/null +++ b/packages/example/biome.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://biomejs.dev/schemas/latest/schema.json", + "root": false, + "extends": "//", + "files": { + "includes": ["./src/**", "!src/routeTree.gen.ts"] + } +} diff --git a/packages/example/package.json b/packages/example/package.json new file mode 100644 index 0000000..9c32aec --- /dev/null +++ b/packages/example/package.json @@ -0,0 +1,42 @@ +{ + "name": "@react-godot-renderer/example", + "version": "0.0.0", + "type": "module", + "private": true, + "scripts": { + "dev": "vite", + "lint:tsc": "tsc --noEmit", + "lint:biome": "biome lint", + "preview": "vite preview", + "clean:cache": "rm -rf .turbo node_modules/.tmp node_modules/.vite* .tanstack", + "clean:dist": "rm -rf dist", + "clean:modules": "rm -rf node_modules" + }, + "devDependencies": { + "@tanstack/react-router": "^1.139.12", + "@tanstack/react-router-devtools": "^1.139.12", + "@tanstack/router-plugin": "^1.139.12", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^5.1.1", + "globals": "^16.5.0", + "react": "^19.2.0", + "react-dom": "^19.2.0", + "type-fest": "^5.2.0", + "vite": "^7.2.6" + }, + "dependencies": { + "@effect/platform": "^0.93.6", + "@effect/platform-browser": "^0.73.0", + "@radix-ui/themes": "^3.2.1", + "@typed/id": "^0.17.2", + "effect": "^3.19.8", + "effect-fc": "workspace:*", + "react-icons": "^5.5.0" + }, + "overrides": { + "@types/react": "^19.2.7", + "effect": "^3.19.8", + "react": "^19.2.0" + } +} diff --git a/packages/react-godot-renderer/README.md b/packages/react-godot-renderer/README.md new file mode 100644 index 0000000..c9c65c2 --- /dev/null +++ b/packages/react-godot-renderer/README.md @@ -0,0 +1,64 @@ +# Effect FC + +[Effect-TS](https://effect.website/) integration for React 19+ that allows you to write function components using Effect generators. + +This library is in early development. While it is (almost) feature complete and mostly usable, expect bugs and quirks. Things are still being ironed out, so ideas and criticisms are more than welcome. + +Documentation is currently being written. In the meantime, you can take a look at the `packages/example` directory. + +## Peer dependencies +- `effect` 3.15+ +- `react` & `@types/react` 19+ + +## Known issues +- React Refresh doesn't work for Effect FC's yet. Page reload is required to view changes. Regular React components are unaffected. + +## What writing components looks like +```typescript +import { Component } from "effect-fc" +import { useOnce, useSubscribables } from "effect-fc/Hooks" +import { Todo } from "./Todo" +import { TodosState } from "./TodosState.service" + + +export class Todos extends Component.makeUntraced("Todos")(function*() { + const state = yield* TodosState + const [todos] = yield* useSubscribables(state.ref) + + yield* useOnce(() => Effect.andThen( + Console.log("Todos mounted"), + Effect.addFinalizer(() => Console.log("Todos unmounted")), + )) + + const TodoFC = yield* Todo + + return ( + + Todos + + + + + {Chunk.map(todos, todo => + + )} + + + ) +}) {} + +const TodosStateLive = TodosState.Default("todos") + +const Index = Component.makeUntraced("Index")(function*() { + const context = yield* useContext(TodosStateLive, { finalizerExecutionMode: "fork" }) + const TodosFC = yield* Effect.provide(Todos, context) + + return +}).pipe( + Component.withRuntime(runtime.context) +) + +export const Route = createFileRoute("/")({ + component: Index +}) +``` diff --git a/packages/react-godot-renderer/biome.json b/packages/react-godot-renderer/biome.json new file mode 100644 index 0000000..41d707b --- /dev/null +++ b/packages/react-godot-renderer/biome.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://biomejs.dev/schemas/latest/schema.json", + "root": false, + "extends": "//", + "files": { + "includes": ["./src/**"] + } +} diff --git a/packages/react-godot-renderer/package.json b/packages/react-godot-renderer/package.json new file mode 100644 index 0000000..384917e --- /dev/null +++ b/packages/react-godot-renderer/package.json @@ -0,0 +1,44 @@ +{ + "name": "react-godot-renderer", + "description": "", + "version": "0.1.0", + "type": "module", + "files": [ + "./README.md", + "./dist" + ], + "license": "MIT", + "repository": { + "url": "git+https://github.com/Thiladev/react-godot-renderer.git" + }, + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./*": [ + { + "types": "./dist/*/index.d.ts", + "default": "./dist/*/index.js" + }, + { + "types": "./dist/*.d.ts", + "default": "./dist/*.js" + } + ] + }, + "scripts": { + "build": "tsc", + "lint:tsc": "tsc --noEmit", + "lint:biome": "biome lint", + "pack": "npm pack", + "clean:cache": "rm -rf .turbo tsconfig.tsbuildinfo", + "clean:dist": "rm -rf dist", + "clean:modules": "rm -rf node_modules" + }, + "peerDependencies": { + "@types/react": "^19.2.0", + "react": "^19.2.0" + } +} diff --git a/packages/react-godot-renderer/src/index.ts b/packages/react-godot-renderer/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/react-godot-renderer/tsconfig.json b/packages/react-godot-renderer/tsconfig.json new file mode 100644 index 0000000..3a9e67c --- /dev/null +++ b/packages/react-godot-renderer/tsconfig.json @@ -0,0 +1,38 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "NodeNext", + "moduleDetection": "force", + "jsx": "react-jsx", + // "allowJs": true, + + // Bundler mode + "moduleResolution": "NodeNext", + // "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + // "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false, + + // Build + "outDir": "./dist", + "declaration": true, + "sourceMap": true, + + "plugins": [ + { "name": "@effect/language-service" } + ] + }, + + "include": ["./src"] +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..1a23465 --- /dev/null +++ b/renovate.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:recommended"], + "baseBranchPatterns": ["next"], + "packageRules": [ + { + "matchManagers": ["bun", "npm"], + "matchUpdateTypes": ["minor", "patch"], + "groupName": "bun minor+patch updates", + "groupSlug": "bun-minor-patch" + }, + { + "matchManagers": ["dockerfile", "docker-compose"], + "matchUpdateTypes": ["minor", "patch", "digest"], + "groupName": "docker minor+patch+digest updates", + "groupSlug": "docker-minor-patch-digest" + } + ] +} diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..75a43f8 --- /dev/null +++ b/turbo.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://turbo.build/schema.json", + + "tasks": { + "lint:tsc": { + "cache": false + }, + "lint:biome": { + "cache": false + }, + "build": { + "dependsOn": ["^build"], + "inputs": ["./src/**"], + "outputs": ["./dist/**"] + }, + "pack": { + "dependsOn": ["^pack"], + "cache": false + }, + "clean:cache": { + "cache": false + }, + "clean:dist": { + "cache": false + }, + "clean:modules": { + "cache": false + } + } +}