ksk-design-system 1.35.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 +190 -0
- package/CLAUDE.md +189 -0
- package/DESIGN.md +190 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +107 -0
- package/PUBLISHING.md +160 -0
- package/README.md +59 -0
- package/RELEASE.md +82 -0
- package/bin/init.js +112 -0
- package/contracts/components.json +1443 -0
- package/contracts/rules.json +447 -0
- package/dist/class-names.js +4 -0
- package/dist/index.js +13157 -0
- package/dist/native/ui.js +4928 -0
- package/dist/native.js +1559 -0
- package/dist/server-variants-Dr_V3bDI.js +55 -0
- package/dist/types/class-names.d.ts +27 -0
- package/dist/types/components/patterns/admin/bulk-actions.d.ts +17 -0
- package/dist/types/components/patterns/admin/chart-controls.d.ts +16 -0
- package/dist/types/components/patterns/admin/data-table.d.ts +165 -0
- package/dist/types/components/patterns/admin/image-uploader.d.ts +14 -0
- package/dist/types/components/patterns/admin/kebab-menu.d.ts +17 -0
- package/dist/types/components/patterns/admin/notification-list.d.ts +16 -0
- package/dist/types/components/patterns/admin/search-panel.d.ts +9 -0
- package/dist/types/components/patterns/admin/status-tabs.d.ts +13 -0
- package/dist/types/components/patterns/app-header.d.ts +76 -0
- package/dist/types/components/patterns/banner-carousel.d.ts +25 -0
- package/dist/types/components/patterns/banner.d.ts +13 -0
- package/dist/types/components/patterns/bottom-sheet-form.d.ts +17 -0
- package/dist/types/components/patterns/category-nav.d.ts +43 -0
- package/dist/types/components/patterns/category-scroll.d.ts +53 -0
- package/dist/types/components/patterns/chip-selector.d.ts +20 -0
- package/dist/types/components/patterns/chip.d.ts +42 -0
- package/dist/types/components/patterns/coach-mark-overlay.d.ts +66 -0
- package/dist/types/components/patterns/commerce/bottom-tab-bar.d.ts +27 -0
- package/dist/types/components/patterns/commerce/filter-bar.d.ts +39 -0
- package/dist/types/components/patterns/commerce/image-carousel.d.ts +14 -0
- package/dist/types/components/patterns/commerce/order-summary.d.ts +26 -0
- package/dist/types/components/patterns/commerce/price-display.d.ts +20 -0
- package/dist/types/components/patterns/commerce/product-card.d.ts +50 -0
- package/dist/types/components/patterns/commerce/product-carousel.d.ts +15 -0
- package/dist/types/components/patterns/commerce/quantity-selector.d.ts +21 -0
- package/dist/types/components/patterns/commerce/rating-display.d.ts +15 -0
- package/dist/types/components/patterns/commerce/review-card.d.ts +22 -0
- package/dist/types/components/patterns/commerce/review-summary.d.ts +12 -0
- package/dist/types/components/patterns/confirm-dialog.d.ts +32 -0
- package/dist/types/components/patterns/cookie-consent.d.ts +62 -0
- package/dist/types/components/patterns/empty-state.d.ts +15 -0
- package/dist/types/components/patterns/error-state.d.ts +10 -0
- package/dist/types/components/patterns/file-upload.d.ts +31 -0
- package/dist/types/components/patterns/filter-chip.d.ts +26 -0
- package/dist/types/components/patterns/footer.d.ts +24 -0
- package/dist/types/components/patterns/form-field.d.ts +30 -0
- package/dist/types/components/patterns/form.d.ts +13 -0
- package/dist/types/components/patterns/list-item.d.ts +23 -0
- package/dist/types/components/patterns/list-skeletons.d.ts +43 -0
- package/dist/types/components/patterns/menu-drawer.d.ts +27 -0
- package/dist/types/components/patterns/notification-badge.d.ts +15 -0
- package/dist/types/components/patterns/progress-steps.d.ts +7 -0
- package/dist/types/components/patterns/review-overlay.d.ts +25 -0
- package/dist/types/components/patterns/search-bar.d.ts +6 -0
- package/dist/types/components/patterns/section-header.d.ts +8 -0
- package/dist/types/components/patterns/share-buttons.d.ts +13 -0
- package/dist/types/components/patterns/shells/admin-shell.d.ts +8 -0
- package/dist/types/components/patterns/shells/app-shell.d.ts +7 -0
- package/dist/types/components/patterns/shells/marketing-shell.d.ts +7 -0
- package/dist/types/components/patterns/simple-pagination.d.ts +69 -0
- package/dist/types/components/patterns/stat-card.d.ts +43 -0
- package/dist/types/components/patterns/sticky-action-bar.d.ts +27 -0
- package/dist/types/components/patterns/swipe-row.d.ts +17 -0
- package/dist/types/components/patterns/tag-input.d.ts +20 -0
- package/dist/types/components/patterns/tag.d.ts +7 -0
- package/dist/types/components/ui/accordion.d.ts +7 -0
- package/dist/types/components/ui/alert-dialog.d.ts +47 -0
- package/dist/types/components/ui/alert.d.ts +45 -0
- package/dist/types/components/ui/auto-grow-textarea.d.ts +40 -0
- package/dist/types/components/ui/avatar.d.ts +6 -0
- package/dist/types/components/ui/badge.d.ts +18 -0
- package/dist/types/components/ui/breadcrumb.d.ts +16 -0
- package/dist/types/components/ui/button.d.ts +29 -0
- package/dist/types/components/ui/calendar.d.ts +5 -0
- package/dist/types/components/ui/card.d.ts +28 -0
- package/dist/types/components/ui/checkbox-card.d.ts +29 -0
- package/dist/types/components/ui/checkbox-field.d.ts +24 -0
- package/dist/types/components/ui/checkbox-group.d.ts +33 -0
- package/dist/types/components/ui/checkbox.d.ts +44 -0
- package/dist/types/components/ui/coach-mark.d.ts +27 -0
- package/dist/types/components/ui/collapsible.d.ts +24 -0
- package/dist/types/components/ui/combobox.d.ts +19 -0
- package/dist/types/components/ui/countdown-timer.d.ts +39 -0
- package/dist/types/components/ui/date-picker.d.ts +53 -0
- package/dist/types/components/ui/dialog.d.ts +54 -0
- package/dist/types/components/ui/dropdown-filter.d.ts +35 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +42 -0
- package/dist/types/components/ui/error-boundary.d.ts +66 -0
- package/dist/types/components/ui/form.d.ts +61 -0
- package/dist/types/components/ui/hover-card.d.ts +24 -0
- package/dist/types/components/ui/image-gallery.d.ts +28 -0
- package/dist/types/components/ui/input.d.ts +17 -0
- package/dist/types/components/ui/label.d.ts +4 -0
- package/dist/types/components/ui/multi-select.d.ts +21 -0
- package/dist/types/components/ui/navigation-bar.d.ts +58 -0
- package/dist/types/components/ui/number-input.d.ts +20 -0
- package/dist/types/components/ui/pagination.d.ts +26 -0
- package/dist/types/components/ui/pill-toggle.d.ts +16 -0
- package/dist/types/components/ui/popover.d.ts +7 -0
- package/dist/types/components/ui/progress-ring.d.ts +31 -0
- package/dist/types/components/ui/progress.d.ts +34 -0
- package/dist/types/components/ui/radio-group.d.ts +22 -0
- package/dist/types/components/ui/responsive-dialog.d.ts +31 -0
- package/dist/types/components/ui/scroll-area.d.ts +5 -0
- package/dist/types/components/ui/select.d.ts +22 -0
- package/dist/types/components/ui/separator.d.ts +4 -0
- package/dist/types/components/ui/sheet.d.ts +139 -0
- package/dist/types/components/ui/skeleton.d.ts +31 -0
- package/dist/types/components/ui/slider.d.ts +14 -0
- package/dist/types/components/ui/social-icon-data.d.ts +10 -0
- package/dist/types/components/ui/social-icon.d.ts +38 -0
- package/dist/types/components/ui/social-login-button.d.ts +10 -0
- package/dist/types/components/ui/spinner.d.ts +22 -0
- package/dist/types/components/ui/star-rating.d.ts +12 -0
- package/dist/types/components/ui/sub-nav.d.ts +17 -0
- package/dist/types/components/ui/switch.d.ts +4 -0
- package/dist/types/components/ui/sync-status-badge.d.ts +17 -0
- package/dist/types/components/ui/tabs.d.ts +15 -0
- package/dist/types/components/ui/textarea.d.ts +8 -0
- package/dist/types/components/ui/time-picker.d.ts +14 -0
- package/dist/types/components/ui/toast.d.ts +49 -0
- package/dist/types/components/ui/tooltip.d.ts +7 -0
- package/dist/types/index.d.ts +174 -0
- package/dist/types/lib/server-variants/button-variants.d.ts +20 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/native/components/Accordion.d.ts +12 -0
- package/dist/types/native/components/Alert.d.ts +9 -0
- package/dist/types/native/components/AlertDialog.d.ts +11 -0
- package/dist/types/native/components/AppHeader.d.ts +10 -0
- package/dist/types/native/components/AppShell.d.ts +13 -0
- package/dist/types/native/components/AutoGrowTextarea.d.ts +8 -0
- package/dist/types/native/components/Avatar.d.ts +8 -0
- package/dist/types/native/components/Badge.d.ts +8 -0
- package/dist/types/native/components/Banner.d.ts +10 -0
- package/dist/types/native/components/BannerCarousel.d.ts +8 -0
- package/dist/types/native/components/BottomSheetForm.d.ts +10 -0
- package/dist/types/native/components/BottomTabBar.d.ts +8 -0
- package/dist/types/native/components/Breadcrumb.d.ts +12 -0
- package/dist/types/native/components/Button.d.ts +9 -0
- package/dist/types/native/components/Calendar.d.ts +8 -0
- package/dist/types/native/components/Card.d.ts +11 -0
- package/dist/types/native/components/CategoryNav.d.ts +13 -0
- package/dist/types/native/components/CategoryScroll.d.ts +12 -0
- package/dist/types/native/components/Checkbox.d.ts +7 -0
- package/dist/types/native/components/CheckboxCard.d.ts +8 -0
- package/dist/types/native/components/CheckboxField.d.ts +8 -0
- package/dist/types/native/components/CheckboxGroup.d.ts +12 -0
- package/dist/types/native/components/Chip.d.ts +17 -0
- package/dist/types/native/components/ChipSelector.d.ts +13 -0
- package/dist/types/native/components/CoachMark.d.ts +12 -0
- package/dist/types/native/components/CoachMarkOverlay.d.ts +19 -0
- package/dist/types/native/components/Collapsible.d.ts +7 -0
- package/dist/types/native/components/Combobox.d.ts +14 -0
- package/dist/types/native/components/ConfirmDialog.d.ts +7 -0
- package/dist/types/native/components/CountdownTimer.d.ts +7 -0
- package/dist/types/native/components/DatePicker.d.ts +10 -0
- package/dist/types/native/components/Dialog.d.ts +12 -0
- package/dist/types/native/components/DropdownFilter.d.ts +12 -0
- package/dist/types/native/components/DropdownMenu.d.ts +19 -0
- package/dist/types/native/components/EmptyState.d.ts +8 -0
- package/dist/types/native/components/ErrorState.d.ts +8 -0
- package/dist/types/native/components/FileUpload.d.ts +12 -0
- package/dist/types/native/components/FilterBar.d.ts +13 -0
- package/dist/types/native/components/FilterChip.d.ts +7 -0
- package/dist/types/native/components/Footer.d.ts +9 -0
- package/dist/types/native/components/FormField.d.ts +9 -0
- package/dist/types/native/components/GlassView.d.ts +25 -0
- package/dist/types/native/components/ImageCarousel.d.ts +8 -0
- package/dist/types/native/components/ImageGallery.d.ts +7 -0
- package/dist/types/native/components/Input.d.ts +9 -0
- package/dist/types/native/components/Label.d.ts +7 -0
- package/dist/types/native/components/ListItem.d.ts +11 -0
- package/dist/types/native/components/ListSkeletons.d.ts +6 -0
- package/dist/types/native/components/MarketingShell.d.ts +9 -0
- package/dist/types/native/components/MenuDrawer.d.ts +21 -0
- package/dist/types/native/components/MultiSelect.d.ts +13 -0
- package/dist/types/native/components/NavigationBar.d.ts +18 -0
- package/dist/types/native/components/NotificationBadge.d.ts +9 -0
- package/dist/types/native/components/NumberInput.d.ts +9 -0
- package/dist/types/native/components/OrderSummary.d.ts +10 -0
- package/dist/types/native/components/Pagination.d.ts +7 -0
- package/dist/types/native/components/PillToggle.d.ts +12 -0
- package/dist/types/native/components/Popover.d.ts +14 -0
- package/dist/types/native/components/PriceDisplay.d.ts +8 -0
- package/dist/types/native/components/ProductCard.d.ts +14 -0
- package/dist/types/native/components/ProductCarousel.d.ts +11 -0
- package/dist/types/native/components/Progress.d.ts +7 -0
- package/dist/types/native/components/ProgressRing.d.ts +12 -0
- package/dist/types/native/components/ProgressSteps.d.ts +9 -0
- package/dist/types/native/components/QuantitySelector.d.ts +6 -0
- package/dist/types/native/components/RadioGroup.d.ts +13 -0
- package/dist/types/native/components/RatingDisplay.d.ts +7 -0
- package/dist/types/native/components/ResponsiveDialog.d.ts +7 -0
- package/dist/types/native/components/ReviewCard.d.ts +11 -0
- package/dist/types/native/components/ReviewOverlay.d.ts +7 -0
- package/dist/types/native/components/ReviewSummary.d.ts +7 -0
- package/dist/types/native/components/ScrollArea.d.ts +9 -0
- package/dist/types/native/components/SearchBar.d.ts +9 -0
- package/dist/types/native/components/SectionHeader.d.ts +10 -0
- package/dist/types/native/components/Select.d.ts +14 -0
- package/dist/types/native/components/Separator.d.ts +5 -0
- package/dist/types/native/components/ShareButtons.d.ts +11 -0
- package/dist/types/native/components/Sheet.d.ts +20 -0
- package/dist/types/native/components/SimplePagination.d.ts +7 -0
- package/dist/types/native/components/Skeleton.d.ts +11 -0
- package/dist/types/native/components/Slider.d.ts +9 -0
- package/dist/types/native/components/SocialIcon.d.ts +12 -0
- package/dist/types/native/components/SocialLoginButton.d.ts +8 -0
- package/dist/types/native/components/Spinner.d.ts +6 -0
- package/dist/types/native/components/Stack.d.ts +13 -0
- package/dist/types/native/components/StarRating.d.ts +9 -0
- package/dist/types/native/components/StatCard.d.ts +7 -0
- package/dist/types/native/components/StickyActionBar.d.ts +6 -0
- package/dist/types/native/components/SubNav.d.ts +12 -0
- package/dist/types/native/components/SwipeRow.d.ts +14 -0
- package/dist/types/native/components/Switch.d.ts +4 -0
- package/dist/types/native/components/SyncStatusBadge.d.ts +6 -0
- package/dist/types/native/components/Tabs.d.ts +23 -0
- package/dist/types/native/components/Tag.d.ts +10 -0
- package/dist/types/native/components/TagInput.d.ts +7 -0
- package/dist/types/native/components/Text.d.ts +10 -0
- package/dist/types/native/components/Textarea.d.ts +7 -0
- package/dist/types/native/components/TimePicker.d.ts +12 -0
- package/dist/types/native/components/Toast.d.ts +18 -0
- package/dist/types/native/components/index.d.ts +99 -0
- package/dist/types/native/components/social-icon-data.d.ts +5 -0
- package/dist/types/native/index.d.ts +4 -0
- package/dist/types/native/theme/ThemeProvider.d.ts +21 -0
- package/dist/types/native/typography.d.ts +8 -0
- package/dist/types/tokens/native/index.d.ts +13 -0
- package/dist/types/tokens/native/primitives.d.ts +116 -0
- package/dist/types/tokens/native/scales.d.ts +270 -0
- package/dist/types/tokens/native/themes.d.ts +1147 -0
- package/eslint/deprecated.js +104 -0
- package/eslint/no-colorless-border.js +217 -0
- package/package.json +215 -0
- package/scripts/codemod/README.md +51 -0
- package/scripts/codemod/template.mjs +164 -0
- package/src/components/COMPONENT_LOOKUP.md +190 -0
- package/src/preset.css +168 -0
- package/src/styles/categorical.css +161 -0
- package/src/styles/glass.css +365 -0
- package/src/styles/primitive.css +161 -0
- package/src/styles/semantic.css +247 -0
- package/src/styles/typography.css +140 -0
- package/src/themes/README.md +44 -0
- package/src/themes/blue.css +21 -0
- package/src/themes/default.css +12 -0
- package/src/themes/green.css +22 -0
- package/src/themes/orange.css +21 -0
- package/src/themes/violet.css +22 -0
- package/templates/AGENTS.md +77 -0
- package/templates/CLAUDE.md +77 -0
- package/tokens.json +607 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint プラグイン: ksk-design-system 非推奨 API 検出
|
|
3
|
+
*
|
|
4
|
+
* 段階的廃止のために、特定の identifier / import パスを警告する。
|
|
5
|
+
* codemod (scripts/codemod/*.mjs) と組み合わせて使う:
|
|
6
|
+
* 1. 新版リリース時: ここに deprecated エントリを追加 → warning
|
|
7
|
+
* 2. 利用側に codemod を案内
|
|
8
|
+
* 3. 次のメジャー: severity を "error" に昇格
|
|
9
|
+
* 4. 完全削除: ここから削除
|
|
10
|
+
*
|
|
11
|
+
* 使い方 (利用側の eslint.config.js):
|
|
12
|
+
* import kskDeprecated from "ksk-design-system/eslint/deprecated"
|
|
13
|
+
* export default [
|
|
14
|
+
* {
|
|
15
|
+
* plugins: { "ksk-deprecated": kskDeprecated },
|
|
16
|
+
* rules: { "ksk-deprecated/no-deprecated": "warn" },
|
|
17
|
+
* },
|
|
18
|
+
* ]
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 非推奨エントリ:
|
|
23
|
+
* - identifier: そのままの名前で使われたら警告
|
|
24
|
+
* - kind: "import" だと from ksk-design-system からの import のみ警告
|
|
25
|
+
* - replacement: 置換先(codemod 名と一致させると親切)
|
|
26
|
+
* - removeIn: 削除予定バージョン
|
|
27
|
+
*
|
|
28
|
+
* 例:
|
|
29
|
+
* {
|
|
30
|
+
* identifier: "Banner",
|
|
31
|
+
* kind: "import",
|
|
32
|
+
* replacement: "Alert (variant=\"warning\")",
|
|
33
|
+
* removeIn: "2.0.0",
|
|
34
|
+
* },
|
|
35
|
+
*/
|
|
36
|
+
const DEPRECATED = [
|
|
37
|
+
// 現時点で deprecated エントリなし。
|
|
38
|
+
// 破壊変更時にここに追加し、codemod とセットでリリースする。
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
42
|
+
const noDeprecated = {
|
|
43
|
+
meta: {
|
|
44
|
+
type: "suggestion",
|
|
45
|
+
docs: {
|
|
46
|
+
description: "Warn on deprecated ksk-design-system APIs",
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
messages: {
|
|
50
|
+
deprecated:
|
|
51
|
+
"[ksk-ds] {{name}} は非推奨です。{{replacement}} を使ってください{{removeIn}}。",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
create(context) {
|
|
55
|
+
const importedDeprecated = new Map()
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
ImportDeclaration(node) {
|
|
59
|
+
if (node.source.value !== "ksk-design-system") return
|
|
60
|
+
for (const spec of node.specifiers) {
|
|
61
|
+
if (spec.type !== "ImportSpecifier") continue
|
|
62
|
+
const name = spec.imported.name
|
|
63
|
+
const entry = DEPRECATED.find((d) => d.identifier === name)
|
|
64
|
+
if (entry) {
|
|
65
|
+
importedDeprecated.set(spec.local.name, entry)
|
|
66
|
+
context.report({
|
|
67
|
+
node: spec,
|
|
68
|
+
messageId: "deprecated",
|
|
69
|
+
data: {
|
|
70
|
+
name: entry.identifier,
|
|
71
|
+
replacement: entry.replacement || "新 API",
|
|
72
|
+
removeIn: entry.removeIn ? ` (v${entry.removeIn} で削除予定)` : "",
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// identifier として使用された場合(kind === undefined のエントリのみ)
|
|
80
|
+
Identifier(node) {
|
|
81
|
+
const entry = DEPRECATED.find(
|
|
82
|
+
(d) => d.identifier === node.name && d.kind !== "import"
|
|
83
|
+
)
|
|
84
|
+
if (entry) {
|
|
85
|
+
context.report({
|
|
86
|
+
node,
|
|
87
|
+
messageId: "deprecated",
|
|
88
|
+
data: {
|
|
89
|
+
name: entry.identifier,
|
|
90
|
+
replacement: entry.replacement || "新 API",
|
|
91
|
+
removeIn: entry.removeIn ? ` (v${entry.removeIn} で削除予定)` : "",
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
rules: {
|
|
102
|
+
"no-deprecated": noDeprecated,
|
|
103
|
+
},
|
|
104
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint プラグイン: ksk-design-system 無色ボーダー検出 (P032)
|
|
3
|
+
*
|
|
4
|
+
* Tailwind v4 で border-color の既定が currentColor に変わったため、
|
|
5
|
+
* `border` / `border-b` 等を色なしで書くと要素の文字色が枠線に透けて出る
|
|
6
|
+
* (消費側が濃色テキストを敷くと枠線が黒ずむ)。preset.css の base layer に
|
|
7
|
+
* --border へのフォールバック保険は入れたが、コンポーネントは明示が原則。
|
|
8
|
+
* このルールはその dev/CI ガード。
|
|
9
|
+
*
|
|
10
|
+
* 肝: 1 要素に到達しうる className 文字列を「統合」してからクラス集合に分解し、
|
|
11
|
+
* 集合内に裸の border 幅トークンがあり、かつ border-color トークンが
|
|
12
|
+
* 一切無い要素のみ報告する。CVA は base + 全 variant 値、cn()/三項は
|
|
13
|
+
* 各引数・両枝をまとめて 1 集合とみなす。これにより
|
|
14
|
+
* - badge: base に `border`、別 variant に border-transparent / border-[var]
|
|
15
|
+
* - 入力系: open/closed 三項で border-[var] を供給
|
|
16
|
+
* のような「正当な無色 border」を誤検知しない。
|
|
17
|
+
*
|
|
18
|
+
* lint-scratch.sh は ui/patterns を検査対象外にしているため、こちらで補う。
|
|
19
|
+
*
|
|
20
|
+
* 使い方 (eslint.config.js):
|
|
21
|
+
* import kskNoColorlessBorder from "./eslint/no-colorless-border.js"
|
|
22
|
+
* plugins: { "ksk-border": kskNoColorlessBorder }
|
|
23
|
+
* rules: { "ksk-border/no-colorless-border": "warn" }
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// 裸の border 幅トークン(色を供給せず currentColor に依存する=問題の本体):
|
|
27
|
+
// border / border-t..y / border-[Npx] / border-b-[3px]
|
|
28
|
+
// マッチしない(=裸とみなさない): border-0|2|4|8(幅のみ・色は別管理に委ねる),
|
|
29
|
+
// border-[var(...)] 等の色, border-none|collapse|separate|solid|dashed|dotted,
|
|
30
|
+
// 状態接頭辞付き(file:border-0 等は別要素/別 state なので集合判定に乗せない)。
|
|
31
|
+
const NAKED_BORDER_WIDTH = /^border(-[tblrxy])?(-\[\d+(?:\.\d+)?px\])?$/
|
|
32
|
+
|
|
33
|
+
// border-color トークン(集合内に 1 つでもあれば報告しない):
|
|
34
|
+
// border-[var(...)] / border-[#hex] / border-[rgb(...)](px 幅 [Npx] は除外),
|
|
35
|
+
// border-transparent / border-current / border-white|black/inherit,
|
|
36
|
+
// 側指定付き(border-l-[var] / border-t-transparent),
|
|
37
|
+
// 状態接頭辞付き(hover:/focus*:/aria-*:/data-[...]:/group-*:/peer-*:/[&...]: 等),
|
|
38
|
+
// 不透明度サフィックス(border-[var(...)]/20 / border-white/10)。
|
|
39
|
+
const BORDER_COLOR =
|
|
40
|
+
/(^|:)border(-[tblrxy])?-(\[(?!\d+(?:\.\d+)?px\])[^\]]*\]|transparent|current|inherit|white|black)(\/\d+)?$/
|
|
41
|
+
|
|
42
|
+
// クラス結合ユーティリティ(この呼び出しの引数は className 断片とみなして再帰する)。
|
|
43
|
+
const CLASS_UTILS = new Set([
|
|
44
|
+
"cn",
|
|
45
|
+
"clsx",
|
|
46
|
+
"cx",
|
|
47
|
+
"cva",
|
|
48
|
+
"tv",
|
|
49
|
+
"twMerge",
|
|
50
|
+
"twJoin",
|
|
51
|
+
"classNames",
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
function calleeName(node) {
|
|
55
|
+
const c = node.callee
|
|
56
|
+
if (!c) return null
|
|
57
|
+
if (c.type === "Identifier") return c.name
|
|
58
|
+
if (c.type === "MemberExpression" && c.property?.type === "Identifier") {
|
|
59
|
+
return c.property.name
|
|
60
|
+
}
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** スコープを遡って識別子の定義(const x = <init>)の init 式を返す。 */
|
|
65
|
+
function variableInit(scope, name) {
|
|
66
|
+
let s = scope
|
|
67
|
+
while (s) {
|
|
68
|
+
const v = s.variables.find((vv) => vv.name === name)
|
|
69
|
+
if (v) {
|
|
70
|
+
for (const def of v.defs) {
|
|
71
|
+
if (def.node?.type === "VariableDeclarator" && def.node.init) {
|
|
72
|
+
return def.node.init
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null
|
|
76
|
+
}
|
|
77
|
+
s = s.upper
|
|
78
|
+
}
|
|
79
|
+
return null
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* AST 式を再帰的に辿り、到達しうる className 文字列断片を out へ集める。
|
|
84
|
+
* - 三項: test を無視し consequent / alternate の両枝を集める
|
|
85
|
+
* - && / || / ??: 両辺
|
|
86
|
+
* - cn()/cva() 等: 全引数(cva は base 文字列 + variants オブジェクト値)
|
|
87
|
+
* - object/array: 値・要素を辿る(cva variants, compoundVariants の class 等)
|
|
88
|
+
* - 識別子 / メンバ参照: スコープから定義を解決して辿る。
|
|
89
|
+
* lookup テーブル(const variantStyles = {...}; styles = variantStyles[variant];
|
|
90
|
+
* className={cn("...border...", styles.card)})経由で色が供給されるケースを拾う。
|
|
91
|
+
* メンバの key は動的でありうるので、解決先オブジェクトの全文字列を集める
|
|
92
|
+
* (集合に色を足す方向にしか働かないため誤検知=過剰報告を防ぐ保守側)。
|
|
93
|
+
*/
|
|
94
|
+
function collect(node, out, ctx) {
|
|
95
|
+
if (!node || ctx.depth > 12) return
|
|
96
|
+
switch (node.type) {
|
|
97
|
+
case "Literal":
|
|
98
|
+
if (typeof node.value === "string") out.push(node.value)
|
|
99
|
+
break
|
|
100
|
+
case "TemplateLiteral":
|
|
101
|
+
for (const q of node.quasis) out.push(q.value.cooked ?? q.value.raw ?? "")
|
|
102
|
+
for (const e of node.expressions) collect(e, out, ctx)
|
|
103
|
+
break
|
|
104
|
+
case "ConditionalExpression":
|
|
105
|
+
collect(node.consequent, out, ctx)
|
|
106
|
+
collect(node.alternate, out, ctx)
|
|
107
|
+
break
|
|
108
|
+
case "LogicalExpression":
|
|
109
|
+
collect(node.left, out, ctx)
|
|
110
|
+
collect(node.right, out, ctx)
|
|
111
|
+
break
|
|
112
|
+
case "CallExpression":
|
|
113
|
+
if (CLASS_UTILS.has(calleeName(node))) {
|
|
114
|
+
for (const arg of node.arguments) collect(arg, out, ctx)
|
|
115
|
+
}
|
|
116
|
+
break
|
|
117
|
+
case "ArrayExpression":
|
|
118
|
+
for (const el of node.elements) collect(el, out, ctx)
|
|
119
|
+
break
|
|
120
|
+
case "ObjectExpression":
|
|
121
|
+
for (const prop of node.properties) {
|
|
122
|
+
if (prop.type === "Property") collect(prop.value, out, ctx)
|
|
123
|
+
}
|
|
124
|
+
break
|
|
125
|
+
case "JSXExpressionContainer":
|
|
126
|
+
collect(node.expression, out, ctx)
|
|
127
|
+
break
|
|
128
|
+
case "SpreadElement":
|
|
129
|
+
collect(node.argument, out, ctx)
|
|
130
|
+
break
|
|
131
|
+
case "TSAsExpression":
|
|
132
|
+
case "TSNonNullExpression":
|
|
133
|
+
collect(node.expression, out, ctx)
|
|
134
|
+
break
|
|
135
|
+
case "Identifier": {
|
|
136
|
+
if (ctx.seen.has(node.name)) break
|
|
137
|
+
const init = variableInit(ctx.scope, node.name)
|
|
138
|
+
if (init) {
|
|
139
|
+
ctx.seen.add(node.name)
|
|
140
|
+
collect(init, out, { ...ctx, depth: ctx.depth + 1 })
|
|
141
|
+
}
|
|
142
|
+
break
|
|
143
|
+
}
|
|
144
|
+
case "MemberExpression":
|
|
145
|
+
// key は動的でありうるため、ベースとなるオブジェクト全体を辿る。
|
|
146
|
+
collect(node.object, out, { ...ctx, depth: ctx.depth + 1 })
|
|
147
|
+
break
|
|
148
|
+
default:
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function hasNakedBorder(classes) {
|
|
154
|
+
return classes.some((c) => NAKED_BORDER_WIDTH.test(c))
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function hasBorderColor(classes) {
|
|
158
|
+
return classes.some((c) => BORDER_COLOR.test(c))
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
162
|
+
const noColorlessBorder = {
|
|
163
|
+
meta: {
|
|
164
|
+
type: "suggestion",
|
|
165
|
+
docs: {
|
|
166
|
+
description:
|
|
167
|
+
"Warn on Tailwind border width classes that omit a border color (P032)",
|
|
168
|
+
},
|
|
169
|
+
schema: [],
|
|
170
|
+
messages: {
|
|
171
|
+
colorlessBorder:
|
|
172
|
+
"[ksk-ds] 色を併記しないボーダー幅クラス(border / border-b 等)。Tailwind v4 では border-color の既定が currentColor になり、要素の文字色が枠線に透けて出る(消費側の濃色テキストで黒ずむ)。border-[var(--Border-Low-Emphasis)] 等を併記するか、状態で出し分ける場合は border-transparent を初期色に置き data-[state=active]:border-[var(--Brand-Primary)] 等で上書きする。(P032)",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
create(context) {
|
|
176
|
+
const filename = context.filename ?? context.getFilename?.() ?? ""
|
|
177
|
+
if (/\.stories\.[tj]sx?$/.test(filename)) return {}
|
|
178
|
+
|
|
179
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode?.()
|
|
180
|
+
|
|
181
|
+
function check(node) {
|
|
182
|
+
const scope = sourceCode?.getScope?.(node)
|
|
183
|
+
const fragments = []
|
|
184
|
+
collect(node, fragments, { scope, seen: new Set(), depth: 0 })
|
|
185
|
+
if (fragments.length === 0) return
|
|
186
|
+
const classes = fragments
|
|
187
|
+
.join(" ")
|
|
188
|
+
.split(/\s+/)
|
|
189
|
+
.filter(Boolean)
|
|
190
|
+
if (hasNakedBorder(classes) && !hasBorderColor(classes)) {
|
|
191
|
+
context.report({ node, messageId: "colorlessBorder" })
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
// 要素単位: 1 つの className 属性に到達する全文字列(cn/三項/テンプレ含む)を統合。
|
|
197
|
+
JSXAttribute(node) {
|
|
198
|
+
if (node.name?.name !== "className") return
|
|
199
|
+
if (!node.value) return
|
|
200
|
+
check(node.value)
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// CVA 定義単位: base + 全 variant 値を統合(badge.tsx の base border + variant 色対策)。
|
|
204
|
+
// cn() が JSX 属性内にある場合は JSXAttribute 側で処理済みなので、ここでは cva のみ扱い二重報告を避ける。
|
|
205
|
+
CallExpression(node) {
|
|
206
|
+
if (calleeName(node) !== "cva") return
|
|
207
|
+
check(node)
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export default {
|
|
214
|
+
rules: {
|
|
215
|
+
"no-colorless-border": noColorlessBorder,
|
|
216
|
+
},
|
|
217
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ksk-design-system",
|
|
3
|
+
"version": "1.35.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "KSK Design System — フリーランス向けマルチテーマ対応デザインシステム",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://ksk-design-system.vercel.app",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ekusiek716/ksk-design-system.git"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"bin": {
|
|
16
|
+
"ksk-ds": "./bin/init.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"bin",
|
|
21
|
+
"templates",
|
|
22
|
+
"contracts",
|
|
23
|
+
"tokens.json",
|
|
24
|
+
"AGENTS.md",
|
|
25
|
+
"CLAUDE.md",
|
|
26
|
+
"DESIGN.md",
|
|
27
|
+
"src/preset.css",
|
|
28
|
+
"src/styles",
|
|
29
|
+
"src/themes",
|
|
30
|
+
"src/components/COMPONENT_LOOKUP.md",
|
|
31
|
+
"scripts/codemod",
|
|
32
|
+
"eslint",
|
|
33
|
+
"MIGRATION.md",
|
|
34
|
+
"PUBLISHING.md",
|
|
35
|
+
"RELEASE.md"
|
|
36
|
+
],
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/types/index.d.ts",
|
|
40
|
+
"import": "./dist/index.js",
|
|
41
|
+
"default": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./class-names": {
|
|
44
|
+
"types": "./dist/types/class-names.d.ts",
|
|
45
|
+
"import": "./dist/class-names.js",
|
|
46
|
+
"default": "./dist/class-names.js"
|
|
47
|
+
},
|
|
48
|
+
"./native": {
|
|
49
|
+
"types": "./dist/types/tokens/native/index.d.ts",
|
|
50
|
+
"import": "./dist/native.js",
|
|
51
|
+
"default": "./dist/native.js"
|
|
52
|
+
},
|
|
53
|
+
"./native/ui": {
|
|
54
|
+
"types": "./dist/types/native/index.d.ts",
|
|
55
|
+
"import": "./dist/native/ui.js",
|
|
56
|
+
"default": "./dist/native/ui.js"
|
|
57
|
+
},
|
|
58
|
+
"./package.json": "./package.json",
|
|
59
|
+
"./preset": {
|
|
60
|
+
"import": "./src/preset.css",
|
|
61
|
+
"default": "./src/preset.css"
|
|
62
|
+
},
|
|
63
|
+
"./styles": {
|
|
64
|
+
"import": "./src/preset.css",
|
|
65
|
+
"default": "./src/preset.css"
|
|
66
|
+
},
|
|
67
|
+
"./styles.css": {
|
|
68
|
+
"import": "./src/preset.css",
|
|
69
|
+
"default": "./src/preset.css"
|
|
70
|
+
},
|
|
71
|
+
"./tokens/primitive": {
|
|
72
|
+
"import": "./src/styles/primitive.css",
|
|
73
|
+
"default": "./src/styles/primitive.css"
|
|
74
|
+
},
|
|
75
|
+
"./tokens/semantic": {
|
|
76
|
+
"import": "./src/styles/semantic.css",
|
|
77
|
+
"default": "./src/styles/semantic.css"
|
|
78
|
+
},
|
|
79
|
+
"./tokens/typography": {
|
|
80
|
+
"import": "./src/styles/typography.css",
|
|
81
|
+
"default": "./src/styles/typography.css"
|
|
82
|
+
},
|
|
83
|
+
"./tokens/categorical": {
|
|
84
|
+
"import": "./src/styles/categorical.css",
|
|
85
|
+
"default": "./src/styles/categorical.css"
|
|
86
|
+
},
|
|
87
|
+
"./glass": {
|
|
88
|
+
"import": "./src/styles/glass.css",
|
|
89
|
+
"default": "./src/styles/glass.css"
|
|
90
|
+
},
|
|
91
|
+
"./themes/default": {
|
|
92
|
+
"import": "./src/themes/default.css",
|
|
93
|
+
"default": "./src/themes/default.css"
|
|
94
|
+
},
|
|
95
|
+
"./themes/blue": {
|
|
96
|
+
"import": "./src/themes/blue.css",
|
|
97
|
+
"default": "./src/themes/blue.css"
|
|
98
|
+
},
|
|
99
|
+
"./themes/orange": {
|
|
100
|
+
"import": "./src/themes/orange.css",
|
|
101
|
+
"default": "./src/themes/orange.css"
|
|
102
|
+
},
|
|
103
|
+
"./themes/green": {
|
|
104
|
+
"import": "./src/themes/green.css",
|
|
105
|
+
"default": "./src/themes/green.css"
|
|
106
|
+
},
|
|
107
|
+
"./themes/violet": {
|
|
108
|
+
"import": "./src/themes/violet.css",
|
|
109
|
+
"default": "./src/themes/violet.css"
|
|
110
|
+
},
|
|
111
|
+
"./eslint/deprecated": {
|
|
112
|
+
"import": "./eslint/deprecated.js",
|
|
113
|
+
"default": "./eslint/deprecated.js"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"sideEffects": [
|
|
117
|
+
"*.css"
|
|
118
|
+
],
|
|
119
|
+
"scripts": {
|
|
120
|
+
"dev": "vite",
|
|
121
|
+
"build": "tsc -b && vite build",
|
|
122
|
+
"build:lib": "vite build --config vite.config.lib.ts && tsc --project tsconfig.lib.json || true",
|
|
123
|
+
"prepack": "npm run build:lib",
|
|
124
|
+
"lint": "eslint .",
|
|
125
|
+
"preview": "vite preview",
|
|
126
|
+
"storybook": "storybook dev -p 6010",
|
|
127
|
+
"build-storybook": "storybook build",
|
|
128
|
+
"lint:scratch": "bash scripts/lint-scratch.sh",
|
|
129
|
+
"lint:deps": "bash scripts/check-deps.sh",
|
|
130
|
+
"lint:responsive": "bash scripts/check-responsive.sh",
|
|
131
|
+
"lint:story-reuse": "bash scripts/check-story-reuse.sh",
|
|
132
|
+
"lint:contrast": "node scripts/check-contrast.mjs",
|
|
133
|
+
"lint:tailwind": "node scripts/check-tailwind-v4.mjs",
|
|
134
|
+
"lint:prefix-order": "node scripts/check-prefix-order.mjs",
|
|
135
|
+
"generate:lookup": "node scripts/generate-component-lookup.mjs",
|
|
136
|
+
"generate:tokens": "node scripts/generate-platform-tokens.mjs",
|
|
137
|
+
"lint:tokens": "node scripts/generate-platform-tokens.mjs --check",
|
|
138
|
+
"check:native": "tsc -p tsconfig.native.json --noEmit",
|
|
139
|
+
"test": "vitest run",
|
|
140
|
+
"test:watch": "vitest",
|
|
141
|
+
"check": "tsc -p tsconfig.app.json --noEmit && bash scripts/lint-scratch.sh && bash scripts/check-deps.sh && bash scripts/check-drift.sh && node scripts/check-contrast.mjs && node scripts/check-tailwind-v4.mjs && node scripts/check-prefix-order.mjs && node scripts/generate-component-lookup.mjs --check && node scripts/generate-platform-tokens.mjs --check && tsc -p tsconfig.native.json --noEmit",
|
|
142
|
+
"check:agent": "npm run lint && npm run check && npm test && npm run lint:story-reuse",
|
|
143
|
+
"postinstall": "node bin/init.js postinstall",
|
|
144
|
+
"mcp:build": "cd mcp-server && npm install && npm run build",
|
|
145
|
+
"mcp:start": "node mcp-server/dist/index.js"
|
|
146
|
+
},
|
|
147
|
+
"dependencies": {
|
|
148
|
+
"class-variance-authority": "^0.7.1",
|
|
149
|
+
"clsx": "^2.1.1",
|
|
150
|
+
"react-day-picker": "^9.14.0",
|
|
151
|
+
"react-hook-form": "^7.75.0",
|
|
152
|
+
"tailwind-merge": "^3.5.0"
|
|
153
|
+
},
|
|
154
|
+
"peerDependencies": {
|
|
155
|
+
"@radix-ui/react-slot": "^1.0.0",
|
|
156
|
+
"expo-blur": "*",
|
|
157
|
+
"iconsax-reactjs": "^0.0.8",
|
|
158
|
+
"radix-ui": "^1.0.0",
|
|
159
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
160
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
161
|
+
"react-native": ">=0.74.0",
|
|
162
|
+
"tailwindcss": "^4.0.0"
|
|
163
|
+
},
|
|
164
|
+
"peerDependenciesMeta": {
|
|
165
|
+
"@radix-ui/react-slot": {
|
|
166
|
+
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"expo-blur": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
171
|
+
"iconsax-reactjs": {
|
|
172
|
+
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"radix-ui": {
|
|
175
|
+
"optional": true
|
|
176
|
+
},
|
|
177
|
+
"react-dom": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"react-native": {
|
|
181
|
+
"optional": true
|
|
182
|
+
},
|
|
183
|
+
"tailwindcss": {
|
|
184
|
+
"optional": true
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"devDependencies": {
|
|
188
|
+
"@eslint/js": "^9.39.1",
|
|
189
|
+
"@hookform/resolvers": "^5.2.2",
|
|
190
|
+
"@storybook/addon-a11y": "^10.3.3",
|
|
191
|
+
"@storybook/addon-docs": "^10.3.3",
|
|
192
|
+
"@storybook/react-vite": "^10.3.3",
|
|
193
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
194
|
+
"@types/react": "^19.2.7",
|
|
195
|
+
"@types/react-dom": "^19.2.3",
|
|
196
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
197
|
+
"eslint": "^9.39.1",
|
|
198
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
199
|
+
"eslint-plugin-storybook": "^10.3.3",
|
|
200
|
+
"globals": "^16.5.0",
|
|
201
|
+
"iconsax-reactjs": "^0.0.8",
|
|
202
|
+
"radix-ui": "^1.4.3",
|
|
203
|
+
"react": "^19.2.0",
|
|
204
|
+
"react-dom": "^19.2.0",
|
|
205
|
+
"react-native": "^0.86.0",
|
|
206
|
+
"storybook": "^10.3.3",
|
|
207
|
+
"tailwindcss": "^4.2.1",
|
|
208
|
+
"tw-animate-css": "^1.4.0",
|
|
209
|
+
"typescript": "~5.9.3",
|
|
210
|
+
"typescript-eslint": "^8.48.0",
|
|
211
|
+
"vite": "^7.3.1",
|
|
212
|
+
"vitest": "^4.1.7",
|
|
213
|
+
"zod": "^4.4.2"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Codemod
|
|
2
|
+
|
|
3
|
+
`ksk-design-system` で破壊変更を入れる際の自動移行スクリプト置き場。
|
|
4
|
+
|
|
5
|
+
## 使い方(利用側プロジェクトで)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 事前確認(変更を書き込まない)
|
|
9
|
+
npx ksk-design-system codemod v1-to-v2 ./src --dry
|
|
10
|
+
|
|
11
|
+
# 実行
|
|
12
|
+
npx ksk-design-system codemod v1-to-v2 ./src
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 新しい codemod の作り方(メンテナ向け)
|
|
16
|
+
|
|
17
|
+
1. `template.mjs` を複製
|
|
18
|
+
```bash
|
|
19
|
+
cp scripts/codemod/template.mjs scripts/codemod/v1-to-v2.mjs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. 編集ポイント:
|
|
23
|
+
- `RENAMES` — 単純な識別子 rename: `[["OldComp", "NewComp"], ...]`
|
|
24
|
+
- `PROP_RENAMES` — JSX prop rename: `[["Button", "kind", "variant"], ...]`
|
|
25
|
+
- `WARNINGS` — 自動置換が危険な箇所の人向け警告
|
|
26
|
+
- `PACKAGE_PATTERN` — 対象パッケージ名(通常そのまま)
|
|
27
|
+
|
|
28
|
+
3. ローカル動作確認
|
|
29
|
+
```bash
|
|
30
|
+
node scripts/codemod/v1-to-v2.mjs --dry path/to/consumer/src
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
4. `MIGRATION.md` に変更点を文書化(before/after 例・自動置換できない警告)
|
|
34
|
+
|
|
35
|
+
5. リリースノートで案内
|
|
36
|
+
- codemod ファイル名(例: `v1-to-v2`)
|
|
37
|
+
- --dry 推奨
|
|
38
|
+
- 必ずコミット済みで実行
|
|
39
|
+
|
|
40
|
+
## 注意
|
|
41
|
+
|
|
42
|
+
- 正規表現ベースで 100% 正確ではない
|
|
43
|
+
- 必ず利用側プロジェクトをコミット済み状態にしてから実行する
|
|
44
|
+
- 適用後は `git diff` で必ず変更箇所を確認すること
|
|
45
|
+
- 複雑な書き換え(型推論を伴うもの、template literal 内の参照等)は手動対応推奨
|
|
46
|
+
|
|
47
|
+
## 関連ドキュメント
|
|
48
|
+
|
|
49
|
+
- `MIGRATION.md` — メジャーバージョン毎の移行ガイド
|
|
50
|
+
- `RELEASE.md` — リリースサイクル
|
|
51
|
+
- `eslint/deprecated.js` — 旧 API 検出用 ESLint ルール
|