@cakejp/design-system 0.6.0 → 0.7.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.
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ /**
4
+ * 丸いアイコンバッジ。アイコンを淡いアクセント背景の円で囲む装飾要素。
5
+ * Card の見出しやリスト項目の先頭に置く「丸アイコン」をDS部品化したもの。
6
+ *
7
+ * 設計上の約束:
8
+ * - **外側 margin を持たない。** 縦間隔は親(Card の `flex-col gap-4`=16px 等)に委ねる。
9
+ * バッジ側に `mt-/mb-` を内蔵すると Card の gap と二重がけになり間延びするため。
10
+ * - アイコン色は `currentColor`(= `--Object-Accent-Primary`)を継承する。
11
+ * 中の Lucide / iconsax アイコンに `color` を渡す必要はない。
12
+ * - 内部 SVG のサイズはバッジが固定する(md=20px / lg=38px)。アイコン側の `size` は不要。
13
+ */
14
+ declare const iconBadgeVariants: (props?: {
15
+ size?: "lg" | "md";
16
+ } & import("class-variance-authority/types").ClassProp) => string;
17
+ declare function IconBadge({ className, size, ...props }: React.ComponentProps<"div"> & VariantProps<typeof iconBadgeVariants>): import("react/jsx-runtime").JSX.Element;
18
+ export { IconBadge, iconBadgeVariants };
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ /**
4
+ * Container — ページ最大幅と左右余白の唯一の担い手。
5
+ *
6
+ * 中央寄せ(`mx-auto`)+ max-width + 左右 gutter だけを持つ薄いレイアウト primitive。
7
+ *
8
+ * 設計上の約束:
9
+ * - **左右 padding は Container だけが持つ。** これを使うコンポーネント/親(Section 等)は
10
+ * 自身で左右 padding を持たない。両方が持つと「左右余白の二重がけ」になる(実バグ)。
11
+ * - 縦余白・背景色は持たない(それは Section の責務)。
12
+ */
13
+ declare const containerVariants: (props?: {
14
+ size?: "page" | "narrow" | "wide" | "fluid";
15
+ gutter?: "none" | "default" | "tight";
16
+ } & import("class-variance-authority/types").ClassProp) => string;
17
+ declare function Container({ className, size, gutter, ...props }: React.ComponentProps<"div"> & VariantProps<typeof containerVariants>): import("react/jsx-runtime").JSX.Element;
18
+ export { Container, containerVariants };
@@ -25,6 +25,13 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
25
25
  size?: SectionHeaderSize;
26
26
  /** 見出しのHTML要素を上書き(デフォルトは size に応じて h1〜h6 を自動選択) */
27
27
  as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span";
28
+ /**
29
+ * 配置。`start`(既定)はタイトル+もっと見るの左寄せリスト見出し。
30
+ * `center` はランディング/ガイド系の中央寄せ大見出し(eyebrow + title + subtitle を中央寄せ)。
31
+ */
32
+ align?: "start" | "center";
33
+ /** タイトルの上に置くスロット(Badge 等の eyebrow ラベル)。中央寄せ見出しで特に有用。 */
34
+ eyebrow?: React.ReactNode;
28
35
  }
29
36
  /**
30
37
  * セクションヘッダーコンポーネント
@@ -46,6 +53,7 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
46
53
  * - `as` で見出しレベルを上書き可能(同一ページに h1 が複数必要な場合など)
47
54
  * - `moreHref` 指定時はタイトル+サブタイトル全体がリンクになる(クリック領域拡大)
48
55
  * - `action` に任意の ReactNode(Button 等)を渡して右側にアクションを配置可能
56
+ * - `align="center"` でランディング/ガイド系の中央寄せ大見出しに切替(`eyebrow` に Badge 等を載せられる)
49
57
  */
50
- declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, as, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
58
+ declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, as, align, eyebrow, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
51
59
  export { SectionHeader };
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ /**
4
+ * Section — 全幅の縦リズム+(任意で)背景色付きの帯。
5
+ *
6
+ * 設計上の約束:
7
+ * - **左右 padding を持たない。** 左右余白は中身の {@link Container} が唯一の担い手。
8
+ * 背景色は Section(全幅)が持ち、中央寄せは Container が持つ ── この分担により
9
+ * 「背景帯は画面端まで、コンテンツは中央寄せ」が二重がけなしで成立する。
10
+ * - 縦余白は SP/PC ペアで `--Space-Section-*` トークンを消費する(rem 直書きの撲滅)。
11
+ *
12
+ * 推奨パターン:
13
+ * ```tsx
14
+ * <Section spacing="lg" background="subtle">
15
+ * <Container>
16
+ * <SectionHeader align="center" title="…" />
17
+ * </Container>
18
+ * </Section>
19
+ * ```
20
+ */
21
+ declare const sectionVariants: (props?: {
22
+ spacing?: "sm" | "lg" | "xl" | "md";
23
+ background?: "none" | "accent-subtle" | "subtle";
24
+ } & import("class-variance-authority/types").ClassProp) => string;
25
+ declare function Section({ className, spacing, background, ...props }: React.ComponentProps<"section"> & VariantProps<typeof sectionVariants>): import("react/jsx-runtime").JSX.Element;
26
+ export { Section, sectionVariants };
@@ -22,6 +22,7 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
22
22
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/foundations/dropdown-menu";
23
23
  export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/foundations/form";
