Skip to content

Commit 4cdb0fe

Browse files
authored
バージョンアップや機能を追加 (#44)
2 parents 03bda50 + 9db0d15 commit 4cdb0fe

87 files changed

Lines changed: 12451 additions & 6817 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
/.next/
1313
/out/
1414

15+
# typescript
16+
*.tsbuildinfo
17+
1518
# production
1619
/build
1720

@@ -21,8 +24,6 @@
2124

2225
# debug
2326
npm-debug.log*
24-
yarn-debug.log*
25-
yarn-error.log*
2627

2728
# local env files
2829
.env.local

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.replit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
modules = ["nodejs-20", "nodejs-21"]
2-
run = "yarn run dev"
1+
modules = ["nodejs-22"]
2+
run = "npm run dev"
33

44
[nix]
55
channel = "stable-24_05"
66

77
[deployment]
8-
run = ["sh", "-c", "yarn run dev"]
8+
run = ["sh", "-c", "npm run dev"]
99

1010
[[ports]]
1111
localPort = 3000

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 21.1.0
1+
nodejs 22.22.1

CLAUDE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
`tools.su-u.dev` is a collection of browser-based developer utilities (encoding, text manipulation, JSON tools, date/time conversion, hashing, UUID/image generation). All logic runs client-side in the browser — there is no backend. The UI is in Japanese. Deployed on Vercel; live at https://tools.su-u.dev/.
8+
9+
## Commands
10+
11+
```bash
12+
npm run dev # Next.js dev server at http://localhost:3000
13+
npm run build # Production build
14+
npm test # Run all Jest tests
15+
npm test path/to/file.test.ts # Run a single test file
16+
npm run lint # next lint
17+
npm run lint-fix # next lint --fix
18+
npm run format # Prettier on all .ts/.tsx
19+
```
20+
21+
Node version is pinned to `22.22.1` (see `.tool-versions`). Use `npm` (a `package-lock.json` is committed). Note: `.npmrc` sets `legacy-peer-deps=true` to tolerate the eslint 9 / eslint-config-next 14 peer-dependency conflict.
22+
23+
Note: ESLint errors do **not** fail the production build (`ignoreDuringBuilds: true` in `.eslintrc.js`), and `tsconfig.json` has `strict: false`. Run `npm run lint` and `npm test` explicitly to catch problems.
24+
25+
## Architecture
26+
27+
Next.js 14 App Router. Each tool is a self-contained directory under `src/app/<tool_name>/` following a consistent 3-file pattern:
28+
29+
- **`page.tsx`** — server component. Exports `metadata` (page `<title>`) and a default-exported page that renders the feature component. Keep it thin.
30+
- **`<Feature>.tsx`**`'use client'` component. Wraps everything in `<FormProvider {...methods}><AppLayout>...`. Uses rsuite `Grid/Row/Col/Panel` for layout and `react-hook-form` `Controller` to bind inputs.
31+
- **`use<Feature>.ts`** — the hook holding all state/logic. Returns `{ methods, output, ... }`. This is where the actual tool logic lives.
32+
33+
Pure, testable logic is extracted into a separate `*Lib.ts` file (e.g. `json_formatter/jsonFormatterLib.ts` with a colocated `jsonFormatterLib.test.ts`). Tests live next to the code they test.
34+
35+
### Forms and state (the central pattern)
36+
37+
All tools manage input state through `react-hook-form`:
38+
39+
1. The hook calls `useCustomForm<FormType>({ defaultValues })` (`src/components/common/Form/useCustomForm.ts`) — a thin wrapper that sets `mode: 'onChange'`.
40+
2. Output is derived from form values via `watch()` + `useEffect`, stored in local `useState`.
41+
3. `useFormPersistence(featureName, methods, setCallback)` (`src/hooks/useFormPersistence.ts`) persists form data to `localStorage` under the key `devtools.formData.<featureName>` and restores it on mount via the `setCallback`. Every tool calls this with a unique `featureName`.
42+
43+
When adding a new tool, replicate this pattern: define a `FormType` and `DEFAULT_VALUES`, wire `useCustomForm`, call `useFormPersistence` with a unique name, and derive output in a `useEffect`.
44+
45+
### Registering a new tool
46+
47+
A tool is not visible until it's added to the `features` array in `src/components/common/Features.tsx`. This single array is the source of truth for the sidebar navigation (`SideNavBar.tsx`) and the home page cards (`src/app/home/`). Add an item (`key`, `title`, `path`, optional `shortTitle`/`description`) under the appropriate group. The `path` must match the App Router directory route.
48+
49+
### Shared building blocks
50+
51+
- **`src/Layout/App.tsx`**`AppLayout` renders the `Provider` + `SideNavBar` + content shell. Every feature component wraps its body in `AppLayout`.
52+
- **`src/app/Provider.tsx`** — sets up rsuite `CustomProvider` (dark theme) and antd `ConfigProvider` (dark algorithm, Japanese locale). Dark theme is hardcoded app-wide.
53+
- **`src/components/common/`** — reusable UI: `PageTitle`, `PanelHeader`, `Editor` (CodeMirror wrapper, exports `ex` for extensions like `lineWrapping`), and `Form/` (form-aware `Input`, `TextArea`, `Select`, `DatePicker`, `CopyButton`, `ClearButton`, etc. — these read from the surrounding `FormProvider` context).
54+
- **`src/lib/`** — pure helpers: `encoding.ts`, `hashAlgorithms.ts`, `dayjs.ts` (configured dayjs instance — import from here), `gtag.ts`.
55+
- **`src/hooks/`**`useFormPersistence`, `useCopy`.
56+
57+
### Conventions
58+
59+
- **UI libraries**: primarily **rsuite** for layout/components, with **antd** also available. **Emotion** (`@emotion/styled`) for styled components.
60+
- **Imports**: use the `@/*` path alias (maps to `src/*`). ESLint enforces alphabetized import order (`import/order`).
61+
- **Prettier**: single quotes, semicolons, trailing commas, 100-char width, 2-space tabs.
62+
- Client components that use hooks/state must start with `'use client'`.

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
1+
# Dev Toolkit
12

2-
# Dev Toolkit
33
Web utility tools for developers
44

55
開発者のための、Webユーティリティツール
66

77
https://tools.su-u.dev/
88

9-
## 現在利用できる機能
9+
すべての処理はブラウザ上(クライアントサイド)で完結し、サーバーへはデータを送信しません。
1010

11-
- base64エンコードへの変換
12-
- 文字数(行数など)カウント
13-
- 文字列置換
14-
- punycode変換(日本語ドメイン変換)
15-
- テキスト差分
16-
- 数値に区切り文字追加
17-
- JSONフォーマット
11+
## 技術スタック
12+
13+
- [Next.js 14](https://nextjs.org/)(App Router)/ React 18 / TypeScript
14+
- UI: [Ant Design (antd)](https://ant.design/) + [Emotion](https://emotion.sh/)
15+
- フォーム: [react-hook-form](https://react-hook-form.com/)
16+
- エディタ: [CodeMirror](https://codemirror.net/)(差分は [Monaco Editor](https://microsoft.github.io/monaco-editor/)
17+
- テスト: [Jest](https://jestjs.io/)
18+
- デプロイ: [Vercel](https://vercel.com/)
19+
20+
Node.js のバージョンは `.tool-versions``22.22.1`)に固定しています。パッケージマネージャーは npm を使用します。
1821

1922
## 開発の始め方
2023

2124
```bash
22-
yarn install
25+
npm install
2326

24-
yarn dev
27+
npm run dev
2528
```
2629

2730
[http://localhost:3000](http://localhost:3000) を開く
2831

32+
## コマンド
33+
34+
```bash
35+
npm run dev # 開発サーバー
36+
npm run build # 本番ビルド
37+
npm start # 本番サーバー
38+
npm test # テスト実行
39+
npm run lint # Lint
40+
npm run format # Prettier
41+
```

next.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
eslint: {
4+
// ESLint エラーでも本番ビルドを失敗させない(lint は `npm run lint` で明示的に実行する)
5+
ignoreDuringBuilds: true,
6+
},
7+
// @faker-js/faker は ESM 専用配布のため、ビルド/テスト時にトランスパイル対象に含める
8+
transpilePackages: ['@faker-js/faker'],
9+
};
10+
11+
module.exports = nextConfig;

0 commit comments

Comments
 (0)