mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 14:28:04 +00:00
Compare commits
28 commits
4e2ec1a156
...
5098db8f4c
Author | SHA1 | Date | |
---|---|---|---|
|
5098db8f4c | ||
204673694b | |||
7f458326eb | |||
10d7e8f4c7 | |||
485537101b | |||
c2ea74cf70 | |||
0bda09bafb | |||
75ba18676f | |||
d314e83b18 | |||
ffe2af2621 | |||
876d84fb75 | |||
3ef34e52e2 | |||
2794034e55 | |||
84b0494547 | |||
aa1ba85751 | |||
785fe1a122 | |||
772eb9f5d7 | |||
d39897e834 | |||
fa2e298e62 | |||
0fa1ac35b5 | |||
07f7302115 | |||
31c822e1c1 | |||
41a5be34b4 | |||
051d8906d5 | |||
65d2e4a71f | |||
08f797b3f2 | |||
acabdaec8c | |||
|
bfe725b2dc |
82 changed files with 7787 additions and 4032 deletions
26
.github/workflows/_studio.yml
vendored
26
.github/workflows/_studio.yml
vendored
|
@ -1,26 +0,0 @@
|
|||
name: Astro Studio
|
||||
|
||||
env:
|
||||
ASTRO_STUDIO_APP_TOKEN: ${{secrets.ASTRO_STUDIO_APP_TOKEN }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
DB:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: jaid/action-npm-install@v1.2.1
|
||||
- uses: withastro/action-studio@main
|
14
.github/workflows/add-project.yml
vendored
14
.github/workflows/add-project.yml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Add bugs to bugs project
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
jobs:
|
||||
add-to-project:
|
||||
name: Add issue to project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/add-to-project@v0.5.0
|
||||
with:
|
||||
project-url: https://github.com/users/kou029w/projects/2
|
||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
20
.github/workflows/auto-move-to-in-progress-on-assign.yml
vendored
Normal file
20
.github/workflows/auto-move-to-in-progress-on-assign.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: Auto Move to In Progress on Assign
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- assigned
|
||||
jobs:
|
||||
move-to-in-progress:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Move Issue to In Progress
|
||||
run: |
|
||||
PROJECT_NODE_ID=$(gh project view --owner "${{ github.repository_owner }}" "${PROJECT_ID}" --format json --jq .id)
|
||||
PROJECT_ITEM_ID=$(ISSUE_NUMBER="${{ github.event.issue.number }}" gh project item-list --owner "${{ github.repository_owner }}" "${PROJECT_ID}" --limit 100000 --format json --jq '.items[] | select(.content.repository == env.GITHUB_REPOSITORY and .content.number == (env.ISSUE_NUMBER | tonumber)) | .id')
|
||||
gh project item-edit --project-id "${PROJECT_NODE_ID}" --id "${PROJECT_ITEM_ID}" --field-id "${STATUS_FIELD_ID}" --single-select-option-id "${IN_PROGRESS_STATUS_ID}"
|
||||
env:
|
||||
# read:org project
|
||||
GITHUB_TOKEN: "${{ secrets.ADD_TO_PROJECT_PAT }}"
|
||||
PROJECT_ID: "2"
|
||||
STATUS_FIELD_ID: PVTSSF_lAHOABpmus0uuM4AAVPr
|
||||
IN_PROGRESS_STATUS_ID: "98236657"
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
node_modules/
|
||||
dist/
|
||||
test-results/
|
||||
.next/
|
||||
.env
|
||||
|
|
14
bitnet/Dockerfile
Normal file
14
bitnet/Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM python:3.9-alpine
|
||||
RUN apk add --no-cache build-base cmake clang git && \
|
||||
rm -rf /var/cache/apk/*
|
||||
RUN git clone --recursive --depth 1 https://github.com/microsoft/BitNet.git && \
|
||||
rm -rf BitNet/.git
|
||||
WORKDIR /BitNet
|
||||
RUN pip install -r requirements.txt && \
|
||||
pip cache purge
|
||||
RUN python3 utils/codegen_tl2.py --model Llama3-8B-1.58-100B-tokens --BM 256,128,256,128 --BK 96,96,96,96 --bm 32,32,32,32
|
||||
RUN cmake -B build -DBITNET_X86_TL2=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||
RUN cmake --build build --target llama-cli --config Release
|
||||
ADD https://huggingface.co/brunopio/Llama3-8B-1.58-100B-tokens-GGUF/resolve/main/Llama3-8B-1.58-100B-tokens-TQ2_0.gguf .
|
||||
RUN echo "2565559c82a1d03ecd1101f536c5e99418d07e55a88bd5e391ed734f6b3989ac Llama3-8B-1.58-100B-tokens-TQ2_0.gguf" | sha256sum -c
|
||||
CMD ["python3", "run_inference.py", "-m", "Llama3-8B-1.58-100B-tokens-TQ2_0.gguf", "-p", "The sky is blue due to a phenomenon called"]
|
4
deno-playwright/README.md
Normal file
4
deno-playwright/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
```
|
||||
$ deno -A npm:playwright install
|
||||
$ deno -A main.ts
|
||||
```
|
5
deno-playwright/deno.json
Normal file
5
deno-playwright/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"playwright": "npm:playwright@^1.48.2"
|
||||
}
|
||||
}
|
27
deno-playwright/deno.lock
generated
Normal file
27
deno-playwright/deno.lock
generated
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"npm:playwright@*": "1.48.2",
|
||||
"npm:playwright@^1.48.2": "1.48.2"
|
||||
},
|
||||
"npm": {
|
||||
"fsevents@2.3.2": {
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
|
||||
},
|
||||
"playwright-core@1.48.2": {
|
||||
"integrity": "sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA=="
|
||||
},
|
||||
"playwright@1.48.2": {
|
||||
"integrity": "sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==",
|
||||
"dependencies": [
|
||||
"fsevents",
|
||||
"playwright-core"
|
||||
]
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:playwright@^1.48.2"
|
||||
]
|
||||
}
|
||||
}
|
8
deno-playwright/main.ts
Normal file
8
deno-playwright/main.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { chromium } from "npm:playwright";
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto("https://example.com");
|
||||
await new Promise((r) => setTimeout(r, 10_000));
|
||||
await browser.close();
|
13
deno/deno.json
Normal file
13
deno/deno.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"tasks": {
|
||||
"dev": "deno run --watch main.ts"
|
||||
},
|
||||
"deploy": {
|
||||
"project": "d7ff4021-31bb-4663-b015-12a9e7b9bb64",
|
||||
"exclude": [
|
||||
"**/node_modules"
|
||||
],
|
||||
"include": [],
|
||||
"entrypoint": "main.ts"
|
||||
}
|
||||
}
|
8
deno/main.ts
Normal file
8
deno/main.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
const now = new Date();
|
||||
|
||||
if (import.meta.main) {
|
||||
Deno.serve(() => new Response(`${now}: Hello World!`));
|
||||
}
|
||||
|
||||
// $ curl https://great-crow-36.deno.dev/
|
||||
// Mon Apr 22 2024 03:13:21 GMT+0000 (Coordinated Universal Time): Hello World!
|
29
docmost/compose.yml
Normal file
29
docmost/compose.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
services:
|
||||
docmost:
|
||||
image: docmost/docmost:latest
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
environment:
|
||||
APP_URL: http://localhost:3000
|
||||
APP_SECRET: "${APP_SECRET}"
|
||||
DATABASE_URL: postgresql://docmost:${POSTGRES_PASSWORD}@db:5432/docmost?schema=public
|
||||
REDIS_URL: redis://redis:6379
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./docmost:/app/data/storage
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_DB: docmost
|
||||
POSTGRES_USER: docmost
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./db_data:/var/lib/postgresql/data
|
||||
redis:
|
||||
image: redis:7.2-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis_data:/data
|
3
groq/README.md
Normal file
3
groq/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
```
|
||||
$ uv run main.py
|
||||
```
|
30
groq/main.py
Normal file
30
groq/main.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# /// script
|
||||
# requires-python = ">=3.12"
|
||||
# dependencies = [
|
||||
# "groq",
|
||||
# ]
|
||||
# ///
|
||||
from groq import Groq
|
||||
|
||||
IMAGE_DATA_URL = "..."
|
||||
|
||||
client = Groq()
|
||||
completion = client.chat.completions.create(
|
||||
model="llama-3.2-90b-vision-preview",
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "これは何?"},
|
||||
{"type": "image_url", "image_url": {"url": IMAGE_DATA_URL}},
|
||||
],
|
||||
}
|
||||
],
|
||||
temperature=1,
|
||||
max_tokens=1024,
|
||||
top_p=1,
|
||||
stream=False,
|
||||
stop=None,
|
||||
)
|
||||
|
||||
print(completion.choices[0].message)
|
3
hoarder/.gitignore
vendored
Normal file
3
hoarder/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
data
|
||||
meilisearch
|
||||
redis
|
58
hoarder/compose.yml
Normal file
58
hoarder/compose.yml
Normal file
|
@ -0,0 +1,58 @@
|
|||
# https://raw.githubusercontent.com/hoarder-app/hoarder/main/docker/docker-compose.yml
|
||||
services:
|
||||
web:
|
||||
image: ghcr.io/hoarder-app/hoarder-web:0.15.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/data
|
||||
ports:
|
||||
- 3000:3000
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
REDIS_HOST: redis
|
||||
MEILI_ADDR: http://meilisearch:7700
|
||||
DATA_DIR: /data
|
||||
redis:
|
||||
image: redis:7.2-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis:/data
|
||||
chromium:
|
||||
image: gcr.io/zenika-hub/alpine-chrome:latest
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --no-sandbox
|
||||
- --disable-dev-shm-usage
|
||||
- --hide-scrollbars
|
||||
- --remote-debugging-address=0.0.0.0
|
||||
- --remote-debugging-port=9222
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:v1.6
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
MEILI_NO_ANALYTICS: "true"
|
||||
volumes:
|
||||
- ./meilisearch:/meili_data
|
||||
workers:
|
||||
image: ghcr.io/hoarder-app/hoarder-workers:0.15.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/data
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
REDIS_HOST: redis
|
||||
MEILI_ADDR: http://meilisearch:7700
|
||||
BROWSER_WEB_URL: http://chromium:9222
|
||||
DATA_DIR: /data
|
||||
depends_on:
|
||||
web:
|
||||
condition: service_started
|
||||
#
|
||||
# .env
|
||||
# NEXTAUTH_SECRET=$(openssl rand -base64 36)
|
||||
# MEILI_MASTER_KEY=$(openssl rand -base64 36)
|
||||
# NEXTAUTH_URL=http://localhost:3000
|
1
hono/.gitignore
vendored
1
hono/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
node_modules
|
|
@ -1,7 +1,6 @@
|
|||
```
|
||||
npm install
|
||||
npm start
|
||||
# or npm i -g . && hello-hono
|
||||
deno run -A main.ts
|
||||
# or deno install -n hello-hono https://raw.githubusercontent.com/kou029w/_/main/hono/main.ts && hello-hono
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
import "tsx";
|
||||
|
||||
await import("../main.ts");
|
5
hono/deno.json
Normal file
5
hono/deno.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"hono": "npm:hono@^4.2.6"
|
||||
}
|
||||
}
|
21
hono/deno.lock
generated
Normal file
21
hono/deno.lock
generated
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"version": "3",
|
||||
"packages": {
|
||||
"specifiers": {
|
||||
"npm:hono": "npm:hono@4.2.6",
|
||||
"npm:hono@^4.2.6": "npm:hono@4.2.6"
|
||||
},
|
||||
"npm": {
|
||||
"hono@4.2.6": {
|
||||
"integrity": "sha512-AtbHZJYWsm+uFHLz0C6xltX7hjOV44a55gSEGBfoQOJ00KSxEUOoiIkmd+NXfapNX0j2GCKhqMmYeegBdHRwcQ==",
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"remote": {},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"npm:hono@^4.2.6"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
/** @jsxImportSource npm:hono/jsx */
|
||||
|
||||
export function Foo(props: { messages: string[] }) {
|
||||
return (
|
||||
<>
|
||||
|
|
11
hono/main.ts
11
hono/main.ts
|
@ -1,8 +1,7 @@
|
|||
import { serve } from "@hono/node-server";
|
||||
import { Hono } from "hono";
|
||||
import { html } from "hono/html";
|
||||
import { showRoutes } from "hono/dev";
|
||||
import { Foo } from "./foo";
|
||||
import { Hono } from "npm:hono";
|
||||
import { showRoutes } from "npm:hono/dev";
|
||||
import { html } from "npm:hono/html";
|
||||
import { Foo } from "./foo.tsx";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
|
@ -24,5 +23,5 @@ app.get("/", (c) => {
|
|||
|
||||
const port = 3000;
|
||||
|
||||
serve({ ...app, port });
|
||||
Deno.serve({ port }, app.fetch);
|
||||
showRoutes(app);
|
||||
|
|
488
hono/package-lock.json
generated
488
hono/package-lock.json
generated
|
@ -1,488 +0,0 @@
|
|||
{
|
||||
"name": "@kou029w/srv-example",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@kou029w/srv-example",
|
||||
"dependencies": {
|
||||
"@hono/node-server": "^1.8.2",
|
||||
"hono": "^4.0.9",
|
||||
"tsx": "^3.12.2"
|
||||
},
|
||||
"bin": {
|
||||
"srv-example": "bin/run.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.17"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz",
|
||||
"integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz",
|
||||
"integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz",
|
||||
"integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz",
|
||||
"integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz",
|
||||
"integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz",
|
||||
"integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz",
|
||||
"integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz",
|
||||
"integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz",
|
||||
"integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz",
|
||||
"integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz",
|
||||
"integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz",
|
||||
"integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz",
|
||||
"integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz",
|
||||
"integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz",
|
||||
"integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@hono/node-server": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.8.2.tgz",
|
||||
"integrity": "sha512-h8l2TBLCPHZBUrrkosZ6L5CpBLj6zdESyF4B+zngiCDF7aZFQJ0alVbLx7jn8PCVi9EyoFf8a4hOZFi1tD95EA==",
|
||||
"engines": {
|
||||
"node": ">=18.14.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.11.25",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz",
|
||||
"integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.18.20",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz",
|
||||
"integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==",
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/android-arm": "0.18.20",
|
||||
"@esbuild/android-arm64": "0.18.20",
|
||||
"@esbuild/android-x64": "0.18.20",
|
||||
"@esbuild/darwin-arm64": "0.18.20",
|
||||
"@esbuild/darwin-x64": "0.18.20",
|
||||
"@esbuild/freebsd-arm64": "0.18.20",
|
||||
"@esbuild/freebsd-x64": "0.18.20",
|
||||
"@esbuild/linux-arm": "0.18.20",
|
||||
"@esbuild/linux-arm64": "0.18.20",
|
||||
"@esbuild/linux-ia32": "0.18.20",
|
||||
"@esbuild/linux-loong64": "0.18.20",
|
||||
"@esbuild/linux-mips64el": "0.18.20",
|
||||
"@esbuild/linux-ppc64": "0.18.20",
|
||||
"@esbuild/linux-riscv64": "0.18.20",
|
||||
"@esbuild/linux-s390x": "0.18.20",
|
||||
"@esbuild/linux-x64": "0.18.20",
|
||||
"@esbuild/netbsd-x64": "0.18.20",
|
||||
"@esbuild/openbsd-x64": "0.18.20",
|
||||
"@esbuild/sunos-x64": "0.18.20",
|
||||
"@esbuild/win32-arm64": "0.18.20",
|
||||
"@esbuild/win32-ia32": "0.18.20",
|
||||
"@esbuild/win32-x64": "0.18.20"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/get-tsconfig": {
|
||||
"version": "4.7.3",
|
||||
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz",
|
||||
"integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==",
|
||||
"dependencies": {
|
||||
"resolve-pkg-maps": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/hono": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.0.10.tgz",
|
||||
"integrity": "sha512-sq0RFAC3Ij+bkhZu90EGAQnVI1EhohRsjo9BU+BjXLbC71GSy41JjsFqCeg8MRpO2Gdu0A4MXF5licO89tn/rw==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve-pkg-maps": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
|
||||
"integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
|
||||
"funding": {
|
||||
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tsx": {
|
||||
"version": "3.14.0",
|
||||
"resolved": "https://registry.npmjs.org/tsx/-/tsx-3.14.0.tgz",
|
||||
"integrity": "sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==",
|
||||
"dependencies": {
|
||||
"esbuild": "~0.18.20",
|
||||
"get-tsconfig": "^4.7.2",
|
||||
"source-map-support": "^0.5.21"
|
||||
},
|
||||
"bin": {
|
||||
"tsx": "dist/cli.mjs"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "@kou029w/hello-hono",
|
||||
"type": "module",
|
||||
"bin": "bin/run.js",
|
||||
"scripts": {
|
||||
"start": "tsx watch main.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hono/node-server": "^1.8.2",
|
||||
"hono": "^4.0.9",
|
||||
"tsx": "^3.12.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.17"
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"strict": true,
|
||||
"types": ["node"],
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "hono/jsx"
|
||||
}
|
||||
}
|
|
@ -2995,19 +2995,19 @@ saxes@^5.0.1:
|
|||
xmlchars "^2.2.0"
|
||||
|
||||
"semver@2 || 3 || 4 || 5", semver@^5.5.0:
|
||||
version "5.7.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||
version "5.7.2"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"
|
||||
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
|
||||
|
||||
semver@^6.0.0, semver@^6.3.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
|
||||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
||||
version "6.3.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
|
||||
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
|
||||
|
||||
semver@^7.3.2:
|
||||
version "7.3.5"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
|
||||
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
|
|
1
kamal/.gitignore
vendored
Normal file
1
kamal/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.env
|
1
kamal/Dockerfile
Normal file
1
kamal/Dockerfile
Normal file
|
@ -0,0 +1 @@
|
|||
FROM caddy
|
19
kamal/README.md
Normal file
19
kamal/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
```
|
||||
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "${SSH_AUTH_SOCK}:/ssh-agent" -v /var/run/docker.sock:/var/run/docker.sock -e "SSH_AUTH_SOCK=/ssh-agent" ghcr.io/basecamp/kamal:latest'
|
||||
```
|
||||
|
||||
```.env
|
||||
KAMAL_REGISTRY_PASSWORD=*
|
||||
```
|
||||
|
||||
```
|
||||
$ kamal setup
|
||||
```
|
||||
|
||||
```
|
||||
ubuntu@gamma:~$ mkdir -p .kamal/env/roles
|
||||
ubuntu@gamma:~$ touch .kamal/env/roles/web-web.env
|
||||
ubuntu@gamma:~$ chmod 600 .kamal/env/roles/web-web.env
|
||||
```
|
||||
|
||||
- Docker レジストリどうするか => Docker Hub などパブリックなものを使用するのが簡単
|
13
kamal/config/deploy.yml
Normal file
13
kamal/config/deploy.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kjellberg/mrsk/validate-with-json-schema/lib/mrsk/configuration/schema.yaml
|
||||
service: web
|
||||
image: fogtype/caddy
|
||||
servers:
|
||||
- ubuntu@gamma.fogtype.com
|
||||
registry:
|
||||
username: fogtype
|
||||
password:
|
||||
- KAMAL_REGISTRY_PASSWORD
|
||||
logging:
|
||||
driver: journald
|
||||
healthcheck:
|
||||
cmd: /bin/true
|
72
kita/README.md
Normal file
72
kita/README.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
# kita
|
||||
|
||||
## Installing the project
|
||||
|
||||
Run the following command to install the project:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Running in development mode
|
||||
|
||||
Run the following command to start the server in development mode:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
You can now open your browser and navigate to [`http://localhost:1227`](http://localhost:1227).
|
||||
|
||||
## Building for production
|
||||
|
||||
Run the following command to build the project:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
Run the following command to start the server in production mode:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
You can now open your browser and navigate to [`http://localhost:1227`](http://localhost:1227).
|
||||
|
||||
## Running tests
|
||||
|
||||
You can run the tests using the following command:
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
Environment variables are loaded from a [`.env`](./.env) file in the root of the project. These are the available
|
||||
variables:
|
||||
|
||||
```bash
|
||||
# Port and host for the server
|
||||
PORT=1227
|
||||
HOST=0.0.0.0
|
||||
```
|
||||
|
||||
## Linting and Formatting
|
||||
|
||||
You can run the following commands to lint and format your code:
|
||||
|
||||
```bash
|
||||
# Formats your code
|
||||
npm run format
|
||||
|
||||
# Lints your code
|
||||
npm run lint
|
||||
|
||||
# Lints and fixes your code
|
||||
npm run lint:fix
|
||||
|
||||
# Lints your code in CI mode
|
||||
npm run lint:ci
|
||||
```
|
25
kita/biome.json
Normal file
25
kita/biome.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.6.3/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"lineWidth": 100,
|
||||
"indentStyle": "space"
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "single",
|
||||
"trailingComma": "none"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"ignore": ["node_modules", "dist", "coverage"]
|
||||
}
|
||||
}
|
44
kita/package.json
Normal file
44
kita/package.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "kita",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "kita build && tsc -p tsconfig.build.json",
|
||||
"dev": "concurrently --raw --restart-tries 0 \"npm:dev:*\"",
|
||||
"dev:kita": "kita watch",
|
||||
"dev:server": "node --env-file=.env --enable-source-maps -r @swc-node/register --watch src/index.ts",
|
||||
"dev:tsc": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
||||
"format": "biome format --write .",
|
||||
"lint": "biome check .",
|
||||
"lint:ci": "biome ci .",
|
||||
"lint:fix": "biome check --apply-unsafe .",
|
||||
"start": "node --env-file=.env --enable-source-maps dist/index.js",
|
||||
"test": "kita build && node --env-file=.env --enable-source-maps -r @swc-node/register --test test/**/*.test.ts",
|
||||
"test:types": "kita build --dry-run && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/helmet": "^11.1.1",
|
||||
"@fastify/multipart": "^8.2.0",
|
||||
"@fastify/sensible": "^5.5.0",
|
||||
"@fastify/under-pressure": "^8.3.0",
|
||||
"@kitajs/runtime": "^1.1.17",
|
||||
"close-with-grace": "^1.3.0",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-plugin": "^4.5.1",
|
||||
"pino": "^8.19.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.6.3",
|
||||
"@kitajs/cli": "1.1.34",
|
||||
"@swc-node/register": "^1.9.0",
|
||||
"@swc/helpers": "^0.5.8",
|
||||
"@types/node": "^20.12.2",
|
||||
"concurrently": "^8.2.2",
|
||||
"pino-pretty": "^11.0.0",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
2427
kita/pnpm-lock.yaml
generated
Normal file
2427
kita/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
31
kita/src/index.ts
Normal file
31
kita/src/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { ajvFilePlugin } from '@fastify/multipart';
|
||||
import fastify from 'fastify';
|
||||
import { isMainThread } from 'node:worker_threads';
|
||||
import backendPlugin from './plugin';
|
||||
|
||||
// Ensures this file is not executed in test context
|
||||
if (process.env.NODE_TEST_CONTEXT) {
|
||||
throw new Error('This file should not be executed in test context');
|
||||
}
|
||||
|
||||
// Ensures this file is not executed in worker context
|
||||
if (!isMainThread) {
|
||||
throw new Error('This file should not be executed in worker context');
|
||||
}
|
||||
|
||||
// Ensures PORT are set
|
||||
if (!process.env.PORT) {
|
||||
throw new Error('PORT must be set');
|
||||
}
|
||||
|
||||
fastify({
|
||||
logger: { transport: { target: 'pino-pretty' } },
|
||||
ajv: { plugins: [ajvFilePlugin] }
|
||||
})
|
||||
// Registers our backend
|
||||
.register(backendPlugin)
|
||||
// Starts the server
|
||||
.listen({
|
||||
port: +process.env.PORT,
|
||||
host: process.env.HOST || ''
|
||||
});
|
43
kita/src/plugin.ts
Normal file
43
kita/src/plugin.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import './prelude';
|
||||
|
||||
import fastifyHelmet from '@fastify/helmet';
|
||||
import fastifyUnderPressure from '@fastify/under-pressure';
|
||||
import { Kita } from '@kitajs/runtime';
|
||||
import closeWithGrace from 'close-with-grace';
|
||||
import fp from 'fastify-plugin';
|
||||
|
||||
export default fp(async (app) => {
|
||||
// Registers the generated kita plugin
|
||||
app.register(Kita);
|
||||
|
||||
// Measures process load with automatic handling of "Service Unavailable"
|
||||
app.register(fastifyUnderPressure, {
|
||||
maxEventLoopDelay: 1000,
|
||||
maxHeapUsedBytes: 1000000000,
|
||||
maxRssBytes: 1000000000,
|
||||
maxEventLoopUtilization: 0.98
|
||||
});
|
||||
|
||||
// Important security headers for Fastify
|
||||
app.register(fastifyHelmet, {
|
||||
global: true
|
||||
});
|
||||
|
||||
// Add your custom stuff here
|
||||
// app.register(myPlugin)
|
||||
// ...
|
||||
|
||||
// Delay is the number of milliseconds for the graceful close to finish
|
||||
const closeListeners = closeWithGrace({ delay: 500 }, async ({ err }) => {
|
||||
if (err) {
|
||||
app.log.error(err);
|
||||
}
|
||||
|
||||
await app.close();
|
||||
});
|
||||
|
||||
// Cancelling the close listeners
|
||||
app.addHook('onClose', async () => {
|
||||
closeListeners.uninstall();
|
||||
});
|
||||
});
|
2
kita/src/prelude.ts
Normal file
2
kita/src/prelude.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
// This tells kita where to find the root of your project
|
||||
globalThis.KITA_PROJECT_ROOT ??= __dirname;
|
13
kita/src/routes/index.ts
Normal file
13
kita/src/routes/index.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import type { Query } from '@kitajs/runtime';
|
||||
|
||||
/**
|
||||
* @tag Hello
|
||||
* @operationId getHello
|
||||
* @summary Get a hello message with date
|
||||
*/
|
||||
export function get(name: Query = 'World') {
|
||||
return {
|
||||
name,
|
||||
message: `Hello ${name}!`
|
||||
};
|
||||
}
|
39
kita/test/index.test.ts
Normal file
39
kita/test/index.test.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import fastify from 'fastify';
|
||||
import assert from 'node:assert';
|
||||
import test, { describe } from 'node:test';
|
||||
import backendPlugin from '../src/plugin';
|
||||
|
||||
describe('Creates route', () => {
|
||||
test('GET /', async () => {
|
||||
await using app = fastify();
|
||||
app.register(backendPlugin);
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'GET',
|
||||
url: '/'
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
assert.deepStrictEqual(response.json(), {
|
||||
name: 'World',
|
||||
message: 'Hello World!'
|
||||
});
|
||||
});
|
||||
|
||||
test('GET /?name=Kita', async () => {
|
||||
await using app = fastify();
|
||||
app.register(backendPlugin);
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
query: { name: 'Kita' }
|
||||
});
|
||||
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
assert.deepStrictEqual(response.json(), {
|
||||
name: 'Kita',
|
||||
message: 'Hello Kita!'
|
||||
});
|
||||
});
|
||||
});
|
4
kita/tsconfig.build.json
Normal file
4
kita/tsconfig.build.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src"]
|
||||
}
|
112
kita/tsconfig.json
Normal file
112
kita/tsconfig.json
Normal file
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
"incremental": true,
|
||||
// "composite": true,
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo",
|
||||
// "disableSourceOfProjectReferenceRedirect": true,
|
||||
// "disableSolutionSearching": true,
|
||||
// "disableReferencedProjectLoad": true,
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "ESNext",
|
||||
// "lib": [],
|
||||
// "jsx": "preserve",
|
||||
// "experimentalDecorators": true,
|
||||
// "emitDecoratorMetadata": true,
|
||||
// "jsxFactory": "",
|
||||
// "jsxFragmentFactory": "",
|
||||
// "jsxImportSource": "",
|
||||
// "reactNamespace": "",
|
||||
// "noLib": true,
|
||||
// "useDefineForClassFields": true,
|
||||
// "moduleDetection": "auto", ,
|
||||
"preserveWatchOutput": true,
|
||||
|
||||
/* Modules */
|
||||
"module": "CommonJS",
|
||||
// "rootDir": "./",
|
||||
"moduleResolution": "Node10",
|
||||
// "baseUrl": "./",
|
||||
// "paths": {},
|
||||
// "rootDirs": [],
|
||||
// "typeRoots": [],
|
||||
// "types": [],
|
||||
// "allowUmdGlobalAccess": true,
|
||||
// "moduleSuffixes": [],
|
||||
// "allowImportingTsExtensions": true,
|
||||
// "resolvePackageJsonExports": true,
|
||||
// "resolvePackageJsonImports": true,
|
||||
// "customConditions": [],
|
||||
// "resolveJsonModule": true,
|
||||
// "allowArbitraryExtensions": true,
|
||||
// "noResolve": true,
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true,
|
||||
// "checkJs": true,
|
||||
// "maxNodeModuleJsDepth": 1,
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true,
|
||||
// "declarationMap": true,
|
||||
// "emitDeclarationOnly": true,
|
||||
"sourceMap": true,
|
||||
// "inlineSourceMap": true,
|
||||
// "outFile": "./",
|
||||
"outDir": "./dist",
|
||||
// "removeComments": true,
|
||||
// "noEmit": true,
|
||||
"importHelpers": true,
|
||||
// "importsNotUsedAsValues": "remove",
|
||||
// "downlevelIteration": true,
|
||||
// "sourceRoot": "",
|
||||
// "mapRoot": "",
|
||||
// "inlineSources": true,
|
||||
// "emitBOM": true,
|
||||
// "newLine": "crlf",
|
||||
// "stripInternal": true,
|
||||
// "noEmitHelpers": true,
|
||||
// "noEmitOnError": true,
|
||||
// "preserveConstEnums": true,
|
||||
// "declarationDir": "./",
|
||||
// "preserveValueImports": true,
|
||||
|
||||
/* Interop Constraints */
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"preserveSymlinks": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
// "noPropertyAccessFromIndexSignature": true,
|
||||
// "allowUnusedLabels": true,
|
||||
// "allowUnreachableCode": true,
|
||||
|
||||
/* Completeness */
|
||||
"skipDefaultLibCheck": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src", "test"]
|
||||
}
|
13
metube/compose.yml
Normal file
13
metube/compose.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
services:
|
||||
metube:
|
||||
image: ghcr.io/alexta69/metube
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8081:8081"
|
||||
volumes:
|
||||
- ./config:/etc/metube
|
||||
- ./downloads:/downloads
|
||||
environment:
|
||||
YTDL_OPTIONS_FILE: /etc/metube/ytdl_options.json
|
||||
DOWNLOAD_DIR: /downloads/Music
|
||||
OUTPUT_TEMPLATE: "%(artist,uploader|Unknown)s,%(album,artist,uploader)s,%(title)s [%(id)s].%(ext)s"
|
9
metube/config/ytdl_options.json
Normal file
9
metube/config/ytdl_options.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"format": "bestaudio/best",
|
||||
"writethumbnail": true,
|
||||
"postprocessors": [
|
||||
{ "key": "FFmpegExtractAudio" },
|
||||
{ "key": "FFmpegMetadata" },
|
||||
{ "key": "EmbedThumbnail" }
|
||||
]
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
test("1 + 2 = 3", () => {
|
||||
assert.equal(1 + 2, 3);
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
export default "hello!";
|
|
@ -1,7 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import message from "./hello.js";
|
||||
|
||||
test("say hello", () => {
|
||||
assert.equal(message, "hello!");
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "node --test"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.7.0"
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
test("parse json", () => {
|
||||
const json = `{"name": "太郎", "age": 42}`;
|
||||
const obj = JSON.parse(json);
|
||||
assert.deepEqual(obj, { name: "太郎", age: 42 });
|
||||
});
|
1
playwright-screenshot/.gitignore
vendored
1
playwright-screenshot/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
/screenshot/
|
|
@ -1,29 +0,0 @@
|
|||
const { chromium } = require("playwright");
|
||||
|
||||
async function main() {
|
||||
const browser = await chromium.launch({
|
||||
headless: false,
|
||||
});
|
||||
const context = await browser.newContext({
|
||||
screen: { width: 1280, height: 720 },
|
||||
});
|
||||
const page = await context.newPage();
|
||||
await page.goto("about:blank");
|
||||
for (let i = 0 /* NOP */; ; i++) {
|
||||
try {
|
||||
const seq = i.toString().padStart(6, "0");
|
||||
const title = await page.title();
|
||||
const date = new Date().toISOString().split("T")[0];
|
||||
const path = `screenshot/${date}/${seq}-${title}.png`;
|
||||
await page.screenshot({ path });
|
||||
await page.waitForTimeout(1_000);
|
||||
} catch {
|
||||
// NOP
|
||||
}
|
||||
}
|
||||
await page.close();
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"playwright": "latest"
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
playwright-core@1.31.2:
|
||||
version "1.31.2"
|
||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.2.tgz#debf4b215d14cb619adb7e511c164d068075b2ed"
|
||||
integrity sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ==
|
||||
|
||||
playwright@latest:
|
||||
version "1.31.2"
|
||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.31.2.tgz#4252280586c596746122cd1fdf9f8ff6a63fa852"
|
||||
integrity sha512-jpC47n2PKQNtzB7clmBuWh6ftBRS/Bt5EGLigJ9k2QAKcNeYXZkEaDH5gmvb6+AbcE0DO6GnXdbl9ogG6Eh+og==
|
||||
dependencies:
|
||||
playwright-core "1.31.2"
|
21
playwright/inner-text.test.ts
Normal file
21
playwright/inner-text.test.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("first", async ({ page }) => {
|
||||
// @ts-ignore
|
||||
await page.goto(`file:///${__dirname}/test.html`);
|
||||
|
||||
// playwright test --browser=chromium : pass
|
||||
// playwright test --browser=firefox : pass
|
||||
// playwright test --browser=webkit : fail (return `1\n`)
|
||||
expect(await page.innerText("first-test")).toBe(`1`);
|
||||
});
|
||||
|
||||
test("second", async ({ page }) => {
|
||||
// @ts-ignore
|
||||
await page.goto(`file:///${__dirname}/test.html`);
|
||||
|
||||
// playwright test --browser=chromium : pass
|
||||
// playwright test --browser=firefox : pass
|
||||
// playwright test --browser=webkit : fail (return `2\n`)
|
||||
expect(await page.innerText("second-test")).toBe(`2`);
|
||||
});
|
75
playwright/package-lock.json
generated
Normal file
75
playwright/package-lock.json
generated
Normal file
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"name": "playwright",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.48.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz",
|
||||
"integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright": "1.48.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz",
|
||||
"integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.48.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.48.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz",
|
||||
"integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
playwright/package.json
Normal file
8
playwright/package.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"scripts": {
|
||||
"test": "playwright test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.48.1"
|
||||
}
|
||||
}
|
18
playwright/playwright.config.ts
Normal file
18
playwright/playwright.config.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: devices["Desktop Chrome"],
|
||||
},
|
||||
{
|
||||
name: "firefox",
|
||||
use: devices["Desktop Firefox"],
|
||||
},
|
||||
{
|
||||
name: "webkit",
|
||||
use: devices["Desktop Safari"],
|
||||
},
|
||||
],
|
||||
});
|
15
playwright/test.html
Normal file
15
playwright/test.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<first-test><div>1</div></first-test>
|
||||
<second-test>
|
||||
<div>2</div>
|
||||
<div></div>
|
||||
</second-test>
|
||||
</body>
|
||||
</html>
|
1
poppler-rs/.gitignore
vendored
Normal file
1
poppler-rs/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/target
|
1573
poppler-rs/Cargo.lock
generated
Normal file
1573
poppler-rs/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
11
poppler-rs/Cargo.toml
Normal file
11
poppler-rs/Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
edition = "2021"
|
||||
name = "poppler-rs"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
cairo-rs = {version = "0.20.1"}
|
||||
clap = {version = "4.5.16", features = ["derive", "env"]}
|
||||
image = "0.25.2"
|
||||
poppler-rs = "0.24.1"
|
||||
url = "2.5.2"
|
55
poppler-rs/src/main.rs
Normal file
55
poppler-rs/src/main.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
use cairo::{Context, Format, ImageSurface};
|
||||
use clap::Parser;
|
||||
use image::codecs::webp::WebPEncoder;
|
||||
use image::ExtendedColorType;
|
||||
use poppler::Document;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version)]
|
||||
struct Args {
|
||||
#[arg(short, long, env, default_value = "target/note/note.pdf", value_parser = canonicalize)]
|
||||
input: String,
|
||||
|
||||
#[arg(short, long, env, default_value = "target/output")]
|
||||
output: String,
|
||||
}
|
||||
|
||||
fn canonicalize(arg: &str) -> Result<String, std::io::Error> {
|
||||
let path = fs::canonicalize(arg)?.to_string_lossy().into_owned();
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
let input = args.input;
|
||||
let output = args.output;
|
||||
let input_uri = Url::parse(format!("file://{input}").as_str())
|
||||
.unwrap()
|
||||
.to_string();
|
||||
|
||||
let document = Document::from_file(&input_uri, None).unwrap();
|
||||
|
||||
for i in 0..document.n_pages() {
|
||||
let page = document.page(i).unwrap();
|
||||
let (width, height) = page.size();
|
||||
let output_file = File::create(format!("{output}-{i}.webp")).unwrap();
|
||||
let surface = ImageSurface::create(Format::Rgb24, width as i32, height as i32).unwrap();
|
||||
let context = Context::new(&surface).unwrap();
|
||||
|
||||
context.set_source_rgb(1., 1., 1.);
|
||||
context.paint().unwrap();
|
||||
page.render(&context);
|
||||
|
||||
drop(context);
|
||||
|
||||
let data = surface.take_data().unwrap();
|
||||
let encoder = WebPEncoder::new_lossless(output_file);
|
||||
|
||||
encoder
|
||||
.encode(&data, width as u32, height as u32, ExtendedColorType::Rgba8)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
1
radicle
1
radicle
|
@ -1 +0,0 @@
|
|||
Subproject commit de052ec6833940620c931715bbf4d1cd1a4867b9
|
1
ts/.gitignore
vendored
1
ts/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
dist/
|
37
ts/README.md
37
ts/README.md
|
@ -1,37 +0,0 @@
|
|||
# TypeScript で書いたサーバーをワンライナーで構築してみよう
|
||||
|
||||
tsx
|
||||
|
||||
```
|
||||
npx tsx main.ts
|
||||
```
|
||||
|
||||
tsx + watch
|
||||
|
||||
```
|
||||
npx tsx --watch main.ts
|
||||
```
|
||||
|
||||
esbuild (esbuild-register)
|
||||
|
||||
```
|
||||
node -r esbuild-register main.ts
|
||||
```
|
||||
|
||||
esbuild (esbuild-register) + watch
|
||||
|
||||
```
|
||||
node -r esbuild-register --watch main.ts
|
||||
```
|
||||
|
||||
tsup
|
||||
|
||||
```
|
||||
npx tsup main.ts --clean --onSuccess 'node dist/main.js'
|
||||
```
|
||||
|
||||
tsup + watch
|
||||
|
||||
```
|
||||
npx tsup main.ts --clean --watch --onSuccess 'node dist/main.js'
|
||||
```
|
17
ts/main.ts
17
ts/main.ts
|
@ -1,17 +0,0 @@
|
|||
import express from "express";
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("OK");
|
||||
});
|
||||
|
||||
const address = app.listen(3000).address();
|
||||
|
||||
console.log(address);
|
||||
|
||||
(async () => {
|
||||
const res = await fetch(`http://127.0.0.1:${address?.port}/`);
|
||||
console.log(res.url, res.status, res.statusText);
|
||||
console.log(await res.text());
|
||||
})();
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "ts",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.10.5",
|
||||
"esbuild": "^0.18.20",
|
||||
"esbuild-register": "^3.5.0",
|
||||
"express": "^4.18.2",
|
||||
"tsup": "^7.2.0",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
1428
ts/pnpm-lock.yaml
generated
1428
ts/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
2
vercel-fastify/.gitignore
vendored
2
vercel-fastify/.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
.vercel
|
||||
dist
|
||||
node_modules
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
## 何をしたかったか
|
||||
|
||||
Fastify と fastify-autoload を使って Vercel にデプロイできるかどうかチェック。
|
||||
Fastify と @fastify/autoload を使って Vercel にデプロイできるかどうかチェック。
|
||||
|
||||
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fkou029w%2F_%2Ftree%2Fmaster%2Fvercel-fastify)
|
||||
|
||||
## 結果
|
||||
|
||||
cjs かつ includeFiles に含めればとりあえず OK。
|
||||
全部含めるなら `**` でよい。
|
||||
とりあえず OK
|
||||
|
||||
```json
|
||||
{
|
||||
"functions": { "api/index.js": { "includeFiles": "**" } }
|
||||
}
|
||||
```
|
||||
## ネタ
|
||||
|
||||
TypeScript の場合は、`vercel-build` にビルドコマンドを指定する & ビルド後に生成されるファイルを指定する。(vercel.json を参照)
|
||||
そういった設定をせず Vercel に任せると `vercel dev` では問題ないが、デプロイすると参照に失敗して 500 エラー。
|
||||
- `api/_routes` に配置することで `api/**/*` includeFiles 不要
|
||||
- top-level await NG
|
||||
- await する処理は必ず handler 内に完結させる必要ある
|
||||
- `api/[...].ts` で `api/foo/bar` にもルーティングしてほしいのだが、うまく機能しないようだ
|
||||
- vercel.json 参照
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
import { create } from "../dist/server";
|
||||
import autoload from "@fastify/autoload";
|
||||
import type { VercelRequest, VercelResponse } from "@vercel/node";
|
||||
import fastify from "fastify";
|
||||
import path from "node:path";
|
||||
|
||||
const server = create({ isDev: process.env.NODE_ENV === "development" });
|
||||
const app = fastify();
|
||||
|
||||
async function index(req, res) {
|
||||
await server.ready();
|
||||
server.server.emit("request", req, res);
|
||||
app.register(autoload, {
|
||||
dir: path.resolve(__dirname, "_routes"),
|
||||
options: {
|
||||
prefix: "/api",
|
||||
},
|
||||
});
|
||||
|
||||
export default async function handler(req: VercelRequest, res: VercelResponse) {
|
||||
await app.ready();
|
||||
app.server.emit("request", req, res);
|
||||
}
|
||||
|
||||
export default index;
|
||||
|
|
|
@ -3,18 +3,15 @@
|
|||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": ":",
|
||||
"vercel-build": "tsup src --clean",
|
||||
"preview": "vercel dev",
|
||||
"deploy": "vercel deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"fastify": "^3.28.0",
|
||||
"fastify-autoload": "^3.12.0",
|
||||
"pino-pretty": "^7.6.1"
|
||||
"@fastify/autoload": "^5.8.0",
|
||||
"fastify": "^3.29.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "^5.12.6",
|
||||
"vercel": "^24.1.0"
|
||||
"@vercel/node": "^3.0.27",
|
||||
"vercel": "^24.2.5"
|
||||
}
|
||||
}
|
||||
|
|
2726
vercel-fastify/pnpm-lock.yaml
generated
Normal file
2726
vercel-fastify/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,8 +0,0 @@
|
|||
import { create, start } from "./server";
|
||||
|
||||
async function main() {
|
||||
const server = create({ isDev: true });
|
||||
await start(server, "3000");
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,27 +0,0 @@
|
|||
import fastify, { FastifyInstance } from "fastify";
|
||||
import autoload from "fastify-autoload";
|
||||
import path from "node:path";
|
||||
|
||||
type Options = {
|
||||
isDev?: boolean;
|
||||
quiet?: boolean;
|
||||
};
|
||||
|
||||
type Server = FastifyInstance;
|
||||
|
||||
export function create(options: Options): Server {
|
||||
const app = fastify({
|
||||
logger: !options.quiet && { prettyPrint: options.isDev },
|
||||
});
|
||||
app.register(autoload, {
|
||||
dir: path.resolve(__dirname, "routes"),
|
||||
routeParams: true,
|
||||
});
|
||||
return app;
|
||||
}
|
||||
|
||||
export async function start(server: Server, port: string): Promise<string> {
|
||||
await server.ready();
|
||||
const address: string = await server.listen(port, "::");
|
||||
return address;
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
{
|
||||
"functions": { "api/index.ts": { "includeFiles": "dist/**" } },
|
||||
"rewrites": [{ "source": "/api/(.*)", "destination": "/api/index.ts" }]
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/(.*)",
|
||||
"destination": "/api/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
1
writefreely/.gitignore
vendored
Normal file
1
writefreely/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
data
|
12
writefreely/compose.yml
Normal file
12
writefreely/compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
services:
|
||||
web:
|
||||
image: "writeas/writefreely:latest"
|
||||
volumes:
|
||||
- "./config.ini:/go/config.ini"
|
||||
- "./data:/data" # sudo chown 2:2 data
|
||||
ports:
|
||||
- "8080:8080"
|
||||
# セットアップに必要なコマンド:
|
||||
# $ cmd/writefreely/writefreely -init-db
|
||||
# $ cmd/writefreely/writefreely -create-admin $USERNAME:$PASSWORD
|
||||
# $ cmd/writefreely/writefreely -gen-keys
|
102
writefreely/config.ini
Normal file
102
writefreely/config.ini
Normal file
|
@ -0,0 +1,102 @@
|
|||
[server]
|
||||
hidden_host =
|
||||
port = 8080
|
||||
bind = 0.0.0.0
|
||||
tls_cert_path =
|
||||
tls_key_path =
|
||||
autocert = false
|
||||
templates_parent_dir = /go
|
||||
static_parent_dir =
|
||||
pages_parent_dir = /go
|
||||
keys_parent_dir = /data
|
||||
hash_seed =
|
||||
gopher_port = 0
|
||||
|
||||
[database]
|
||||
type = sqlite3
|
||||
filename = /data/writefreely.db
|
||||
username =
|
||||
password =
|
||||
database =
|
||||
host = localhost
|
||||
port = 3306
|
||||
tls = false
|
||||
|
||||
[app]
|
||||
site_name = WriteFreely
|
||||
site_description = A place to write freely.
|
||||
host = http://localhost:8080
|
||||
theme = write
|
||||
editor =
|
||||
disable_js = false
|
||||
webfonts = true
|
||||
landing =
|
||||
simple_nav = false
|
||||
wf_modesty = false
|
||||
chorus = false
|
||||
forest = false
|
||||
disable_drafts = false
|
||||
single_user = true
|
||||
open_registration = false
|
||||
open_deletion = false
|
||||
min_username_len = 3
|
||||
max_blogs = 1
|
||||
federation = true
|
||||
public_stats = false
|
||||
monetization = false
|
||||
notes_only = false
|
||||
private = false
|
||||
local_timeline = false
|
||||
user_invites =
|
||||
default_visibility =
|
||||
update_checks = false
|
||||
disable_password_auth = false
|
||||
|
||||
[oauth.slack]
|
||||
client_id =
|
||||
client_secret =
|
||||
team_id =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.writeas]
|
||||
client_id =
|
||||
client_secret =
|
||||
auth_location =
|
||||
token_location =
|
||||
inspect_location =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.gitlab]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.gitea]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
|
||||
[oauth.generic]
|
||||
client_id =
|
||||
client_secret =
|
||||
host =
|
||||
display_name =
|
||||
callback_proxy =
|
||||
callback_proxy_api =
|
||||
token_endpoint =
|
||||
inspect_endpoint =
|
||||
auth_endpoint =
|
||||
scope =
|
||||
allow_disconnect = false
|
||||
map_user_id =
|
||||
map_username =
|
||||
map_display_name =
|
||||
map_email =
|
Loading…
Add table
Reference in a new issue