@cakejp/design-system 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +144 -0
- package/CHANGELOG.md +115 -0
- package/CLAUDE.md +188 -0
- package/CLAUDE_PRODUCTION.md +121 -0
- package/MIGRATION.md +228 -0
- package/README.md +79 -0
- package/RELEASE.md +205 -0
- package/bin/init.js +134 -0
- package/component-registry.json +1146 -0
- package/contracts/components.json +730 -0
- package/contracts/rules.json +559 -0
- package/dist/index.css +1 -0
- package/dist/index.js +9344 -0
- package/dist/types/components/ec/_mypage-menu-data.d.ts +15 -0
- package/dist/types/components/ec/admin-layout.d.ts +31 -0
- package/dist/types/components/ec/anniversary-card.d.ts +50 -0
- package/dist/types/components/ec/cake-logo.d.ts +22 -0
- package/dist/types/components/ec/chart-controls.d.ts +16 -0
- package/dist/types/components/ec/countdown-timer.d.ts +24 -0
- package/dist/types/components/ec/coupon-card.d.ts +47 -0
- package/dist/types/components/ec/delivery-calendar.d.ts +36 -0
- package/dist/types/components/ec/order-section.d.ts +29 -0
- package/dist/types/components/ec/order-summary.d.ts +36 -0
- package/dist/types/components/ec/payment-method.d.ts +41 -0
- package/dist/types/components/ec/product-card.d.ts +77 -0
- package/dist/types/components/ec/product-carousel.d.ts +56 -0
- package/dist/types/components/ec/product-cta.d.ts +35 -0
- package/dist/types/components/ec/product-detail-bar.d.ts +62 -0
- package/dist/types/components/ec/product-detail-sidebar.d.ts +115 -0
- package/dist/types/components/ec/product-list-item.d.ts +90 -0
- package/dist/types/components/ec/product-option.d.ts +62 -0
- package/dist/types/components/ec/rating-stars.d.ts +30 -0
- package/dist/types/components/ec/review-card.d.ts +44 -0
- package/dist/types/components/ec/review-form.d.ts +40 -0
- package/dist/types/components/ec/review-summary.d.ts +53 -0
- package/dist/types/components/ec/shop-card.d.ts +48 -0
- package/dist/types/components/ec/stat-card.d.ts +44 -0
- package/dist/types/components/foundations/accordion.d.ts +7 -0
- package/dist/types/components/foundations/alert-dialog.d.ts +18 -0
- package/dist/types/components/foundations/alert.d.ts +42 -0
- package/dist/types/components/foundations/aspect-ratio.d.ts +3 -0
- package/dist/types/components/foundations/avatar.d.ts +11 -0
- package/dist/types/components/foundations/badge.d.ts +9 -0
- package/dist/types/components/foundations/breadcrumb.d.ts +11 -0
- package/dist/types/components/foundations/button.d.ts +10 -0
- package/dist/types/components/foundations/calendar.d.ts +8 -0
- package/dist/types/components/foundations/card.d.ts +9 -0
- package/dist/types/components/foundations/checkbox-card.d.ts +30 -0
- package/dist/types/components/foundations/checkbox-group.d.ts +53 -0
- package/dist/types/components/foundations/checkbox.d.ts +4 -0
- package/dist/types/components/foundations/collapsible.d.ts +5 -0
- package/dist/types/components/foundations/command.d.ts +18 -0
- package/dist/types/components/foundations/context-menu.d.ts +25 -0
- package/dist/types/components/foundations/data-table.d.ts +104 -0
- package/dist/types/components/foundations/dialog.d.ts +17 -0
- package/dist/types/components/foundations/drawer.d.ts +13 -0
- package/dist/types/components/foundations/dropdown-menu.d.ts +25 -0
- package/dist/types/components/foundations/form.d.ts +24 -0
- package/dist/types/components/foundations/hover-card.d.ts +6 -0
- package/dist/types/components/foundations/input.d.ts +3 -0
- package/dist/types/components/foundations/label.d.ts +7 -0
- package/dist/types/components/foundations/menubar.d.ts +26 -0
- package/dist/types/components/foundations/navigation-menu.d.ts +14 -0
- package/dist/types/components/foundations/pagination.d.ts +13 -0
- package/dist/types/components/foundations/popover.d.ts +10 -0
- package/dist/types/components/foundations/progress.d.ts +4 -0
- package/dist/types/components/foundations/radio-group.d.ts +9 -0
- package/dist/types/components/foundations/responsive-dialog.d.ts +52 -0
- package/dist/types/components/foundations/scroll-area.d.ts +5 -0
- package/dist/types/components/foundations/select.d.ts +15 -0
- package/dist/types/components/foundations/separator.d.ts +4 -0
- package/dist/types/components/foundations/sheet.d.ts +14 -0
- package/dist/types/components/foundations/skeleton.d.ts +2 -0
- package/dist/types/components/foundations/slider.d.ts +4 -0
- package/dist/types/components/foundations/sonner.d.ts +3 -0
- package/dist/types/components/foundations/spinner.d.ts +6 -0
- package/dist/types/components/foundations/switch.d.ts +13 -0
- package/dist/types/components/foundations/table.d.ts +10 -0
- package/dist/types/components/foundations/tabs.d.ts +12 -0
- package/dist/types/components/foundations/textarea.d.ts +3 -0
- package/dist/types/components/foundations/toggle-group.d.ts +23 -0
- package/dist/types/components/foundations/toggle.d.ts +9 -0
- package/dist/types/components/foundations/tooltip.d.ts +7 -0
- package/dist/types/components/pages/cake/_mypage-shell.d.ts +41 -0
- package/dist/types/components/primitives/banner-carousel.d.ts +54 -0
- package/dist/types/components/primitives/bottom-tab-bar.d.ts +39 -0
- package/dist/types/components/primitives/bulk-action-bar.d.ts +32 -0
- package/dist/types/components/primitives/category-scroll.d.ts +70 -0
- package/dist/types/components/primitives/category-shortcuts.d.ts +44 -0
- package/dist/types/components/primitives/chip.d.ts +44 -0
- package/dist/types/components/primitives/coach-mark.d.ts +28 -0
- package/dist/types/components/primitives/empty-state.d.ts +36 -0
- package/dist/types/components/primitives/error-state.d.ts +41 -0
- package/dist/types/components/primitives/filter-bar.d.ts +56 -0
- package/dist/types/components/primitives/footer.d.ts +81 -0
- package/dist/types/components/primitives/form-field.d.ts +46 -0
- package/dist/types/components/primitives/header.d.ts +69 -0
- package/dist/types/components/primitives/image-carousel.d.ts +52 -0
- package/dist/types/components/primitives/image-gallery.d.ts +35 -0
- package/dist/types/components/primitives/image-uploader.d.ts +19 -0
- package/dist/types/components/primitives/kebab-menu.d.ts +38 -0
- package/dist/types/components/primitives/list-item.d.ts +60 -0
- package/dist/types/components/primitives/menu-drawer.d.ts +75 -0
- package/dist/types/components/primitives/notification-badge.d.ts +30 -0
- package/dist/types/components/primitives/notification-list.d.ts +45 -0
- package/dist/types/components/primitives/price-display.d.ts +33 -0
- package/dist/types/components/primitives/progress-steps.d.ts +27 -0
- package/dist/types/components/primitives/quantity-selector.d.ts +50 -0
- package/dist/types/components/primitives/search-bar.d.ts +31 -0
- package/dist/types/components/primitives/search-panel.d.ts +41 -0
- package/dist/types/components/primitives/section-header.d.ts +51 -0
- package/dist/types/components/primitives/share-buttons.d.ts +23 -0
- package/dist/types/components/primitives/side-nav.d.ts +62 -0
- package/dist/types/components/primitives/social-login-button.d.ts +24 -0
- package/dist/types/components/primitives/status-count-tabs.d.ts +14 -0
- package/dist/types/components/primitives/sticky-action-bar.d.ts +7 -0
- package/dist/types/components/primitives/sub-nav.d.ts +34 -0
- package/dist/types/components/primitives/tag.d.ts +19 -0
- package/dist/types/index.d.ts +109 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/package.json +186 -0
- package/scripts/codemod/check-migration.mjs +97 -0
- package/scripts/codemod/v0.2-to-v0.3.mjs +192 -0
- package/src/preset-standalone.css +109 -0
- package/src/preset.css +288 -0
- package/src/styles/primitive.css +139 -0
- package/src/styles/semantic.css +203 -0
- package/src/styles/typography.css +129 -0
- package/templates/AGENTS.md +56 -0
- package/templates/CLAUDE.md +56 -0
- package/tokens.json +127 -0
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
@cakejp/design-system のバージョン間移行ガイド。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## v0.2.x → v0.3.0
|
|
8
|
+
|
|
9
|
+
### 概要
|
|
10
|
+
|
|
11
|
+
v0.3.0 では **3-tier 構造への再編成** と **業界標準命名への揃え** を実施しました。
|
|
12
|
+
|
|
13
|
+
| 変更カテゴリ | 内容 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| **フォルダ構造** | `ui/` `cake/` → `foundations/` `primitives/` `ec/` |
|
|
16
|
+
| **コンポーネント rename** | 7 個(Material 固有用語・冗長命名・非標準用語の整理) |
|
|
17
|
+
| **API 変更** | `MypageSidebar` → `SideNav + mypageMenuGroups` |
|
|
18
|
+
|
|
19
|
+
### 後方互換性
|
|
20
|
+
|
|
21
|
+
**v0.2.x のコードは v0.3.0 でもそのまま動きます。** 旧名はすべて `@deprecated` alias として残してあります。
|
|
22
|
+
|
|
23
|
+
ただし開発環境(`NODE_ENV !== 'production'`)では console に警告が出ます:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
[@cakejp/design-system] 'TopAppBar' is deprecated and will be removed in v1.0.
|
|
27
|
+
→ Use 'Header' instead.
|
|
28
|
+
→ Run 'npx @cakejp/design-system codemod v0.2-to-v0.3' to auto-migrate.
|
|
29
|
+
→ See https://github.com/flashpark/cake-design-system/blob/main/MIGRATION.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**production ビルドには影響しません**(dead code elimination で警告は削除されます)。
|
|
33
|
+
|
|
34
|
+
### 自動移行
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 利用側プロジェクトで実行
|
|
38
|
+
npx @cakejp/design-system codemod v0.2-to-v0.3 ./src
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
このコマンドが自動で:
|
|
42
|
+
- `import { TopAppBar }` → `import { Header }` に置換
|
|
43
|
+
- JSX タグ `<TopAppBar>` → `<Header>` に置換
|
|
44
|
+
- 型 `TopAppBarProps` → `HeaderProps` に置換
|
|
45
|
+
- 7 コンポーネント全部一括対応
|
|
46
|
+
|
|
47
|
+
### 手動移行リファレンス
|
|
48
|
+
|
|
49
|
+
#### 1. シンプル rename(同一シグネチャ)
|
|
50
|
+
|
|
51
|
+
| v0.2.x | v0.3.0+ | 理由 |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `Banner` | `Alert` (bordered variant + prop-based API) | Alert と機能重複していたため統合 |
|
|
54
|
+
| `TopAppBar` | `Header` | Material 固有用語 → HTML semantic に統一 |
|
|
55
|
+
| `BottomNavigation` | `BottomTabBar` | Material 固有 → iOS / Bootstrap 標準 |
|
|
56
|
+
| `BottomAction` | `StickyActionBar` | 用途不明 → Web 慣習 (Bootstrap fixed-bottom) |
|
|
57
|
+
| `Balloon` | `CoachMark` | 日本語圏特有 → Atlassian / Pendo 標準 |
|
|
58
|
+
| `NavigationRibbon` | `SubNav` | 「Ribbon」は MS Office 固有 → GitHub Primer 標準 |
|
|
59
|
+
| `CategoryIconStrip` | `CategoryShortcuts` | 「Strip」は曖昧 → Shopify / Ant Design 慣習 |
|
|
60
|
+
| `mypageSidebarDefaultGroups` | `mypageMenuGroups` | 命名整理 |
|
|
61
|
+
|
|
62
|
+
### Banner → Alert (bordered variant + prop-based API)
|
|
63
|
+
|
|
64
|
+
v0.3.0 で Alert の bordered variant に **prop-based API** を追加。
|
|
65
|
+
`children` を渡さない場合は title / description / action prop で構築できる。
|
|
66
|
+
見た目は Alert の bordered スタイル(白bg + 色枠 + 5px outer ring)で統一。
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// Before (v0.2.x)
|
|
70
|
+
import { Banner } from '@cakejp/design-system'
|
|
71
|
+
|
|
72
|
+
<Banner
|
|
73
|
+
variant="caution"
|
|
74
|
+
title="銀行口座が未登録です"
|
|
75
|
+
description="売上の振込を受け取るには、銀行口座の登録が必要です。"
|
|
76
|
+
action={<Button>登録する</Button>}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
// After (v0.3+)
|
|
80
|
+
import { Alert } from '@cakejp/design-system'
|
|
81
|
+
|
|
82
|
+
<Alert
|
|
83
|
+
variant="warning"
|
|
84
|
+
title="銀行口座が未登録です"
|
|
85
|
+
description="売上の振込を受け取るには、銀行口座の登録が必要です。"
|
|
86
|
+
action={<Button>登録する</Button>}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
variant 対応表:
|
|
91
|
+
|
|
92
|
+
| Banner variant | Alert variant |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `caution` | `warning` または `error`(赤色寄りなら `error`) |
|
|
95
|
+
| `warning` | `warning` |
|
|
96
|
+
| `info` | `info` |
|
|
97
|
+
| `success` | `success` |
|
|
98
|
+
|
|
99
|
+
prop API は同じ(title / description / action / icon)。
|
|
100
|
+
アイコンは variant に応じて自動選択(Warning2 / InfoCircle / TickCircle / CloseCircle)、
|
|
101
|
+
`icon` prop でカスタムアイコンも指定可能。
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
これらは **import 文・型名・JSX タグの単純置換** で対応可能:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
// Before
|
|
109
|
+
import { TopAppBar, BottomNavigation, Balloon } from '@cakejp/design-system'
|
|
110
|
+
import type { TopAppBarProps } from '@cakejp/design-system'
|
|
111
|
+
|
|
112
|
+
<TopAppBar variant="logo" />
|
|
113
|
+
<BottomNavigation items={[...]} />
|
|
114
|
+
<Balloon direction="top">ヒント</Balloon>
|
|
115
|
+
|
|
116
|
+
// After
|
|
117
|
+
import { Header, BottomTabBar, CoachMark } from '@cakejp/design-system'
|
|
118
|
+
import type { HeaderProps } from '@cakejp/design-system'
|
|
119
|
+
|
|
120
|
+
<Header variant="logo" />
|
|
121
|
+
<BottomTabBar items={[...]} />
|
|
122
|
+
<CoachMark direction="top">ヒント</CoachMark>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### 2. API 変更を伴う移行: `MypageSidebar`
|
|
126
|
+
|
|
127
|
+
汎用サイドナビ + Cake.jp 専用データに分離されました。
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
// Before (v0.2.x)
|
|
131
|
+
import { MypageSidebar } from '@cakejp/design-system'
|
|
132
|
+
|
|
133
|
+
<MypageSidebar activeMenu="news" />
|
|
134
|
+
// ↑ デフォルトで Cake.jp マイページの 17 項目メニューを表示
|
|
135
|
+
|
|
136
|
+
// After (v0.3+) — 推奨
|
|
137
|
+
import { SideNav, mypageMenuGroups } from '@cakejp/design-system'
|
|
138
|
+
|
|
139
|
+
<SideNav
|
|
140
|
+
groups={mypageMenuGroups}
|
|
141
|
+
activeMenu="news"
|
|
142
|
+
ariaLabel="マイページメニュー"
|
|
143
|
+
/>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`SideNav` は汎用なので、jobboard など他事業の独自メニューでも使えます:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { SideNav } from '@cakejp/design-system'
|
|
150
|
+
import { Briefcase, FileText } from 'iconsax-reactjs'
|
|
151
|
+
|
|
152
|
+
const jobboardMenu = [
|
|
153
|
+
{
|
|
154
|
+
items: [
|
|
155
|
+
{ icon: <Briefcase size={16} />, label: "求人検索", href: "/jobs", key: "jobs" },
|
|
156
|
+
{ icon: <FileText size={16} />, label: "応募履歴", href: "/applications", key: "apps" },
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
<SideNav groups={jobboardMenu} activeMenu="jobs" ariaLabel="求人メニュー" />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### 3. ディレクトリ構造(社内開発のみ影響)
|
|
165
|
+
|
|
166
|
+
外部 npm 利用側は影響なし(バレル export 経由)。社内コード内の個別 import を使っている場合:
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// Before
|
|
170
|
+
import { Button } from '@/components/ui/button'
|
|
171
|
+
import { ProductCard } from '@/components/cake/product-card'
|
|
172
|
+
|
|
173
|
+
// After
|
|
174
|
+
import { Button } from '@/components/foundations/button'
|
|
175
|
+
import { ProductCard } from '@/components/ec/product-card'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
新構造:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
src/components/
|
|
182
|
+
├── foundations/ shadcn ベース汎用 UI(46個)
|
|
183
|
+
├── primitives/ 業界汎用パターン(35個・jobboard 等他事業でも再利用可)
|
|
184
|
+
└── ec/ Cake.jp / EC 事業特化(23個)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 段階的削除スケジュール
|
|
188
|
+
|
|
189
|
+
| バージョン | リリース予定 | deprecated alias の状態 |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| **v0.3.0** | 2026-05 | ✅ 動作(dev mode で console.warn) |
|
|
192
|
+
| **v0.4.0** | 2026-07 予定 | ⚠️ 動作(production でも警告 / runtime warn 強化) |
|
|
193
|
+
| **v0.5.0** | 2026-09 予定 | 🚨 動作(npm install 時 peer warning) |
|
|
194
|
+
| **v1.0.0** | 2026-11 予定 | ❌ 完全削除 |
|
|
195
|
+
|
|
196
|
+
利用側は **v0.4 までに移行完了** が推奨。Codemod を使えば数分で対応可能です。
|
|
197
|
+
|
|
198
|
+
### 移行進捗の自己診断
|
|
199
|
+
|
|
200
|
+
利用側プロジェクトで残作業を可視化:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npx @cakejp/design-system check-migration ./src
|
|
204
|
+
# → 旧 API 利用箇所をリストアップ
|
|
205
|
+
# → 残工数(n 件中 m 件移行済み)を報告
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### ESLint plugin(v0.4 で導入予定)
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
// .eslintrc.json
|
|
212
|
+
{
|
|
213
|
+
"extends": ["@cakejp/design-system/eslint"]
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
旧名 import がエディタで赤線エラー、`--fix` で自動修正。
|
|
218
|
+
|
|
219
|
+
### サポート
|
|
220
|
+
|
|
221
|
+
質問・問題報告は GitHub Issue: https://github.com/flashpark/cake-design-system/issues
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 過去のリリース
|
|
226
|
+
|
|
227
|
+
- v0.2.0 → v0.2.2: 後方互換あり(patch リリース)
|
|
228
|
+
- v0.1.x → v0.2.0: shadcn 構造の整理(社内のみ、利用側影響なし)
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @cakejp/design-system
|
|
2
|
+
|
|
3
|
+
Cake.jp デザインシステム — 104 個の React コンポーネント・カラートークン・タイポグラフィ。
|
|
4
|
+
|
|
5
|
+
## インストール
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cakejp/design-system
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使い方
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button, ProductCard, Header } from "@cakejp/design-system"
|
|
15
|
+
import "@cakejp/design-system/dist/index.css"
|
|
16
|
+
|
|
17
|
+
<Header logo={<MyLogo />} variant="logo" />
|
|
18
|
+
<ProductCard ... />
|
|
19
|
+
<Button>カートに入れる</Button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 構造
|
|
23
|
+
|
|
24
|
+
3-tier アーキテクチャ:
|
|
25
|
+
|
|
26
|
+
| レイヤー | 内容 | コンポーネント数 |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `foundations/` | shadcn ベース汎用 UI(Button, Input, Dialog 等) | 46 |
|
|
29
|
+
| `primitives/` | 業界汎用パターン(Header, SideNav, PriceDisplay 等) | 35 |
|
|
30
|
+
| `ec/` | Cake.jp / EC 事業特化(ProductCard, CouponCard 等) | 23 |
|
|
31
|
+
|
|
32
|
+
依存方向: `ec/` → `primitives/` → `foundations/`(逆方向 import 禁止、CI で検証)
|
|
33
|
+
|
|
34
|
+
## ドキュメント
|
|
35
|
+
|
|
36
|
+
- [Storybook](https://flashpark.github.io/cake-design-system/) — 全コンポーネントのカタログ
|
|
37
|
+
- [CHANGELOG.md](./CHANGELOG.md) — リリース履歴
|
|
38
|
+
- [MIGRATION.md](./MIGRATION.md) — バージョン間移行ガイド
|
|
39
|
+
- [RELEASE.md](./RELEASE.md) — リリース運用ルール(週1手動)
|
|
40
|
+
- [CLAUDE.md](./CLAUDE.md) — AI エージェント向け使用ルール
|
|
41
|
+
|
|
42
|
+
## バージョン移行
|
|
43
|
+
|
|
44
|
+
### v0.2.x → v0.3.0
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 自動移行(推奨)
|
|
48
|
+
npx @cakejp/design-system codemod v0.2-to-v0.3 ./src
|
|
49
|
+
|
|
50
|
+
# 移行進捗の確認
|
|
51
|
+
npx @cakejp/design-system check-migration ./src
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
旧 API(`TopAppBar`, `BottomNavigation`, `Balloon` 等)は v0.3.0 でも動作しますが、開発時に console 警告が出ます。v1.0 で完全削除予定。
|
|
55
|
+
|
|
56
|
+
詳細は [MIGRATION.md](./MIGRATION.md) を参照。
|
|
57
|
+
|
|
58
|
+
#### 段階的削除スケジュール
|
|
59
|
+
|
|
60
|
+
| バージョン | リリース予定 | 旧 API(deprecated)の状態 |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| v0.3.0 | 2026-05 | ✅ 動作 + dev mode 警告 |
|
|
63
|
+
| v0.4.0 | 2026-07 | ⚠️ 動作 + production でも警告 |
|
|
64
|
+
| v0.5.0 | 2026-09 | 🚨 動作 + npm install 時警告 |
|
|
65
|
+
| v1.0.0 | 2026-11 | ❌ 完全削除 |
|
|
66
|
+
|
|
67
|
+
## 開発
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install
|
|
71
|
+
npm run storybook # Storybook を起動
|
|
72
|
+
npm run build:lib # ライブラリビルド
|
|
73
|
+
npm run check # 全品質ゲート
|
|
74
|
+
npm run test:compat # 後方互換テスト
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## ライセンス
|
|
78
|
+
|
|
79
|
+
UNLICENSED(社内利用)
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
@cakejp/design-system のリリース運用ルール。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🗓 基本方針
|
|
8
|
+
|
|
9
|
+
- **週 1 回・手動リリース** を原則とする
|
|
10
|
+
- 自動 publish は無効化済み(タグ push しても何も起きない)
|
|
11
|
+
- **金曜は publish しない**(万一トラブった時に対応できる人がいないため)
|
|
12
|
+
- 緊急パッチは個別に手動実行
|
|
13
|
+
|
|
14
|
+
### 標準スケジュール
|
|
15
|
+
|
|
16
|
+
| 曜日 | 内容 |
|
|
17
|
+
|---|---|
|
|
18
|
+
| 月〜木 | 開発・PR レビュー・main マージ |
|
|
19
|
+
| **金曜** | リリース確認・取りまとめ・version bump(コミットまで)<br>**publish はしない** |
|
|
20
|
+
| 土・日 | お休み |
|
|
21
|
+
| **月曜** | npm publish 実行 → 利用側で動作確認 |
|
|
22
|
+
| 火〜木 | 問題があれば patch リリース対応 |
|
|
23
|
+
|
|
24
|
+
### この運用にする理由
|
|
25
|
+
|
|
26
|
+
- **Read-Only Friday**: 金曜は本番 publish しない(業界慣習)
|
|
27
|
+
- 障害発生時に **対応できるエンジニアが翌営業日まで動ける** 状態でリリース
|
|
28
|
+
- 利用側 (cake-api/frontend 等) も **週初めから安心して install** できる
|
|
29
|
+
- 金曜時点で「意味ある単位にまとまっているか」を確認できれば、月曜の publish はスムーズ
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 📦 リリース手順
|
|
34
|
+
|
|
35
|
+
### 金曜 (確認のみ・publish はしない)
|
|
36
|
+
|
|
37
|
+
1. main の差分を確認
|
|
38
|
+
2. CHANGELOG.md を整理(minor/patch 判断)
|
|
39
|
+
3. 必要なら version bump コミットだけ作る → main に push
|
|
40
|
+
4. **ここで publish はせず、月曜の作業に残す**
|
|
41
|
+
|
|
42
|
+
### 月曜 (publish 実行)
|
|
43
|
+
|
|
44
|
+
1. main 最新を pull
|
|
45
|
+
2. dry-run で事前確認
|
|
46
|
+
3. 本番 publish
|
|
47
|
+
4. cake-api/frontend で動作確認
|
|
48
|
+
5. Slack で告知
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### 詳細手順
|
|
53
|
+
|
|
54
|
+
### 1. リリース対象の取りまとめ
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# main にマージ済みの差分を確認
|
|
58
|
+
git log v$(npm view @cakejp/design-system version)..main --oneline
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
「意味ある単位」になっているか確認:
|
|
62
|
+
- 機能追加・破壊的変更が複数ある → minor bump (`0.3.0` → `0.4.0`)
|
|
63
|
+
- バグ修正のみ → patch bump (`0.3.0` → `0.3.1`)
|
|
64
|
+
- 互換性ある内部改善のみ → patch bump
|
|
65
|
+
|
|
66
|
+
### 2. version bump
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# patch リリース
|
|
70
|
+
npm version patch -m "chore(release): v%s"
|
|
71
|
+
|
|
72
|
+
# minor リリース
|
|
73
|
+
npm version minor -m "chore(release): v%s"
|
|
74
|
+
|
|
75
|
+
# major リリース(注意)
|
|
76
|
+
npm version major -m "chore(release): v%s"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`npm version` は package.json と package-lock.json を更新し、
|
|
80
|
+
コミット作成までやってくれる。タグ作成は workflow 側でやるので
|
|
81
|
+
`--no-git-tag-version` を付けたい場合は手動コミット。
|
|
82
|
+
|
|
83
|
+
### 3. CHANGELOG.md / MIGRATION.md 更新
|
|
84
|
+
|
|
85
|
+
破壊的変更・新機能・バグ修正の概要を CHANGELOG に追記。
|
|
86
|
+
|
|
87
|
+
### 4. main に push
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git push origin main
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 5. dry-run で事前検証
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
gh workflow run publish.yml -f dry_run=true
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
または GitHub UI で **Actions > Publish to npm > Run workflow** から実行。
|
|
100
|
+
失敗ログを確認し、問題なければ次へ。
|
|
101
|
+
|
|
102
|
+
### 6. 本番 publish
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
gh workflow run publish.yml -f dry_run=false -f tag_after_publish=true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
または GitHub UI で実行。
|
|
109
|
+
Workflow が npm publish + `v{version}` タグ作成を自動でやる。
|
|
110
|
+
|
|
111
|
+
### 7. リリース後の確認
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# npm に反映確認
|
|
115
|
+
npm view @cakejp/design-system@$(node -p "require('./package.json').version")
|
|
116
|
+
|
|
117
|
+
# 利用側で install 確認
|
|
118
|
+
cd ../cake-api/frontend
|
|
119
|
+
npm install @cakejp/design-system@latest
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🚨 緊急パッチ
|
|
125
|
+
|
|
126
|
+
平日でもセキュリティ脆弱性・本番障害対応のパッチは即時リリース可能:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# 1. fix ブランチ
|
|
130
|
+
git checkout -b fix/critical-issue main
|
|
131
|
+
# ... 修正
|
|
132
|
+
|
|
133
|
+
# 2. PR → 緊急マージ
|
|
134
|
+
gh pr create --base main --title "fix: critical security issue"
|
|
135
|
+
gh pr merge --squash
|
|
136
|
+
|
|
137
|
+
# 3. patch bump
|
|
138
|
+
git checkout main && git pull
|
|
139
|
+
npm version patch -m "chore(release): v%s (hotfix)"
|
|
140
|
+
git push origin main
|
|
141
|
+
|
|
142
|
+
# 4. publish
|
|
143
|
+
gh workflow run publish.yml -f dry_run=false
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 🎯 ブランチ運用
|
|
149
|
+
|
|
150
|
+
| 接頭辞 | 用途 | リリースに含める? |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `feat/...` | 機能追加 | minor bump |
|
|
153
|
+
| `fix/...` | バグ修正 | patch bump |
|
|
154
|
+
| `refactor/...` | 内部整理 | minor or patch |
|
|
155
|
+
| `docs/...` | ドキュメント | patch (またはスキップ) |
|
|
156
|
+
| `chore/...` | 雑務(依存更新等) | リリース対象外(マージはする) |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 🔒 publish 権限
|
|
161
|
+
|
|
162
|
+
publish 操作は **NPM_TOKEN を持つ GitHub Actions のみ** が実行可能。
|
|
163
|
+
ローカルから `npm publish` を直接叩く運用は禁止。
|
|
164
|
+
|
|
165
|
+
token 管理:
|
|
166
|
+
- npmjs.com で Access Token を発行
|
|
167
|
+
- リポジトリの Settings > Secrets and variables > Actions > `NPM_TOKEN`
|
|
168
|
+
- token は **少なくとも 1 年に 1 度** rotate
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 📋 リリース前チェックリスト
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
[ ] main 最新を pull
|
|
176
|
+
[ ] 全 CI 通過確認
|
|
177
|
+
[ ] npm run check で品質ゲート OK
|
|
178
|
+
[ ] CHANGELOG.md 更新
|
|
179
|
+
[ ] package.json version bump
|
|
180
|
+
[ ] dry_run で事前検証
|
|
181
|
+
[ ] publish 実行
|
|
182
|
+
[ ] npm view で反映確認
|
|
183
|
+
[ ] cake-api/frontend で動作確認
|
|
184
|
+
[ ] Slack #design-system チャンネルに告知
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ⚠️ よくある失敗パターン
|
|
190
|
+
|
|
191
|
+
| 失敗 | 原因 | 対策 |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| publish が走らない | NPM_TOKEN 未設定 / 期限切れ | secrets を再登録 |
|
|
194
|
+
| `npm version` が main 以外で走る | 別ブランチで実行 | main で実行する |
|
|
195
|
+
| dist が古い | build:lib スキップ | workflow が自動で実行するので問題なし |
|
|
196
|
+
| 同じバージョンを 2 回 publish | npm が拒否 | バージョンを bump し直す(1 度発行された version は永久に上書き不可) |
|
|
197
|
+
| `prepack` で本番ビルド失敗 | peer dep 不足 | npm ci で全部入る、ローカルで再現できないなら CI ログを確認 |
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🔗 関連ドキュメント
|
|
202
|
+
|
|
203
|
+
- [CHANGELOG.md](./CHANGELOG.md) — 過去のリリース履歴
|
|
204
|
+
- [MIGRATION.md](./MIGRATION.md) — バージョン間の移行ガイド
|
|
205
|
+
- [.github/workflows/publish.yml](./.github/workflows/publish.yml) — publish workflow 定義
|
package/bin/init.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @cakejp/design-system init
|
|
4
|
+
// Consumer プロジェクトに AI (Claude / Codex) 向けルールファイルを設置する。
|
|
5
|
+
// AI エージェントは node_modules 配下のファイルを自動で読まないため、
|
|
6
|
+
// プロジェクトルートに AGENTS.md / CLAUDE.md(node_modules 内の DS ルールを
|
|
7
|
+
// 参照する薄いポインタ)を置く必要がある。
|
|
8
|
+
//
|
|
9
|
+
// Usage:
|
|
10
|
+
// npx cakejp-ds init # AGENTS.md + CLAUDE.md を設置
|
|
11
|
+
// npx cakejp-ds init --force # 既存ファイルを上書き
|
|
12
|
+
// npx cakejp-ds postinstall # npm postinstall から呼ばれる silent モード
|
|
13
|
+
|
|
14
|
+
import { copyFileSync, existsSync } from "node:fs"
|
|
15
|
+
import { dirname, join, resolve } from "node:path"
|
|
16
|
+
import { fileURLToPath } from "node:url"
|
|
17
|
+
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
19
|
+
const pkgRoot = resolve(__dirname, "..")
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
const cmd = args[0] || "init"
|
|
23
|
+
const force = args.includes("--force")
|
|
24
|
+
|
|
25
|
+
if (cmd === "help" || cmd === "--help" || cmd === "-h") {
|
|
26
|
+
console.log(`@cakejp/design-system CLI
|
|
27
|
+
|
|
28
|
+
使い方:
|
|
29
|
+
npx cakejp-ds init AI ルールファイルを設置
|
|
30
|
+
npx cakejp-ds init --force 既存ファイルを上書き
|
|
31
|
+
npx cakejp-ds codemod v0.2-to-v0.3 [DIR] 旧 API を新 API に自動移行
|
|
32
|
+
npx cakejp-ds check-migration [DIR] 旧 API 利用箇所を検出
|
|
33
|
+
`)
|
|
34
|
+
process.exit(0)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// codemod / check-migration は別 script に委譲
|
|
38
|
+
if (cmd === "codemod") {
|
|
39
|
+
const subcmd = args[1]
|
|
40
|
+
if (subcmd !== "v0.2-to-v0.3") {
|
|
41
|
+
console.error(`未知の codemod: ${subcmd}`)
|
|
42
|
+
console.error(`使えるもの: v0.2-to-v0.3`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
await import(join(pkgRoot, "scripts/codemod/v0.2-to-v0.3.mjs"))
|
|
46
|
+
process.exit(0)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (cmd === "check-migration") {
|
|
50
|
+
// process.argv の調整(codemod スクリプト側は process.argv[2] を見る)
|
|
51
|
+
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)]
|
|
52
|
+
await import(join(pkgRoot, "scripts/codemod/check-migration.mjs"))
|
|
53
|
+
process.exit(0)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (cmd !== "init" && cmd !== "postinstall") {
|
|
57
|
+
console.error(`未知のコマンド: ${cmd}`)
|
|
58
|
+
console.error(`npx cakejp-ds help を参照してください`)
|
|
59
|
+
process.exit(1)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ─── postinstall モードのガード ─────────────────────────────
|
|
63
|
+
// INIT_CWD は npm install が実行されたディレクトリ(consumer のルート)。
|
|
64
|
+
// 未設定、または pkgRoot と同じ場合は DS 自身のインストールコンテキストなのでスキップ。
|
|
65
|
+
const isPostinstall = cmd === "postinstall"
|
|
66
|
+
const consumerRoot = process.env.INIT_CWD || process.cwd()
|
|
67
|
+
|
|
68
|
+
if (isPostinstall) {
|
|
69
|
+
// DS 自身を開発している場合(INIT_CWD が pkgRoot)はスキップ
|
|
70
|
+
if (!process.env.INIT_CWD || resolve(consumerRoot) === pkgRoot) {
|
|
71
|
+
process.exit(0)
|
|
72
|
+
}
|
|
73
|
+
// consumer のルートに package.json が無ければスキップ(安全のため)
|
|
74
|
+
if (!existsSync(join(consumerRoot, "package.json"))) {
|
|
75
|
+
process.exit(0)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const files = [
|
|
80
|
+
{ src: "templates/AGENTS.md", dest: "AGENTS.md", label: "Codex 用" },
|
|
81
|
+
{ src: "templates/CLAUDE.md", dest: "CLAUDE.md", label: "Claude Code 用" },
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
if (!isPostinstall) {
|
|
85
|
+
console.log("@cakejp/design-system init")
|
|
86
|
+
console.log("AI (Claude / Codex) 向けルールファイルを設置します。\n")
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let created = 0
|
|
90
|
+
let skipped = 0
|
|
91
|
+
|
|
92
|
+
for (const { src, dest, label } of files) {
|
|
93
|
+
const srcPath = join(pkgRoot, src)
|
|
94
|
+
const destPath = join(consumerRoot, dest)
|
|
95
|
+
|
|
96
|
+
if (!existsSync(srcPath)) {
|
|
97
|
+
if (!isPostinstall) {
|
|
98
|
+
console.error(` ✗ テンプレートが見つかりません: ${srcPath}`)
|
|
99
|
+
}
|
|
100
|
+
process.exit(isPostinstall ? 0 : 1)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (existsSync(destPath) && !force) {
|
|
104
|
+
if (!isPostinstall) {
|
|
105
|
+
console.log(` ⏭ ${dest} は既に存在するためスキップ(--force で上書き)`)
|
|
106
|
+
}
|
|
107
|
+
skipped++
|
|
108
|
+
continue
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
copyFileSync(srcPath, destPath)
|
|
112
|
+
if (isPostinstall) {
|
|
113
|
+
console.log(`[@cakejp/design-system] ${dest} をプロジェクトルートに設置しました`)
|
|
114
|
+
} else {
|
|
115
|
+
console.log(` ✓ ${dest} を設置しました(${label})`)
|
|
116
|
+
}
|
|
117
|
+
created++
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (isPostinstall) {
|
|
121
|
+
// 何も作成しなかった場合は沈黙
|
|
122
|
+
process.exit(0)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
console.log(`\n完了: ${created} 作成 / ${skipped} スキップ`)
|
|
126
|
+
|
|
127
|
+
if (created > 0) {
|
|
128
|
+
console.log(`
|
|
129
|
+
次のステップ:
|
|
130
|
+
1. AI (Claude Code / Codex) を再起動してルールを読み込ませる
|
|
131
|
+
2. UI を作る前に必ず node_modules/@cakejp/design-system/{AGENTS.md,CLAUDE.md,contracts/*,tokens.json} を AI に読ませる
|
|
132
|
+
3. スクラッチコード(ハードコードカラー・余白・角丸等)を書かない運用を徹底する
|
|
133
|
+
`)
|
|
134
|
+
}
|