Skip to content

Posts

Windowsでbunを試す

Bun — A fast all-in-one JavaScript runtime

v1.1でWindowsにも対応したということなので、Surface go 2で試してみた。

$ bun create next-app
√ What is your project named? ... bun-next-app
√ Would you like to use TypeScript? ... No / Yes
√ Would you like to use ESLint? ... No / Yes
√ Would you like to use Tailwind CSS? ... No / Yes
√ Would you like to use `src/` directory? ... No / Yes
√ Would you like to use App Router? (recommended) ... No / Yes
√ Would you like to customize the default import alias (@/*)? ... No / Yes
√ What import alias would you like configured? ... @/*
$ cd bun-next-app/
$ bun --bun run dev
$ next dev
   ▲ Next.js 14.1.4
   - Local:        http://localhost:3000

 ✓ Ready in 9.1s
 ○ Compiling / ...

で終了して、終了できない枠だけのターミナルが起動した。

Read more

英語学習

ITエンジニアのゼロから始める英語勉強法(日経BP Next ICT選書) | 牛尾剛 | 英語 | Kindleストア | Amazonを読んだ。

書籍では、学習用のCDを買ってひたすら聞きこむところから始めるのだけれど、おすすめの教材のAmazon評価がいまいちなので、別の教材がないか考えた。

あとで答え合わせをするために、文字起こしがあることを条件にすると、AWSのPodcastがそうだったのを思い出した。

Read more

Cursor入門

Cursor - The AI-first Code Editorを試してみた。

New AI ProjectでFlutterアプリ作成してみようとしたところ、作成するファイルのリストアップしてくれたところで終わってしまった。

ファイルの中身まで作ってくれること期待してたのだけど、そこまではやってくれない?よくわからない。

もう少し使い込んでみようと思う。

DockerでNGINXを動かすとClientIPが取れない

SvelteKitアプリでアクセス元IPアドレスを見て処理を分けたかった。

ローカル環境ではHandleevent.getClientAddress()したら取れていた。

SvelteKitはログが寂しいので、手前にNGINXを置いてアクセスログを詳細にとれるようにしてみた。

ローカルにNGINXインストールするのはちょっとあれだったので、docker composeで組んだ。

Read more

CodeRabbit

特に個人開発者向け!CodeRabbit(自動レビューツール)を使えばコードの健康まで得られることに気づいた話を見て良さそうだったので試してみた。

CodeRabbit: AI-powered Code Reviews

最初、PRをトリガーに発動するのに気づかなくて、Issueが上がってくるのを待ってしまった。

レビューコメントが英語だったので、「日本語でお願いします」を返したら日本語で返してくれてすごいと思った。

ただ、やり取りが増えたせいかRate Limitに引っかかってしまった。

最初から日本語でコメントしてくれれば最高なんだけどなぁ(設定で日本語は選択している)。

Read more

SST入門

SvelteKitをAWSのLambdaで動かす方法を探していて、ゼロコンフィグデプロイ • Docs • SvelteKitUse SvelteKit with SST | SSTが紹介されていた。

SSTってSega Sound Teamしか知らないけど、Serverless Stackの略らしい(Tはどこから?)。

で、ドキュメントに沿って動かしてみたら、いい感じにデプロイできた。

が、Prismaを使ったツールをデプロイしたら

“PrismaClientInitializationError: Prisma Client could not find its schema.prisma. This is likely caused by a bundling step, which leads to schema.prisma not being copied near the resulting bundle. We would appreciate if you could take the time to share some information with us.”,

Read more

FastAPI入門

FastAPI入門をやってみた。

特にひっかかることなく進めたが、最後のテストがPASSしない。

$ docker-compose run --entrypoint "poetry run pytest" demo-app
[+] Building 0.0s (0/0)                                                                                              docker:default 
[+] Building 0.0s (0/0)                                                                                              docker:default 
======================================================= test session starts ========================================================platform linux -- Python 3.9.17, pytest-7.4.2, pluggy-1.3.0
rootdir: /src
plugins: anyio-3.7.1, asyncio-0.21.1
asyncio: mode=strict
collected 2 items                                                                                                                   

tests/test_main.py FF                                                                                                        [100%]

============================================================= FAILURES =============================================================
_______________________________________________________ test_create_and_read _______________________________________________________

async_client = <async_generator object async_client at 0x7f8d3374dca0>

    @pytest.mark.asyncio
    async def test_create_and_read(async_client):
>       response = await async_client.post("/tasks", json={"title": "テストタスク"})
E       AttributeError: 'async_generator' object has no attribute 'post'

tests/test_main.py:41: AttributeError
__________________________________________________________ test_done_flag __________________________________________________________

async_client = <async_generator object async_client at 0x7f8d3374ddc0>

    @pytest.mark.asyncio
    async def test_done_flag(async_client):
>       response = await async_client.post("/tasks", json={"title": "テストタスク2"})
E       AttributeError: 'async_generator' object has no attribute 'post'

tests/test_main.py:56: AttributeError
========================================================= warnings summary =========================================================
.venv/lib/python3.9/site-packages/pydantic/fields.py:798
  /src/.venv/lib/python3.9/site-packages/pydantic/fields.py:798: PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.4/migration/
    warn(

.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:267
.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:267
.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:267
  /src/.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:267: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.4/migration/
    warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)

.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:317
  /src/.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:317: UserWarning: Valid config keys have changed in V2:
  * 'orm_mode' has been renamed to 'from_attributes'
    warnings.warn(message, UserWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================== short test summary info ======================================================
FAILED tests/test_main.py::test_create_and_read - AttributeError: 'async_generator' object has no attribute 'post'
FAILED tests/test_main.py::test_done_flag - AttributeError: 'async_generator' object has no attribute 'post'
================================================== 2 failed, 5 warnings in 29.49s ==================================================