24
24
  export { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/foundations/hover-card";
25
+ export { IconBadge, iconBadgeVariants } from "./components/foundations/icon-badge";
25
26
  export { Input } from "./components/foundations/input";
26
27
  export { Label } from "./components/foundations/label";
27
28
  export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger } from "./components/foundations/menubar";
@@ -75,6 +76,8 @@ export { ProgressSteps } from "./components/primitives/progress-steps";
75
76
  export { QuantitySelector } from "./components/primitives/quantity-selector";
76
77
  export { SearchBar } from "./components/primitives/search-bar";
77
78
  export { SearchPanel } from "./components/primitives/search-panel";
79
+ export { Container, containerVariants } from "./components/primitives/container";
80
+ export { Section, sectionVariants } from "./components/primitives/section";
78
81
  export { SectionHeader } from "./components/primitives/section-header";
79
82
  export { ShareButtons } from "./components/primitives/share-buttons";
80
83
  export { SideNav } from "./components/primitives/side-nav";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakejp/design-system",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
6
6
  "license": "UNLICENSED",
@@ -35,10 +35,7 @@
35
35
  "CLAUDE.md",
36
36
  "CLAUDE_PRODUCTION.md",
37
37
  "MIGRATION.md",
38
- "PUBLISHING.md",
39
- "RELEASE.md",
40
38
  "bin",
41
- "component-registry.json",
42
39
  "contracts",
43
40
  "dist",
44
41
  "scripts/codemod",
@@ -80,6 +77,7 @@
80
77
  "build": "tsc -b && vite build",
81
78
  "build:lib": "vite build --config vite.config.lib.ts && tsc --project tsconfig.lib.json && tsc-alias --project tsconfig.lib.json",
82
79
  "prepack": "npm run build:lib",
80
+ "prepare": "npm run build:lib",
83
81
  "postinstall": "node ./bin/init.js postinstall",
84
82
  "lint": "eslint .",
85
83
  "preview": "vite preview",
@@ -89,7 +87,8 @@
89
87
  "lint:reuse": "bash scripts/check-story-reuse.sh",
90
88
  "lint:border": "node scripts/check-border-color.mjs",
91
89
  "generate:lint-rules": "node scripts/generate-lint-rules.mjs",
92
- "check": "tsc --noEmit && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs",
90
+ "generate:lookup": "node scripts/generate-component-lookup.mjs",
91
+ "check": "tsc --noEmit && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs && bash scripts/lint-scratch.sh --components && bash scripts/check-generated-drift.sh",
93
92
  "test": "vitest run --config vitest.config.ts"
94
93
  },
