-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
154 additions
and
6 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Example", | ||
"name": "example", | ||
"private": true, | ||
"scripts": { | ||
"dev": "bun run --hot src/index.tsx" | ||
|
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 @@ | ||
This is a [Farc](https://farc.dev) project bootstrapped with `create-farc`. |
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,24 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# production | ||
/docs/dist | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
# vercel | ||
.vercel |
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,67 @@ | ||
import { Button, Farc, TextInput } from 'farc' | ||
import { handle } from 'hono/vercel' | ||
|
||
const app = new Farc({ basePath: '/api' }) | ||
|
||
export const config = { | ||
// runtime: 'edge', // Uncomment to use Edge Runtime | ||
} | ||
|
||
app.frame('/', (context) => { | ||
const { buttonValue, inputText, status } = context | ||
const fruit = inputText || buttonValue | ||
return { | ||
image: ( | ||
<div | ||
style={{ | ||
alignItems: 'center', | ||
background: | ||
status === 'response' | ||
? 'linear-gradient(to right, #432889, #17101F)' | ||
: 'black', | ||
backgroundSize: '100% 100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flexWrap: 'nowrap', | ||
height: '100%', | ||
justifyContent: 'center', | ||
textAlign: 'center', | ||
width: '100%', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
color: 'white', | ||
fontSize: 60, | ||
fontStyle: 'normal', | ||
letterSpacing: '-0.025em', | ||
lineHeight: 1.4, | ||
marginTop: 30, | ||
padding: '0 120px', | ||
whiteSpace: 'pre-wrap', | ||
}} | ||
> | ||
{status === 'response' | ||
? `Nice choice.${fruit ? ` ${fruit.toUpperCase()}!!` : ''}` | ||
: 'Welcome!'} | ||
</div> | ||
</div> | ||
), | ||
intents: [ | ||
<TextInput placeholder="Enter custom fruit..." />, | ||
<Button value="apples">Apples</Button>, | ||
<Button value="oranges">Oranges</Button>, | ||
<Button value="bananas">Bananas</Button>, | ||
status === 'response' && <Button.Reset>Reset</Button.Reset>, | ||
], | ||
} | ||
}) | ||
|
||
export const GET = handle(app.hono) | ||
export const POST = handle(app.hono) | ||
|
||
if (process.env.NODE_ENV === 'development') { | ||
const { serve } = await import('bun') | ||
const server = serve(app) | ||
console.log(`𝑭𝒂𝒓𝒄 ▶︎ http://localhost:${server.port}/dev`) | ||
} |
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 @@ | ||
{ | ||
"name": "example", | ||
"private": true, | ||
"scripts": { | ||
"dev": "bun run --hot api/index.tsx", | ||
"build": "farc vercel-build" | ||
}, | ||
"dependencies": { | ||
"bun": "latest", | ||
"farc": "main", | ||
"hono": "^4" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest" | ||
} | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "farc/jsx", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["**/*.ts", "**/*.tsx"] | ||
} |