-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from HanJaemEo/api-initial
feat: ✨ (api) api をセットアップした
- Loading branch information
Showing
16 changed files
with
1,279 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: API Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
# The action will look for `volta.node` first. If `volta.node` isn't defined, then it will look for `engines.node` | ||
# Refer: https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file | ||
node-version-file: 'package.json' | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3.0.0 | ||
id: pnpm-install | ||
with: | ||
# Version of pnpm to install: | ||
# Optional when there is a packageManager field in the package.json. | ||
# Refer: https://github.com/pnpm/action-setup#inputs | ||
run_install: false | ||
|
||
- name: Get PNPM store | ||
id: pnpm-cache | ||
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/cache@v4 | ||
name: Setup PNPM cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: ${{ runner.os }}-pnpm-store- | ||
|
||
- name: Install | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Deploy | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
packageManager: pnpm | ||
workingDirectory: ./apps/api/ | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
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,9 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
extends: ['custom-node'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig.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 @@ | ||
node_modules | ||
dist | ||
.wrangler | ||
.dev.vars | ||
.env | ||
|
||
# Change them to your taste: | ||
package-lock.json | ||
yarn.lock | ||
pnpm-lock.yaml | ||
bun.lockb |
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,8 @@ | ||
// This file is used by lint-staged to run linting and formatting on staged files | ||
|
||
const path = require('path'); | ||
|
||
module.exports = { | ||
'**/*.{js,jsx,cjs,mjs,ts,tsx}': 'pnpm --filter api exec eslint', | ||
'**/*.{js,jsx,cjs,mjs,ts,tsx,md,html,css,json,yaml,yml}': 'pnpm --filter api exec prettier --check', | ||
}; |
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,10 @@ | ||
import { showRoutes } from 'hono/dev'; | ||
import { createApp } from 'honox/server'; | ||
|
||
const app = createApp(); | ||
|
||
app.get('/', (c) => c.text('Hello HonoX!')); | ||
|
||
showRoutes(app); | ||
|
||
export default app; |
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,28 @@ | ||
{ | ||
"name": "api", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"start": "wrangler dev ./dist/server.js", | ||
"deploy": "pnpm build && wrangler deploy ./dist/server.js", | ||
"lint": "eslint .", | ||
"format:check": "prettier --check .", | ||
"format:fix": "prettier --write ." | ||
}, | ||
"dependencies": { | ||
"hono": "4.1.0", | ||
"honox": "0.1.8", | ||
"zod": "3.22.4" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "4.20240314.0", | ||
"eslint-config-custom-node": "workspace:*", | ||
"tsconfig": "workspace:*", | ||
"vite": "5.1.6", | ||
"vitest": "1.4.0", | ||
"wrangler": "3.34.2" | ||
} | ||
} |
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,18 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"strict": true, | ||
"lib": ["ESNext"], | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
}, | ||
"rootDir": "./", | ||
"types": ["@cloudflare/workers-types"] | ||
}, | ||
"include": ["**/*.ts", "**/*.*js"], | ||
"exclude": ["node_modules"] | ||
} |
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,14 @@ | ||
import honox from 'honox/vite'; | ||
import { defineConfig } from 'vite'; | ||
|
||
export default defineConfig({ | ||
build: { | ||
rollupOptions: { | ||
input: { | ||
server: './app/server.ts', | ||
}, | ||
}, | ||
ssr: true, | ||
}, | ||
plugins: [honox({ entry: './app/server.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,8 @@ | ||
/// <reference types="vitest" /> | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
test: { | ||
globals: true, | ||
}, | ||
}); |
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,18 @@ | ||
name = "api" | ||
compatibility_date = "2023-12-01" | ||
|
||
# [vars] | ||
# MY_VAR = "my-variable" | ||
|
||
# [[kv_namespaces]] | ||
# binding = "MY_KV_NAMESPACE" | ||
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | ||
|
||
# [[r2_buckets]] | ||
# binding = "MY_BUCKET" | ||
# bucket_name = "my-bucket" | ||
|
||
# [[d1_databases]] | ||
# binding = "DB" | ||
# database_name = "my-database" | ||
# database_id = "" |
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 @@ | ||
// This file is used by lint-staged to run linting and formatting on staged files | ||
|
||
module.exports = { | ||
'**/*.{js,jsx,ts,tsx,md,html,css,json,yaml,yml}': 'pnpm prettier --ignore-unknown --check', | ||
}; |
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,48 @@ | ||
# This file `.prettierignore` must be placed in each apps and packages directory. | ||
|
||
# ============================================================================= | ||
# Inherited from `.gitignore` | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
# ============================================================================= | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
.pnpm-store | ||
|
||
# testing | ||
coverage | ||
|
||
# next.js | ||
.next/ | ||
out/ | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# turbo | ||
.turbo | ||
|
||
# ============================================================================= | ||
# Unique to `.prettierignore` config | ||
# ============================================================================= | ||
|
||
# Generated PNPM files | ||
# Since renovate automatically updates these files, we don't want to format them | ||
package.json | ||
pnpm-lock.yaml |
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,39 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
$schema: 'https://json.schemastore.org/eslintrc', | ||
extends: ['custom'], | ||
parser: '@typescript-eslint/parser', | ||
rules: { | ||
'@typescript-eslint/consistent-type-imports': [ | ||
'error', | ||
{ | ||
fixStyle: 'inline-type-imports', | ||
}, | ||
], | ||
'class-methods-use-this': 'off', | ||
'dot-notation': 'off', | ||
'no-empty-function': 'off', | ||
'no-nested-ternary': 'off', | ||
'no-useless-constructor': 'off', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['./*'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'import/no-default-export': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/prefer-default-export': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['./*.*js'], | ||
extends: ['plugin:@typescript-eslint/disable-type-checked'], | ||
}, | ||
], | ||
settings: { | ||
'import/resolver': { | ||
typescript: {}, | ||
}, | ||
}, | ||
}; |
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,17 @@ | ||
{ | ||
"name": "eslint-config-custom-node", | ||
"version": "0.0.0", | ||
"main": "index.cjs", | ||
"type": "commonjs", | ||
"license": "MIT", | ||
"scripts": { | ||
"format:check": "prettier --check .", | ||
"format:fix": "prettier --write ." | ||
}, | ||
"dependencies": { | ||
"eslint-config-custom": "workspace:*" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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
Oops, something went wrong.