95
94
  "dependencies": {
@@ -18,6 +18,7 @@
18
18
  * - Semantic カラートークン(--Text-*, --Surface-*, --Border-* 等)
19
19
  * - ダークモード自動切替(.dark クラス)
20
20
  * - shadcn bridge トークン(--primary, --foreground 等)
21
+ * - spacing / セクション余白トークン
21
22
  * - シャドウ・角丸トークン
22
23
  *
23
24
  * タイポグラフィ(typo-*)は Tailwind v4 の @utility に依存するため、
@@ -33,6 +34,20 @@
33
34
 
34
35
  /* --- Bridge: Semantic → shadcn tokens --- */
35
36
  :root {
37
+ --spacing-1: 0.25rem; /* 4px - scale 1 */
38
+ --spacing-2: 0.5rem; /* 8px - scale 2 */
39
+ --spacing-3: 0.75rem; /* 12px - scale 3 */
40
+ --spacing-4: 1rem; /* 16px - scale 4 */
41
+ --spacing-5: 1.25rem; /* 20px - interpolated */
42
+ --spacing-6: 1.5rem; /* 24px - scale 6 */
43
+
44
+ --Space-Section-xs: 2rem; /* 32px - セクション間ギャップSP / カード上下 */
45
+ --Space-Section-sm: 2.5rem; /* 40px - セクションpadding SP */
46
+ --Space-Section-md: 3rem; /* 48px - Final CTA 上 */
47
+ --Space-Section-lg: 3.5rem; /* 56px - セクションpadding PC */
48
+ --Space-Section-xl: 4rem; /* 64px - HERO上下 / Final CTA下SP */
49
+ --Space-Section-2xl: 5rem; /* 80px - Final CTA下PC */
50
+
36
51
  --radius: 0.625rem;
37
52
 
38
53
  --background: var(--Surface-Primary);
package/src/preset.css CHANGED
@@ -189,6 +189,15 @@
189
189
  --spacing-5: 1.25rem; /* 20px - interpolated */
190
190
  --spacing-6: 1.5rem; /* 24px - scale 6 */
191
191
 
192
+ /* Section 余白 tier(セクション縦リズム・8の倍数。spacing.scale の 24px 上限を超える領域)
193
+ 用途別の意味的トークン。Section プリミティブと、生CSS/HTML モックの rem 直書き置換に使う。 */
194
+ --Space-Section-xs: 2rem; /* 32px - セクション間ギャップSP / カード上下 */
195
+ --Space-Section-sm: 2.5rem; /* 40px - セクションpadding SP */
196
+ --Space-Section-md: 3rem; /* 48px - Final CTA 上 */
197
+ --Space-Section-lg: 3.5rem; /* 56px - セクションpadding PC */
198
+ --Space-Section-xl: 4rem; /* 64px - HERO上下 / Final CTA下SP */
199
+ --Space-Section-2xl: 5rem; /* 80px - Final CTA下PC */
200
+
192
201
  --radius: 0.625rem;
193
202
 
194
203
  --background: var(--Surface-Primary);
package/tokens.json CHANGED
@@ -96,6 +96,15 @@
96
96
  "3": { "px": 12, "usage": "セクション内要素間" },
97
97
  "4": { "px": 16, "usage": "セクション間" },
98
98
  "6": { "px": 24, "usage": "ダイアログ内パディング" }
99
+ },
100
+ "section": {
101
+ "comment": "セクション縦リズム tier(8の倍数)。preset.css の --Space-Section-* に対応。Section プリミティブが SP/PC ペアで消費する。scale(最大24px) を超える領域専用",
102
+ "xs": { "px": 32, "var": "--Space-Section-xs", "usage": "セクション間ギャップSP / カード上下" },
103
+ "sm": { "px": 40, "var": "--Space-Section-sm", "usage": "セクションpadding SP" },
104
+ "md": { "px": 48, "var": "--Space-Section-md", "usage": "Final CTA 上" },
105
+ "lg": { "px": 56, "var": "--Space-Section-lg", "usage": "セクションpadding PC" },
106
+ "xl": { "px": 64, "var": "--Space-Section-xl", "usage": "HERO上下 / Final CTA下SP" },
107
+ "2xl": { "px": 80, "var": "--Space-Section-2xl", "usage": "Final CTA下PC" }
99
108
  }
100
109
  },
101
110
 
@@ -113,15 +122,21 @@
113
122
  "md": "calc(var(--radius) - 2px)",
114
123
  "lg": "var(--radius)",
115
124
  "xl": "calc(var(--radius) + 4px)",
116
- "base": "0.625rem"
125
+ "2xl": "calc(var(--radius) + 8px)",
126
+ "3xl": "calc(var(--radius) + 12px)",
127
+ "4xl": "calc(var(--radius) + 16px)",
128
+ "base": "0.625rem",
129
+ "_comment": "--radius=10px 基準。px換算: sm=6 md=8 lg=10 xl=14 2xl=18 3xl=22 4xl=26。利用可は xs(2,Tailwind既定)〜2xl + full。3xl/4xl は定義のみで利用禁止(rules.json AI7)"
117
130
  },
118
131
 
119
132
  "shadow": {
120
- "md": "0 2px 6px 0 rgba(0,0,0,0.08)",
121
- "lg": "0 4px 12px 0 rgba(0,0,0,0.12)",
122
- "menu": "0 4px 16px 0 rgba(0,0,0,0.12)",
123
- "tooltip": "0 2px 8px 0 rgba(0,0,0,0.16)",
124
- "dialog": "0 8px 24px 0 rgba(0,0,0,0.16)",
125
- "modal": "0 16px 48px 0 rgba(0,0,0,0.24)"
133
+ "md": "0px 7px 7px 0px rgba(0, 0, 0, 0.07), 0px 2px 16px 0px rgba(0, 0, 0, 0.12)",
134
+ "lg": "0px 12px 32px -4px rgba(24, 39, 75, 0.12), 0px 8px 16px -6px rgba(24, 39, 75, 0.12), 0px 1px 4px 1px rgba(0, 0, 0, 0.2)",
135
+ "menu": "var(--shadow-md)",
136
+ "tooltip": "0px 8px 8px -4px rgba(24, 39, 75, 0.08), 0px 4px 6px -4px rgba(24, 39, 75, 0.12)",
137
+ "dialog": "var(--shadow-lg)",
138
+ "modal": "var(--shadow-lg)",
139
+ "overlay": "0 24px 80px rgba(24, 39, 75, 0.16)",
140
+ "_comment": "preset.css の --shadow-* と同期(正)。md/lg は Tailwind 既定を DS 値に再定義済み。xl/2xl は使用禁止(rules.json R53)"
126
141
  }
