Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Feb 7, 2024
0 parents commit d719ab5
Show file tree
Hide file tree
Showing 23 changed files with 374 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Install dependencies"
description: "Prepare repository and all dependencies"

runs:
using: "composite"
steps:
- name: Set up Bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies
shell: bash
run: bun install
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'monthly'
38 changes: 38 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release (Canary)
on:
push:
branches: [main]
workflow_dispatch:

jobs:
canary:
name: Release canary
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Setup .npmrc file
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'

- name: Set version
run: |
jq --arg prop "workspaces" 'del(.[$prop])' package.json > package.tmp.json && rm package.json && cp package.tmp.json package.json && rm package.tmp.json
cd src
npm --no-git-tag-version version 0.0.0
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S')
- name: Build
run: bun run build

- name: Publish to npm
run: cd src && npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pull request
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit
41 changes: 41 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Main
on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

changesets:
name: Changesets
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Create version pull request or publish to npm
uses: changesets/action@v1
with:
title: 'chore: version packages'
commit: 'chore: version packages'
publish: bun run changeset:release
version: bun run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Verify
on:
workflow_call:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Lint code
run: bun run format && bun run lint

- uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'chore: format'
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

types:
name: Types
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Check types
run: bun run typecheck

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build
run: bun run build

- name: Run tests
run: bun run test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.map
coverage
lib
node_modules
tsconfig.*.tsbuildinfo
tsconfig.tsbuildinfo
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome"]
}
25 changes: 25 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"css.validate": false
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 𝑭𝒓𝒂𝒎𝒆work

A Framework for Farcaster Frames.
26 changes: 26 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"files": {
"ignore": [
"coverage",
"node_modules",
"src/vendor",
"tsconfig.json",
"tsconfig.*.json"
]
},
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To install dependencies:
```sh
bun install
```

To run:
```sh
bun run dev
```

open http://localhost:3000
11 changes: 11 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scripts": {
"dev": "bun run --hot src/index.ts"
},
"dependencies": {
"hono": "^3.12.8"
},
"devDependencies": {
"@types/bun": "latest"
}
}
9 changes: 9 additions & 0 deletions example/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Hono } from "hono";

const app = new Hono();

app.get("/", (c) => {
return c.text("Hello Hono!");
});

export default app;
7 changes: 7 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"strict": true,
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx"
}
}
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"workspaces": ["src"],
"scripts": {
"build": "bun run clean && tsc --project ./tsconfig.build.json",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only",
"clean": "rimraf src/index.js src/lib src/tsconfig.build.tsbuildinfo",
"format": "biome format . --write",
"lint": "biome check . --apply",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/bun": "latest",
"@vitest/coverage-v8": "^1.2.2",
"hono": "^3.12.8",
"rimraf": "^5.0.5",
"typescript": "^5.0.0",
"vitest": "^1.2.2"
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const hello = "world";
12 changes: 12 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@wevm/framework",
"version": "0.0.0",
"type": "module",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"sideEffects": false,
"peerDependencies": {
"hono": "^3"
}
}
39 changes: 39 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
"include": [],
"compilerOptions": {
// Incremental builds
// NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes.
"incremental": true,

// Type checking
"strict": true,
"useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
"noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
"noImplicitReturns": true, // Not enabled by default in `strict` mode.
"useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
"noImplicitOverride": true, // Not enabled by default in `strict` mode.
"noUnusedLocals": true, // Not enabled by default in `strict` mode.
"noUnusedParameters": true, // Not enabled by default in `strict` mode.

// JavaScript support
"allowJs": false,
"checkJs": false,

// Interop constraints
"esModuleInterop": false,
"allowSyntheticDefaultImports": false,
"forceConsistentCasingInFileNames": true,
"verbatimModuleSyntax": true,
"importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers.

// Language and environment
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
"lib": ["ES2022", "DOM"],

// Skip type checking for node modules
"skipLibCheck": true
}
}
18 changes: 18 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files.
"extends": "./tsconfig.base.json",
"include": ["src"],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.tsx",
"src/**/*.test-d.ts",
"src/**/*.test-d.tsx"
],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./src/lib",
"rootDir": "./src"
}
}
Loading

0 comments on commit d719ab5

Please sign in to comment.