Skip to content

Commit 01fffb9

Browse files
committed
💥 Force compiler into runes mode and replace UI library from Flowbite Svelte to Svelte 5 UI lib (#1619)
1 parent 542d707 commit 01fffb9

File tree

76 files changed

+1538
-830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1538
-830
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
- JavaScriptのランタイム
2727
- [Node.js](https://nodejs.org): v22.x
2828
- 汎用フレームワーク
29-
- [Svelte](https://svelte.dev/): v5.x。後方互換性を優先しているが、Runes が利用できるように破壊的な変更が含まれる箇所を段階的に移行予定
29+
- [Svelte](https://svelte.dev/): v5.x。Runes mode で運用中
3030
- [SvelteKit](https://svelte.dev/): v2.x
3131
- UIライブラリ
32-
- [Flowbite Svelte](https://flowbite-svelte.com/)
32+
- [Svelte 5 UI lib](https://svelte-5-ui-lib.codewithshin.com/) - Svelte v5.xにおける[Flowbite Svelte](https://flowbite-svelte.com/)の代替ライブラリ。一部の属性名・値などが変更されていることに注意が必要。コンポーネントが未実装である場合は、[Flowbite](https://flowbite.com/)を暫定的に利用する
3333
- [STWUI](https://stwui.vercel.app/): 開発が事実上終了した可能性が高いため、使用しているコンポーネントを調べて別のライブラリに移行する
3434
- テスティングフレームワーク
3535
- [Vitest](https://vitest.dev/): 単体テスト (ユーティリティ、コンポーネント)
@@ -120,18 +120,17 @@
120120

121121
`docker compose exec web pnpm exec playwright install-deps`
122122

123-
`docker compose exec -e DATABASE_URL=postgresql://db_user:db_password@db:5432/test_db web pnpm prisma db push`
123+
`docker compose exec -e DATABASE_URL=postgresql://db_user:db_password@db:5432/test_db?pgbouncer=true&connection_limit=10&connect_timeout=60&statement_timeout=60000 -e DIRECT_URL=postgresql://db_user:db_password@db:5432/test_db web pnpm prisma db push`
124124

125125
`docker compose exec web pnpm prisma generate`
126126

127-
- 開発サーバ(port番号: 5173)を起動します。その後、以下のリンクを順番にクリックしてください。
127+
- 開発サーバ(port番号: 5174)を起動します。その後、以下のリンクを順番にクリックしてください。
128128

129129
- Note: リンクのアドレス・ポート番号は、環境によって変わる可能性もあります。
130130

131131
`docker compose exec web pnpm dev --host`
132132

133-
http://172.18.0.3:5173
134-
http://127.0.0.1:5173/
133+
http://localhost:5174/
135134

136135
- ホーム画面が起動し、ユーザの登録・ログインができれば、環境構築は完了です。
137136

@@ -166,11 +165,11 @@
166165

167166
- 以下のリンクをクリックしてください。
168167

169-
<http://127.0.0.1:5173/>
168+
<http://localhost:5174/>
170169

171170
- また、開発サーバの起動と同時に新しいブラウザタブでアプリを開くこともできます。
172171

173-
`pnpm dev -- --open`
172+
`pnpm dev --open`
174173

175174
- 先ほどとは異なるターミナルで以下のコマンドをそれぞれ実行すると、データベースの初期データ投入やローカル環境でのテーブル・サンプルデータが閲覧できます。
176175

@@ -268,6 +267,17 @@
268267

269268
### トラブルシューティング
270269

270+
- エラー: ローカル環境で開発用サーバを立ち上げても、ブラウザに表示されない
271+
272+
- 前提条件: Docker Desktop 4.30.0 以上、かつ、VSCode DevContainer で Vite を動かす場合。Windows、macOS で発生する
273+
- 原因: Dockerで、ホストが IPv4 のみを使用している場合でも、`::1` を返すようになったため
274+
- 対処方法: `vite.config` に、server の host を追記する
275+
- 参考資料
276+
- [Docker の Issues](https://github.com/docker/for-mac/issues/7276)
277+
- [Vite の Issues](https://github.com/vitejs/vite/issues/16522#issuecomment-2432846922)
278+
- [Zenn の記事](https://zenn.dev/onozaty/articles/docker-desktop-portforward-not-working)
279+
- [本プロジェクトでの対処状況](https://github.com/AtCoder-NoviSteps/AtCoderNoviSteps/issues/814#issuecomment-2131173142)
280+
271281
- エラー: Docker Desktop で Vite を利用したときに Segmentation Fault が発生
272282

273283
- 対処方法: Docker Desktopで「Use Visualization Framework」のチェックを外す

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"eslint": "9.20.0",
4949
"eslint-config-prettier": "10.0.1",
5050
"eslint-plugin-svelte": "2.46.1",
51-
"flowbite-svelte": "0.47.4",
5251
"flowbite-svelte-icons": "2.0.2",
5352
"globals": "15.14.0",
5453
"husky": "9.1.7",
@@ -64,6 +63,7 @@
6463
"svelte": "5.19.9",
6564
"svelte-check": "4.1.4",
6665
"svelte-meta-tags": "4.1.0",
66+
"svelte-5-ui-lib": "0.12.2",
6767
"sveltekit-superforms": "2.23.1",
6868
"tslib": "2.8.1",
6969
"typescript": "5.6.3",
@@ -82,6 +82,8 @@
8282
"@types/node": "22.13.1",
8383
"autoprefixer": "10.4.20",
8484
"debug": "4.4.0",
85+
"embla-carousel-autoplay": "8.5.2",
86+
"embla-carousel-svelte": "8.5.2",
8587
"flowbite": "2.5.2",
8688
"lucia": "2.7.7",
8789
"playwright": "1.50.1",
@@ -93,5 +95,5 @@
9395
"vercel": "41.0.3",
9496
"xss": "1.0.15"
9597
},
96-
"packageManager": "pnpm@9.15.2"
98+
"packageManager": "pnpm@10.2.1"
9799
}

pnpm-lock.yaml

Lines changed: 81 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/AtCoderUserValidationForm.svelte

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<script lang="ts">
2-
import { Label, Input, P } from 'flowbite-svelte';
3-
// @ts-ignore
2+
import { Label, Input, P } from 'svelte-5-ui-lib';
43
import ClipboardOutline from 'flowbite-svelte-icons/ClipboardOutline.svelte';
4+
// FIXME: stwui は事実上開発が終了しているので、別のライブラリに置き換える
55
import { copyToClipboard } from 'stwui/utils/copyToClipboard';
6-
//import type { ActionForm } from './$types';
76
87
import ContainerWrapper from '$lib/components/ContainerWrapper.svelte';
98
import FormWrapper from '$lib/components/FormWrapper.svelte';
109
import LabelWrapper from '$lib/components/LabelWrapper.svelte';
1110
import SubmissionButton from '$lib/components/SubmissionButton.svelte';
1211
13-
export let username: string;
14-
export let atcoder_username: string;
15-
export let atcoder_validationcode: string;
12+
interface Props {
13+
username: string;
14+
atcoder_username: string;
15+
atcoder_validationcode: string;
16+
status: string;
17+
}
1618
17-
// status = notiong : username = "hogehoge" and atcoder_username = "" and atcoder_validationcode = "" and atcoder_validated = false
18-
// status = generated : username = "hogehoge" and atcoder_username = "fugafuga" and atcoder_validationcode = "xxxxxx" and validated = false
19-
// status = validated = username = "hogehoge" and atcoder_username = "fugafuga" and atcoder_validationcode = "" and validated = true
20-
// for noting -> generated, push "generate" button (only "generate" button is aveilable)
21-
// for generated -> validated, push "validate" button ( "validate" and "edit" button is available )
22-
23-
// for generated/validated -> notiong, push "edit" button ( "edit" is available)
24-
export let status: string;
19+
let {
20+
username = $bindable(),
21+
atcoder_username = $bindable(),
22+
atcoder_validationcode = $bindable(),
23+
status,
24+
}: Props = $props();
2525
2626
// TODO: クリックしたときに、Copied!といったメッセージを表示できるようにしたい。
2727
// WHY: コピーができているか、確認できるようにするため
@@ -37,7 +37,7 @@
3737
本人確認の準備中
3838
</h3>
3939

40-
<P PsizeType="md" class="mt-6">AtCoder IDを入力し、本人確認用の文字列を生成してください。</P>
40+
<P size="base" class="mt-6">AtCoder IDを入力し、本人確認用の文字列を生成してください。</P>
4141

4242
<!-- hiddenでusernameを持つのは共通-->
4343
<Input size="md" type="hidden" name="username" bind:value={username} />
@@ -48,7 +48,6 @@
4848
<span>AtCoder ID</span>
4949
<Input
5050
size="md"
51-
label="atcoder_username"
5251
name="atcoder_username"
5352
placeholder="chokudai"
5453
bind:value={atcoder_username}
@@ -63,7 +62,7 @@
6362
<FormWrapper action="?/validate" marginTop="">
6463
<h3 class="text-xl text-center mt-6 font-medium text-gray-900 dark:text-white">本人確認中</h3>
6564

66-
<P PsizeType="md" class="mt-6">
65+
<P size="base" class="mt-6">
6766
AtCoderの所属欄に生成した文字列を貼り付けてから、「本人確認」ボタンを押してください。
6867
</P>
6968

@@ -86,7 +85,9 @@
8685
<span>本人確認用の文字列</span>
8786
<div>
8887
<Input size="md" bind:value={atcoder_validationcode}>
89-
<ClipboardOutline slot="right" class="w-5 h-5" on:click={handleClick} />
88+
{#snippet right()}
89+
<ClipboardOutline class="w-5 h-5" onclick={handleClick} />
90+
{/snippet}
9091
</Input>
9192
</div>
9293
</Label>

0 commit comments

Comments
 (0)