127
142
  }
package/PUBLISHING.md DELETED
@@ -1,106 +0,0 @@
1
- # 公開とタグ付け(人向けクイックガイド)
2
-
3
- @cakejp/design-system を npm に公開する方法と、Git タグの仕組みについて。
4
-
5
- 詳しい運用ルール(曜日・週次フロー等)は [`RELEASE.md`](./RELEASE.md) を参照。
6
-
7
- ---
8
-
9
- ## 結論 — やること
10
-
11
- 1. **main に変更をマージ**(PR 経由)
12
- 2. **`package.json` の `version` を上げる**(例: `0.3.3` → `0.3.4`)
13
- 3. **`gh workflow run publish.yml -f dry_run=false`** を実行
14
- → 自動で npm publish + Git タグ作成(`v0.3.4`)まで一気にやる
15
-
16
- タグは **手動で打たない**。Action が自動で作る。
17
-
18
- ---
19
-
20
- ## アクション(GitHub Actions)の実行方法
21
-
22
- ### A. GitHub の Web UI からポチる
23
-
24
- 1. https://github.com/flashpark/cake-design-system にアクセス
25
- 2. 上の「**Actions**」タブをクリック
26
- 3. 左サイドバーの「**Publish to npm**」を選択
27
- 4. 右上の「**Run workflow**」ボタン
28
- 5. ダイアログで `Branch: main` のまま、`Dry run` のチェックは外す
29
- 6. 緑の「**Run workflow**」を押す
30
-
31
- ### B. ターミナルから一発
32
-
33
- ```bash
34
- # 念のため事前確認(npm publish --dry-run のみ実行、本番に影響なし)
35
- gh workflow run publish.yml -f dry_run=true
36
-
37
- # 本番 publish + タグ作成
38
- gh workflow run publish.yml -f dry_run=false
39
- ```
40
-
41
- ---
42
-
43
- ## タグ付けはどうなってる?
44
-
45
- ### 自動
46
-
47
- `gh workflow run publish.yml` 実行時に **デフォルトで Git タグ `v{version}` が自動作成・push** される。
48
-
49
- - `package.json` の `version: 0.3.4` で実行 → `v0.3.4` タグが main にぶら下がる
50
- - 既にタグ存在する場合は skip(重複エラーにならない)
51
-
52
- ### 手動で打ちたいケース
53
-
54
- 通常は不要。やるなら:
55
-
56
- ```bash
57
- git tag v0.3.4
58
- git push origin v0.3.4
59
- ```
60
-
61
- ### タグを作らずに publish したい
62
-
63
- `tag_after_publish: false` を指定:
64
-
65
- ```bash
66
- gh workflow run publish.yml -f dry_run=false -f tag_after_publish=false
67
- ```
68
-
69
- ---
70
-
71
- ## 何が公開されたか確認
72
-
73
- ```bash
74
- # npm に反映されたか
75
- npm view @cakejp/design-system version
76
- # → 例: 0.3.4
77
-
78
- # 全 version 一覧
79
- npm view @cakejp/design-system versions
80
-
81
- # タグ一覧
82
- git fetch --tags origin
83
- git tag --list | sort -V
84
- ```
85
-
86
- 公開直後は npm のキャッシュ反映に **30〜90 秒**かかる。
87
-
88
- ---
89
-
90
- ## トラブルシュート
91
-
92
- | 症状 | 確認 |
93
- |------|------|
94
- | Action 実行できない | Settings > Actions > Workflow permissions が `Read and write` か |
95
- | publish が失敗する | NPM_TOKEN が有効期限切れの可能性 |
96
- | タグが作られない | Workflow ログで「Create release tag」step を確認 |
97
- | 「金曜にやるな」と怒られる | [`RELEASE.md`](./RELEASE.md) の Read-Only Friday ルール参照 |
98
-
99
- ---
100
-
101
- ## 関連ドキュメント
102
-
103
- - [`RELEASE.md`](./RELEASE.md) — 詳細運用ルール(曜日・チェックリスト・緊急 hotfix 等)
104
- - [`CHANGELOG.md`](./CHANGELOG.md) — 各バージョンの変更履歴
105
- - [`MIGRATION.md`](./MIGRATION.md) — メジャーバージョンの移行手順
106
- - [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) — Workflow 定義
package/RELEASE.md DELETED
@@ -1,205 +0,0 @@
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 定義