kigumi 0.2.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/README.md +407 -0
- package/dist/chunk-FG4CIVPT.js +52 -0
- package/dist/chunk-IRCCX2A2.js +72 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6119 -0
- package/dist/path-aliases-3OJ2RKTE.js +95 -0
- package/dist/path-aliases-44XMTAAA.js +89 -0
- package/dist/path-aliases-CNBMGBKE.js +98 -0
- package/dist/path-aliases-L6USUZ4R.js +91 -0
- package/dist/path-aliases-NX2TDEHO.js +92 -0
- package/dist/path-aliases-ZRNAAXX2.js +94 -0
- package/dist/project-config-3XEQHIUM.js +115 -0
- package/dist/project-config-4YGWM3KJ.js +92 -0
- package/dist/project-config-YLUSQM7U.js +108 -0
- package/dist/templates/AGENTS.md +214 -0
- package/dist/templates/react/AnimatedImage/AnimatedImage.css.hbs +19 -0
- package/dist/templates/react/AnimatedImage/AnimatedImage.jsx.hbs +64 -0
- package/dist/templates/react/AnimatedImage/AnimatedImage.test.jsx.hbs +29 -0
- package/dist/templates/react/AnimatedImage/AnimatedImage.test.tsx.hbs +14 -0
- package/dist/templates/react/AnimatedImage/AnimatedImage.tsx.hbs +68 -0
- package/dist/templates/react/Animation/Animation.css.hbs +18 -0
- package/dist/templates/react/Animation/Animation.jsx.hbs +100 -0
- package/dist/templates/react/Animation/Animation.test.jsx.hbs +37 -0
- package/dist/templates/react/Animation/Animation.test.tsx.hbs +14 -0
- package/dist/templates/react/Animation/Animation.tsx.hbs +127 -0
- package/dist/templates/react/Avatar/Avatar.css.hbs +20 -0
- package/dist/templates/react/Avatar/Avatar.jsx.hbs +65 -0
- package/dist/templates/react/Avatar/Avatar.test.jsx.hbs +33 -0
- package/dist/templates/react/Avatar/Avatar.test.tsx.hbs +14 -0
- package/dist/templates/react/Avatar/Avatar.tsx.hbs +71 -0
- package/dist/templates/react/Badge/Badge.css.hbs +18 -0
- package/dist/templates/react/Badge/Badge.jsx.hbs +46 -0
- package/dist/templates/react/Badge/Badge.test.jsx.hbs +28 -0
- package/dist/templates/react/Badge/Badge.test.tsx.hbs +14 -0
- package/dist/templates/react/Badge/Badge.tsx.hbs +50 -0
- package/dist/templates/react/Breadcrumb/Breadcrumb.css.hbs +18 -0
- package/dist/templates/react/Breadcrumb/Breadcrumb.jsx.hbs +48 -0
- package/dist/templates/react/Breadcrumb/Breadcrumb.test.jsx.hbs +34 -0
- package/dist/templates/react/Breadcrumb/Breadcrumb.test.tsx.hbs +14 -0
- package/dist/templates/react/Breadcrumb/Breadcrumb.tsx.hbs +49 -0
- package/dist/templates/react/BreadcrumbItem/BreadcrumbItem.css.hbs +21 -0
- package/dist/templates/react/BreadcrumbItem/BreadcrumbItem.jsx.hbs +55 -0
- package/dist/templates/react/BreadcrumbItem/BreadcrumbItem.test.jsx.hbs +36 -0
- package/dist/templates/react/BreadcrumbItem/BreadcrumbItem.test.tsx.hbs +14 -0
- package/dist/templates/react/BreadcrumbItem/BreadcrumbItem.tsx.hbs +58 -0
- package/dist/templates/react/Button/Button.css.hbs +23 -0
- package/dist/templates/react/Button/Button.jsx.hbs +106 -0
- package/dist/templates/react/Button/Button.test.jsx.hbs +23 -0
- package/dist/templates/react/Button/Button.test.tsx.hbs +14 -0
- package/dist/templates/react/Button/Button.tsx.hbs +131 -0
- package/dist/templates/react/Card/Card.css.hbs +21 -0
- package/dist/templates/react/Card/Card.jsx.hbs +33 -0
- package/dist/templates/react/Card/Card.test.jsx.hbs +23 -0
- package/dist/templates/react/Card/Card.test.tsx.hbs +14 -0
- package/dist/templates/react/Card/Card.tsx.hbs +41 -0
- package/dist/templates/react/Carousel/Carousel.css.hbs +28 -0
- package/dist/templates/react/Carousel/Carousel.jsx.hbs +81 -0
- package/dist/templates/react/Carousel/Carousel.test.jsx.hbs +25 -0
- package/dist/templates/react/Carousel/Carousel.test.tsx.hbs +14 -0
- package/dist/templates/react/Carousel/Carousel.tsx.hbs +108 -0
- package/dist/templates/react/CarouselItem/CarouselItem.css.hbs +18 -0
- package/dist/templates/react/CarouselItem/CarouselItem.jsx.hbs +28 -0
- package/dist/templates/react/CarouselItem/CarouselItem.test.jsx.hbs +21 -0
- package/dist/templates/react/CarouselItem/CarouselItem.test.tsx.hbs +14 -0
- package/dist/templates/react/CarouselItem/CarouselItem.tsx.hbs +33 -0
- package/dist/templates/react/Checkbox/Checkbox.css.hbs +24 -0
- package/dist/templates/react/Checkbox/Checkbox.jsx.hbs +80 -0
- package/dist/templates/react/Checkbox/Checkbox.test.jsx.hbs +25 -0
- package/dist/templates/react/Checkbox/Checkbox.test.tsx.hbs +14 -0
- package/dist/templates/react/Checkbox/Checkbox.tsx.hbs +113 -0
- package/dist/templates/react/ColorPicker/ColorPicker.css.hbs +37 -0
- package/dist/templates/react/ColorPicker/ColorPicker.jsx.hbs +72 -0
- package/dist/templates/react/ColorPicker/ColorPicker.test.jsx.hbs +25 -0
- package/dist/templates/react/ColorPicker/ColorPicker.test.tsx.hbs +14 -0
- package/dist/templates/react/ColorPicker/ColorPicker.tsx.hbs +157 -0
- package/dist/templates/react/Combobox/Combobox.css.hbs +32 -0
- package/dist/templates/react/Combobox/Combobox.jsx.hbs +67 -0
- package/dist/templates/react/Combobox/Combobox.test.jsx.hbs +19 -0
- package/dist/templates/react/Combobox/Combobox.test.tsx.hbs +14 -0
- package/dist/templates/react/Combobox/Combobox.tsx.hbs +154 -0
- package/dist/templates/react/Comparison/Comparison.css.hbs +23 -0
- package/dist/templates/react/Comparison/Comparison.jsx.hbs +27 -0
- package/dist/templates/react/Comparison/Comparison.test.jsx.hbs +27 -0
- package/dist/templates/react/Comparison/Comparison.test.tsx.hbs +14 -0
- package/dist/templates/react/Comparison/Comparison.tsx.hbs +32 -0
- package/dist/templates/react/CopyButton/CopyButton.css.hbs +25 -0
- package/dist/templates/react/CopyButton/CopyButton.jsx.hbs +49 -0
- package/dist/templates/react/CopyButton/CopyButton.test.jsx.hbs +16 -0
- package/dist/templates/react/CopyButton/CopyButton.test.tsx.hbs +14 -0
- package/dist/templates/react/CopyButton/CopyButton.tsx.hbs +71 -0
- package/dist/templates/react/Details/Details.css.hbs +24 -0
- package/dist/templates/react/Details/Details.jsx.hbs +66 -0
- package/dist/templates/react/Details/Details.test.jsx.hbs +27 -0
- package/dist/templates/react/Details/Details.test.tsx.hbs +14 -0
- package/dist/templates/react/Details/Details.tsx.hbs +111 -0
- package/dist/templates/react/Dialog/Dialog.css.hbs +28 -0
- package/dist/templates/react/Dialog/Dialog.jsx.hbs +115 -0
- package/dist/templates/react/Dialog/Dialog.test.jsx.hbs +29 -0
- package/dist/templates/react/Dialog/Dialog.test.tsx.hbs +14 -0
- package/dist/templates/react/Dialog/Dialog.tsx.hbs +165 -0
- package/dist/templates/react/Divider/Divider.css.hbs +21 -0
- package/dist/templates/react/Divider/Divider.jsx.hbs +24 -0
- package/dist/templates/react/Divider/Divider.test.jsx.hbs +16 -0
- package/dist/templates/react/Divider/Divider.test.tsx.hbs +14 -0
- package/dist/templates/react/Divider/Divider.tsx.hbs +24 -0
- package/dist/templates/react/Drawer/Drawer.css.hbs +28 -0
- package/dist/templates/react/Drawer/Drawer.jsx.hbs +75 -0
- package/dist/templates/react/Drawer/Drawer.test.jsx.hbs +27 -0
- package/dist/templates/react/Drawer/Drawer.test.tsx.hbs +14 -0
- package/dist/templates/react/Drawer/Drawer.tsx.hbs +99 -0
- package/dist/templates/react/Dropdown/Dropdown.css.hbs +20 -0
- package/dist/templates/react/Dropdown/Dropdown.jsx.hbs +78 -0
- package/dist/templates/react/Dropdown/Dropdown.test.jsx.hbs +18 -0
- package/dist/templates/react/Dropdown/Dropdown.test.tsx.hbs +14 -0
- package/dist/templates/react/Dropdown/Dropdown.tsx.hbs +104 -0
- package/dist/templates/react/DropdownItem/DropdownItem.css.hbs +23 -0
- package/dist/templates/react/DropdownItem/DropdownItem.jsx.hbs +41 -0
- package/dist/templates/react/DropdownItem/DropdownItem.test.jsx.hbs +18 -0
- package/dist/templates/react/DropdownItem/DropdownItem.test.tsx.hbs +14 -0
- package/dist/templates/react/DropdownItem/DropdownItem.tsx.hbs +56 -0
- package/dist/templates/react/FormatBytes/FormatBytes.css.hbs +18 -0
- package/dist/templates/react/FormatBytes/FormatBytes.jsx.hbs +25 -0
- package/dist/templates/react/FormatBytes/FormatBytes.test.jsx.hbs +16 -0
- package/dist/templates/react/FormatBytes/FormatBytes.test.tsx.hbs +14 -0
- package/dist/templates/react/FormatBytes/FormatBytes.tsx.hbs +27 -0
- package/dist/templates/react/FormatDate/FormatDate.css.hbs +18 -0
- package/dist/templates/react/FormatDate/FormatDate.jsx.hbs +18 -0
- package/dist/templates/react/FormatDate/FormatDate.test.jsx.hbs +11 -0
- package/dist/templates/react/FormatDate/FormatDate.test.tsx.hbs +14 -0
- package/dist/templates/react/FormatDate/FormatDate.tsx.hbs +45 -0
- package/dist/templates/react/FormatNumber/FormatNumber.css.hbs +18 -0
- package/dist/templates/react/FormatNumber/FormatNumber.jsx.hbs +18 -0
- package/dist/templates/react/FormatNumber/FormatNumber.test.jsx.hbs +16 -0
- package/dist/templates/react/FormatNumber/FormatNumber.test.tsx.hbs +14 -0
- package/dist/templates/react/FormatNumber/FormatNumber.tsx.hbs +41 -0
- package/dist/templates/react/Icon/Icon.css.hbs +22 -0
- package/dist/templates/react/Icon/Icon.jsx.hbs +83 -0
- package/dist/templates/react/Icon/Icon.test.jsx.hbs +35 -0
- package/dist/templates/react/Icon/Icon.test.tsx.hbs +14 -0
- package/dist/templates/react/Icon/Icon.tsx.hbs +93 -0
- package/dist/templates/react/Include/Include.css.hbs +18 -0
- package/dist/templates/react/Include/Include.jsx.hbs +40 -0
- package/dist/templates/react/Include/Include.test.jsx.hbs +16 -0
- package/dist/templates/react/Include/Include.test.tsx.hbs +14 -0
- package/dist/templates/react/Include/Include.tsx.hbs +53 -0
- package/dist/templates/react/Input/Input.css.hbs +25 -0
- package/dist/templates/react/Input/Input.jsx.hbs +126 -0
- package/dist/templates/react/Input/Input.test.jsx.hbs +23 -0
- package/dist/templates/react/Input/Input.test.tsx.hbs +14 -0
- package/dist/templates/react/Input/Input.tsx.hbs +154 -0
- package/dist/templates/react/IntersectionObserver/IntersectionObserver.css.hbs +18 -0
- package/dist/templates/react/IntersectionObserver/IntersectionObserver.jsx.hbs +38 -0
- package/dist/templates/react/IntersectionObserver/IntersectionObserver.test.jsx.hbs +15 -0
- package/dist/templates/react/IntersectionObserver/IntersectionObserver.test.tsx.hbs +14 -0
- package/dist/templates/react/IntersectionObserver/IntersectionObserver.tsx.hbs +55 -0
- package/dist/templates/react/KIGUMI_SETUP.md.hbs +52 -0
- package/dist/templates/react/MutationObserver/MutationObserver.css.hbs +18 -0
- package/dist/templates/react/MutationObserver/MutationObserver.jsx.hbs +38 -0
- package/dist/templates/react/MutationObserver/MutationObserver.test.jsx.hbs +15 -0
- package/dist/templates/react/MutationObserver/MutationObserver.test.tsx.hbs +14 -0
- package/dist/templates/react/MutationObserver/MutationObserver.tsx.hbs +55 -0
- package/dist/templates/react/Option/Option.css.hbs +21 -0
- package/dist/templates/react/Option/Option.jsx.hbs +20 -0
- package/dist/templates/react/Option/Option.test.jsx.hbs +11 -0
- package/dist/templates/react/Option/Option.test.tsx.hbs +14 -0
- package/dist/templates/react/Option/Option.tsx.hbs +27 -0
- package/dist/templates/react/Popover/Popover.css.hbs +25 -0
- package/dist/templates/react/Popover/Popover.jsx.hbs +68 -0
- package/dist/templates/react/Popover/Popover.test.jsx.hbs +18 -0
- package/dist/templates/react/Popover/Popover.test.tsx.hbs +14 -0
- package/dist/templates/react/Popover/Popover.tsx.hbs +101 -0
- package/dist/templates/react/Popup/Popup.css.hbs +25 -0
- package/dist/templates/react/Popup/Popup.jsx.hbs +45 -0
- package/dist/templates/react/Popup/Popup.test.jsx.hbs +17 -0
- package/dist/templates/react/Popup/Popup.test.tsx.hbs +14 -0
- package/dist/templates/react/Popup/Popup.tsx.hbs +83 -0
- package/dist/templates/react/ProgressBar/ProgressBar.css.hbs +22 -0
- package/dist/templates/react/ProgressBar/ProgressBar.jsx.hbs +20 -0
- package/dist/templates/react/ProgressBar/ProgressBar.test.jsx.hbs +16 -0
- package/dist/templates/react/ProgressBar/ProgressBar.test.tsx.hbs +14 -0
- package/dist/templates/react/ProgressBar/ProgressBar.tsx.hbs +29 -0
- package/dist/templates/react/ProgressRing/ProgressRing.css.hbs +26 -0
- package/dist/templates/react/ProgressRing/ProgressRing.jsx.hbs +20 -0
- package/dist/templates/react/ProgressRing/ProgressRing.test.jsx.hbs +16 -0
- package/dist/templates/react/ProgressRing/ProgressRing.test.tsx.hbs +14 -0
- package/dist/templates/react/ProgressRing/ProgressRing.tsx.hbs +27 -0
- package/dist/templates/react/QrCode/QrCode.css.hbs +18 -0
- package/dist/templates/react/QrCode/QrCode.jsx.hbs +18 -0
- package/dist/templates/react/QrCode/QrCode.test.jsx.hbs +11 -0
- package/dist/templates/react/QrCode/QrCode.test.tsx.hbs +14 -0
- package/dist/templates/react/QrCode/QrCode.tsx.hbs +35 -0
- package/dist/templates/react/Radio/Radio.css.hbs +21 -0
- package/dist/templates/react/Radio/Radio.jsx.hbs +20 -0
- package/dist/templates/react/Radio/Radio.test.jsx.hbs +11 -0
- package/dist/templates/react/Radio/Radio.test.tsx.hbs +14 -0
- package/dist/templates/react/Radio/Radio.tsx.hbs +31 -0
- package/dist/templates/react/RadioGroup/RadioGroup.css.hbs +22 -0
- package/dist/templates/react/RadioGroup/RadioGroup.jsx.hbs +49 -0
- package/dist/templates/react/RadioGroup/RadioGroup.test.jsx.hbs +17 -0
- package/dist/templates/react/RadioGroup/RadioGroup.test.tsx.hbs +14 -0
- package/dist/templates/react/RadioGroup/RadioGroup.tsx.hbs +79 -0
- package/dist/templates/react/Rating/Rating.css.hbs +20 -0
- package/dist/templates/react/Rating/Rating.jsx.hbs +48 -0
- package/dist/templates/react/Rating/Rating.test.jsx.hbs +18 -0
- package/dist/templates/react/Rating/Rating.test.tsx.hbs +14 -0
- package/dist/templates/react/Rating/Rating.tsx.hbs +78 -0
- package/dist/templates/react/RelativeTime/RelativeTime.css.hbs +18 -0
- package/dist/templates/react/RelativeTime/RelativeTime.jsx.hbs +18 -0
- package/dist/templates/react/RelativeTime/RelativeTime.test.jsx.hbs +11 -0
- package/dist/templates/react/RelativeTime/RelativeTime.test.tsx.hbs +14 -0
- package/dist/templates/react/RelativeTime/RelativeTime.tsx.hbs +29 -0
- package/dist/templates/react/ResizeObserver/ResizeObserver.css.hbs +18 -0
- package/dist/templates/react/ResizeObserver/ResizeObserver.jsx.hbs +38 -0
- package/dist/templates/react/ResizeObserver/ResizeObserver.test.jsx.hbs +15 -0
- package/dist/templates/react/ResizeObserver/ResizeObserver.test.tsx.hbs +14 -0
- package/dist/templates/react/ResizeObserver/ResizeObserver.tsx.hbs +45 -0
- package/dist/templates/react/Scroller/Scroller.css.hbs +19 -0
- package/dist/templates/react/Scroller/Scroller.jsx.hbs +20 -0
- package/dist/templates/react/Scroller/Scroller.test.jsx.hbs +11 -0
- package/dist/templates/react/Scroller/Scroller.test.tsx.hbs +14 -0
- package/dist/templates/react/Scroller/Scroller.tsx.hbs +29 -0
- package/dist/templates/react/Select/Select.css.hbs +32 -0
- package/dist/templates/react/Select/Select.jsx.hbs +79 -0
- package/dist/templates/react/Select/Select.test.jsx.hbs +20 -0
- package/dist/templates/react/Select/Select.test.tsx.hbs +14 -0
- package/dist/templates/react/Select/Select.tsx.hbs +140 -0
- package/dist/templates/react/Skeleton/Skeleton.css.hbs +19 -0
- package/dist/templates/react/Skeleton/Skeleton.jsx.hbs +18 -0
- package/dist/templates/react/Skeleton/Skeleton.test.jsx.hbs +11 -0
- package/dist/templates/react/Skeleton/Skeleton.test.tsx.hbs +14 -0
- package/dist/templates/react/Skeleton/Skeleton.tsx.hbs +23 -0
- package/dist/templates/react/Slider/Slider.css.hbs +26 -0
- package/dist/templates/react/Slider/Slider.jsx.hbs +50 -0
- package/dist/templates/react/Slider/Slider.test.jsx.hbs +19 -0
- package/dist/templates/react/Slider/Slider.test.tsx.hbs +14 -0
- package/dist/templates/react/Slider/Slider.tsx.hbs +100 -0
- package/dist/templates/react/Spinner/Spinner.css.hbs +21 -0
- package/dist/templates/react/Spinner/Spinner.jsx.hbs +18 -0
- package/dist/templates/react/Spinner/Spinner.test.jsx.hbs +11 -0
- package/dist/templates/react/Spinner/Spinner.test.tsx.hbs +14 -0
- package/dist/templates/react/Spinner/Spinner.tsx.hbs +20 -0
- package/dist/templates/react/SplitPanel/SplitPanel.css.hbs +24 -0
- package/dist/templates/react/SplitPanel/SplitPanel.jsx.hbs +38 -0
- package/dist/templates/react/SplitPanel/SplitPanel.test.jsx.hbs +16 -0
- package/dist/templates/react/SplitPanel/SplitPanel.test.tsx.hbs +14 -0
- package/dist/templates/react/SplitPanel/SplitPanel.tsx.hbs +55 -0
- package/dist/templates/react/Switch/Switch.css.hbs +24 -0
- package/dist/templates/react/Switch/Switch.jsx.hbs +51 -0
- package/dist/templates/react/Switch/Switch.test.jsx.hbs +19 -0
- package/dist/templates/react/Switch/Switch.test.tsx.hbs +14 -0
- package/dist/templates/react/Switch/Switch.tsx.hbs +83 -0
- package/dist/templates/react/Tab/Tab.css.hbs +18 -0
- package/dist/templates/react/Tab/Tab.jsx.hbs +20 -0
- package/dist/templates/react/Tab/Tab.test.jsx.hbs +11 -0
- package/dist/templates/react/Tab/Tab.test.tsx.hbs +14 -0
- package/dist/templates/react/Tab/Tab.tsx.hbs +27 -0
- package/dist/templates/react/TabGroup/TabGroup.css.hbs +27 -0
- package/dist/templates/react/TabGroup/TabGroup.jsx.hbs +42 -0
- package/dist/templates/react/TabGroup/TabGroup.test.jsx.hbs +11 -0
- package/dist/templates/react/TabGroup/TabGroup.test.tsx.hbs +14 -0
- package/dist/templates/react/TabGroup/TabGroup.tsx.hbs +57 -0
- package/dist/templates/react/TabPanel/TabPanel.css.hbs +18 -0
- package/dist/templates/react/TabPanel/TabPanel.jsx.hbs +20 -0
- package/dist/templates/react/TabPanel/TabPanel.test.jsx.hbs +11 -0
- package/dist/templates/react/TabPanel/TabPanel.test.tsx.hbs +14 -0
- package/dist/templates/react/TabPanel/TabPanel.tsx.hbs +27 -0
- package/dist/templates/react/Tag/Tag.css.hbs +21 -0
- package/dist/templates/react/Tag/Tag.jsx.hbs +41 -0
- package/dist/templates/react/Tag/Tag.test.jsx.hbs +11 -0
- package/dist/templates/react/Tag/Tag.test.tsx.hbs +14 -0
- package/dist/templates/react/Tag/Tag.tsx.hbs +60 -0
- package/dist/templates/react/Textarea/Textarea.css.hbs +22 -0
- package/dist/templates/react/Textarea/Textarea.jsx.hbs +58 -0
- package/dist/templates/react/Textarea/Textarea.test.jsx.hbs +11 -0
- package/dist/templates/react/Textarea/Textarea.test.tsx.hbs +14 -0
- package/dist/templates/react/Textarea/Textarea.tsx.hbs +114 -0
- package/dist/templates/react/Tooltip/Tooltip.css.hbs +21 -0
- package/dist/templates/react/Tooltip/Tooltip.jsx.hbs +63 -0
- package/dist/templates/react/Tooltip/Tooltip.test.jsx.hbs +15 -0
- package/dist/templates/react/Tooltip/Tooltip.test.tsx.hbs +14 -0
- package/dist/templates/react/Tooltip/Tooltip.tsx.hbs +104 -0
- package/dist/templates/react/Tree/Tree.css.hbs +22 -0
- package/dist/templates/react/Tree/Tree.jsx.hbs +41 -0
- package/dist/templates/react/Tree/Tree.test.jsx.hbs +11 -0
- package/dist/templates/react/Tree/Tree.test.tsx.hbs +14 -0
- package/dist/templates/react/Tree/Tree.tsx.hbs +52 -0
- package/dist/templates/react/TreeItem/TreeItem.css.hbs +32 -0
- package/dist/templates/react/TreeItem/TreeItem.jsx.hbs +57 -0
- package/dist/templates/react/TreeItem/TreeItem.test.jsx.hbs +11 -0
- package/dist/templates/react/TreeItem/TreeItem.test.tsx.hbs +14 -0
- package/dist/templates/react/TreeItem/TreeItem.tsx.hbs +87 -0
- package/dist/templates/react/ZoomableFrame/ZoomableFrame.css.hbs +21 -0
- package/dist/templates/react/ZoomableFrame/ZoomableFrame.jsx.hbs +52 -0
- package/dist/templates/react/ZoomableFrame/ZoomableFrame.test.jsx.hbs +11 -0
- package/dist/templates/react/ZoomableFrame/ZoomableFrame.test.tsx.hbs +14 -0
- package/dist/templates/react/ZoomableFrame/ZoomableFrame.tsx.hbs +92 -0
- package/dist/templates/react/vite-env.d.ts.hbs +21 -0
- package/dist/tier-2ZEZT6E3.js +12 -0
- package/dist/tier-GFXZQZUI.js +12 -0
- package/package.json +82 -0
- package/templates/AGENTS.md +214 -0
- package/templates/react/AnimatedImage/AnimatedImage.css.hbs +19 -0
- package/templates/react/AnimatedImage/AnimatedImage.jsx.hbs +64 -0
- package/templates/react/AnimatedImage/AnimatedImage.test.jsx.hbs +29 -0
- package/templates/react/AnimatedImage/AnimatedImage.test.tsx.hbs +14 -0
- package/templates/react/AnimatedImage/AnimatedImage.tsx.hbs +68 -0
- package/templates/react/Animation/Animation.css.hbs +18 -0
- package/templates/react/Animation/Animation.jsx.hbs +100 -0
- package/templates/react/Animation/Animation.test.jsx.hbs +37 -0
- package/templates/react/Animation/Animation.test.tsx.hbs +14 -0
- package/templates/react/Animation/Animation.tsx.hbs +127 -0
- package/templates/react/Avatar/Avatar.css.hbs +20 -0
- package/templates/react/Avatar/Avatar.jsx.hbs +65 -0
- package/templates/react/Avatar/Avatar.test.jsx.hbs +33 -0
- package/templates/react/Avatar/Avatar.test.tsx.hbs +14 -0
- package/templates/react/Avatar/Avatar.tsx.hbs +71 -0
- package/templates/react/Badge/Badge.css.hbs +18 -0
- package/templates/react/Badge/Badge.jsx.hbs +46 -0
- package/templates/react/Badge/Badge.test.jsx.hbs +28 -0
- package/templates/react/Badge/Badge.test.tsx.hbs +14 -0
- package/templates/react/Badge/Badge.tsx.hbs +50 -0
- package/templates/react/Breadcrumb/Breadcrumb.css.hbs +18 -0
- package/templates/react/Breadcrumb/Breadcrumb.jsx.hbs +48 -0
- package/templates/react/Breadcrumb/Breadcrumb.test.jsx.hbs +34 -0
- package/templates/react/Breadcrumb/Breadcrumb.test.tsx.hbs +14 -0
- package/templates/react/Breadcrumb/Breadcrumb.tsx.hbs +49 -0
- package/templates/react/BreadcrumbItem/BreadcrumbItem.css.hbs +21 -0
- package/templates/react/BreadcrumbItem/BreadcrumbItem.jsx.hbs +55 -0
- package/templates/react/BreadcrumbItem/BreadcrumbItem.test.jsx.hbs +36 -0
- package/templates/react/BreadcrumbItem/BreadcrumbItem.test.tsx.hbs +14 -0
- package/templates/react/BreadcrumbItem/BreadcrumbItem.tsx.hbs +58 -0
- package/templates/react/Button/Button.css.hbs +23 -0
- package/templates/react/Button/Button.jsx.hbs +106 -0
- package/templates/react/Button/Button.test.jsx.hbs +23 -0
- package/templates/react/Button/Button.test.tsx.hbs +14 -0
- package/templates/react/Button/Button.tsx.hbs +131 -0
- package/templates/react/Card/Card.css.hbs +21 -0
- package/templates/react/Card/Card.jsx.hbs +33 -0
- package/templates/react/Card/Card.test.jsx.hbs +23 -0
- package/templates/react/Card/Card.test.tsx.hbs +14 -0
- package/templates/react/Card/Card.tsx.hbs +41 -0
- package/templates/react/Carousel/Carousel.css.hbs +28 -0
- package/templates/react/Carousel/Carousel.jsx.hbs +81 -0
- package/templates/react/Carousel/Carousel.test.jsx.hbs +25 -0
- package/templates/react/Carousel/Carousel.test.tsx.hbs +14 -0
- package/templates/react/Carousel/Carousel.tsx.hbs +108 -0
- package/templates/react/CarouselItem/CarouselItem.css.hbs +18 -0
- package/templates/react/CarouselItem/CarouselItem.jsx.hbs +28 -0
- package/templates/react/CarouselItem/CarouselItem.test.jsx.hbs +21 -0
- package/templates/react/CarouselItem/CarouselItem.test.tsx.hbs +14 -0
- package/templates/react/CarouselItem/CarouselItem.tsx.hbs +33 -0
- package/templates/react/Checkbox/Checkbox.css.hbs +24 -0
- package/templates/react/Checkbox/Checkbox.jsx.hbs +80 -0
- package/templates/react/Checkbox/Checkbox.test.jsx.hbs +25 -0
- package/templates/react/Checkbox/Checkbox.test.tsx.hbs +14 -0
- package/templates/react/Checkbox/Checkbox.tsx.hbs +113 -0
- package/templates/react/ColorPicker/ColorPicker.css.hbs +37 -0
- package/templates/react/ColorPicker/ColorPicker.jsx.hbs +72 -0
- package/templates/react/ColorPicker/ColorPicker.test.jsx.hbs +25 -0
- package/templates/react/ColorPicker/ColorPicker.test.tsx.hbs +14 -0
- package/templates/react/ColorPicker/ColorPicker.tsx.hbs +157 -0
- package/templates/react/Combobox/Combobox.css.hbs +32 -0
- package/templates/react/Combobox/Combobox.jsx.hbs +67 -0
- package/templates/react/Combobox/Combobox.test.jsx.hbs +19 -0
- package/templates/react/Combobox/Combobox.test.tsx.hbs +14 -0
- package/templates/react/Combobox/Combobox.tsx.hbs +154 -0
- package/templates/react/Comparison/Comparison.css.hbs +23 -0
- package/templates/react/Comparison/Comparison.jsx.hbs +27 -0
- package/templates/react/Comparison/Comparison.test.jsx.hbs +27 -0
- package/templates/react/Comparison/Comparison.test.tsx.hbs +14 -0
- package/templates/react/Comparison/Comparison.tsx.hbs +32 -0
- package/templates/react/CopyButton/CopyButton.css.hbs +25 -0
- package/templates/react/CopyButton/CopyButton.jsx.hbs +49 -0
- package/templates/react/CopyButton/CopyButton.test.jsx.hbs +16 -0
- package/templates/react/CopyButton/CopyButton.test.tsx.hbs +14 -0
- package/templates/react/CopyButton/CopyButton.tsx.hbs +71 -0
- package/templates/react/Details/Details.css.hbs +24 -0
- package/templates/react/Details/Details.jsx.hbs +66 -0
- package/templates/react/Details/Details.test.jsx.hbs +27 -0
- package/templates/react/Details/Details.test.tsx.hbs +14 -0
- package/templates/react/Details/Details.tsx.hbs +111 -0
- package/templates/react/Dialog/Dialog.css.hbs +28 -0
- package/templates/react/Dialog/Dialog.jsx.hbs +115 -0
- package/templates/react/Dialog/Dialog.test.jsx.hbs +29 -0
- package/templates/react/Dialog/Dialog.test.tsx.hbs +14 -0
- package/templates/react/Dialog/Dialog.tsx.hbs +165 -0
- package/templates/react/Divider/Divider.css.hbs +21 -0
- package/templates/react/Divider/Divider.jsx.hbs +24 -0
- package/templates/react/Divider/Divider.test.jsx.hbs +16 -0
- package/templates/react/Divider/Divider.test.tsx.hbs +14 -0
- package/templates/react/Divider/Divider.tsx.hbs +24 -0
- package/templates/react/Drawer/Drawer.css.hbs +28 -0
- package/templates/react/Drawer/Drawer.jsx.hbs +75 -0
- package/templates/react/Drawer/Drawer.test.jsx.hbs +27 -0
- package/templates/react/Drawer/Drawer.test.tsx.hbs +14 -0
- package/templates/react/Drawer/Drawer.tsx.hbs +99 -0
- package/templates/react/Dropdown/Dropdown.css.hbs +20 -0
- package/templates/react/Dropdown/Dropdown.jsx.hbs +78 -0
- package/templates/react/Dropdown/Dropdown.test.jsx.hbs +18 -0
- package/templates/react/Dropdown/Dropdown.test.tsx.hbs +14 -0
- package/templates/react/Dropdown/Dropdown.tsx.hbs +104 -0
- package/templates/react/DropdownItem/DropdownItem.css.hbs +23 -0
- package/templates/react/DropdownItem/DropdownItem.jsx.hbs +41 -0
- package/templates/react/DropdownItem/DropdownItem.test.jsx.hbs +18 -0
- package/templates/react/DropdownItem/DropdownItem.test.tsx.hbs +14 -0
- package/templates/react/DropdownItem/DropdownItem.tsx.hbs +56 -0
- package/templates/react/FormatBytes/FormatBytes.css.hbs +18 -0
- package/templates/react/FormatBytes/FormatBytes.jsx.hbs +25 -0
- package/templates/react/FormatBytes/FormatBytes.test.jsx.hbs +16 -0
- package/templates/react/FormatBytes/FormatBytes.test.tsx.hbs +14 -0
- package/templates/react/FormatBytes/FormatBytes.tsx.hbs +27 -0
- package/templates/react/FormatDate/FormatDate.css.hbs +18 -0
- package/templates/react/FormatDate/FormatDate.jsx.hbs +18 -0
- package/templates/react/FormatDate/FormatDate.test.jsx.hbs +11 -0
- package/templates/react/FormatDate/FormatDate.test.tsx.hbs +14 -0
- package/templates/react/FormatDate/FormatDate.tsx.hbs +45 -0
- package/templates/react/FormatNumber/FormatNumber.css.hbs +18 -0
- package/templates/react/FormatNumber/FormatNumber.jsx.hbs +18 -0
- package/templates/react/FormatNumber/FormatNumber.test.jsx.hbs +16 -0
- package/templates/react/FormatNumber/FormatNumber.test.tsx.hbs +14 -0
- package/templates/react/FormatNumber/FormatNumber.tsx.hbs +41 -0
- package/templates/react/Icon/Icon.css.hbs +22 -0
- package/templates/react/Icon/Icon.jsx.hbs +83 -0
- package/templates/react/Icon/Icon.test.jsx.hbs +35 -0
- package/templates/react/Icon/Icon.test.tsx.hbs +14 -0
- package/templates/react/Icon/Icon.tsx.hbs +93 -0
- package/templates/react/Include/Include.css.hbs +18 -0
- package/templates/react/Include/Include.jsx.hbs +40 -0
- package/templates/react/Include/Include.test.jsx.hbs +16 -0
- package/templates/react/Include/Include.test.tsx.hbs +14 -0
- package/templates/react/Include/Include.tsx.hbs +53 -0
- package/templates/react/Input/Input.css.hbs +25 -0
- package/templates/react/Input/Input.jsx.hbs +126 -0
- package/templates/react/Input/Input.test.jsx.hbs +23 -0
- package/templates/react/Input/Input.test.tsx.hbs +14 -0
- package/templates/react/Input/Input.tsx.hbs +154 -0
- package/templates/react/IntersectionObserver/IntersectionObserver.css.hbs +18 -0
- package/templates/react/IntersectionObserver/IntersectionObserver.jsx.hbs +38 -0
- package/templates/react/IntersectionObserver/IntersectionObserver.test.jsx.hbs +15 -0
- package/templates/react/IntersectionObserver/IntersectionObserver.test.tsx.hbs +14 -0
- package/templates/react/IntersectionObserver/IntersectionObserver.tsx.hbs +55 -0
- package/templates/react/MutationObserver/MutationObserver.css.hbs +18 -0
- package/templates/react/MutationObserver/MutationObserver.jsx.hbs +38 -0
- package/templates/react/MutationObserver/MutationObserver.test.jsx.hbs +15 -0
- package/templates/react/MutationObserver/MutationObserver.test.tsx.hbs +14 -0
- package/templates/react/MutationObserver/MutationObserver.tsx.hbs +55 -0
- package/templates/react/Option/Option.css.hbs +21 -0
- package/templates/react/Option/Option.jsx.hbs +20 -0
- package/templates/react/Option/Option.test.jsx.hbs +11 -0
- package/templates/react/Option/Option.test.tsx.hbs +14 -0
- package/templates/react/Option/Option.tsx.hbs +27 -0
- package/templates/react/Popover/Popover.css.hbs +25 -0
- package/templates/react/Popover/Popover.jsx.hbs +68 -0
- package/templates/react/Popover/Popover.test.jsx.hbs +18 -0
- package/templates/react/Popover/Popover.test.tsx.hbs +14 -0
- package/templates/react/Popover/Popover.tsx.hbs +101 -0
- package/templates/react/Popup/Popup.css.hbs +25 -0
- package/templates/react/Popup/Popup.jsx.hbs +45 -0
- package/templates/react/Popup/Popup.test.jsx.hbs +17 -0
- package/templates/react/Popup/Popup.test.tsx.hbs +14 -0
- package/templates/react/Popup/Popup.tsx.hbs +83 -0
- package/templates/react/ProgressBar/ProgressBar.css.hbs +22 -0
- package/templates/react/ProgressBar/ProgressBar.jsx.hbs +20 -0
- package/templates/react/ProgressBar/ProgressBar.test.jsx.hbs +16 -0
- package/templates/react/ProgressBar/ProgressBar.test.tsx.hbs +14 -0
- package/templates/react/ProgressBar/ProgressBar.tsx.hbs +29 -0
- package/templates/react/ProgressRing/ProgressRing.css.hbs +26 -0
- package/templates/react/ProgressRing/ProgressRing.jsx.hbs +20 -0
- package/templates/react/ProgressRing/ProgressRing.test.jsx.hbs +16 -0
- package/templates/react/ProgressRing/ProgressRing.test.tsx.hbs +14 -0
- package/templates/react/ProgressRing/ProgressRing.tsx.hbs +27 -0
- package/templates/react/QrCode/QrCode.css.hbs +18 -0
- package/templates/react/QrCode/QrCode.jsx.hbs +18 -0
- package/templates/react/QrCode/QrCode.test.jsx.hbs +11 -0
- package/templates/react/QrCode/QrCode.test.tsx.hbs +14 -0
- package/templates/react/QrCode/QrCode.tsx.hbs +35 -0
- package/templates/react/Radio/Radio.css.hbs +21 -0
- package/templates/react/Radio/Radio.jsx.hbs +20 -0
- package/templates/react/Radio/Radio.test.jsx.hbs +11 -0
- package/templates/react/Radio/Radio.test.tsx.hbs +14 -0
- package/templates/react/Radio/Radio.tsx.hbs +31 -0
- package/templates/react/RadioGroup/RadioGroup.css.hbs +22 -0
- package/templates/react/RadioGroup/RadioGroup.jsx.hbs +49 -0
- package/templates/react/RadioGroup/RadioGroup.test.jsx.hbs +17 -0
- package/templates/react/RadioGroup/RadioGroup.test.tsx.hbs +14 -0
- package/templates/react/RadioGroup/RadioGroup.tsx.hbs +79 -0
- package/templates/react/Rating/Rating.css.hbs +20 -0
- package/templates/react/Rating/Rating.jsx.hbs +48 -0
- package/templates/react/Rating/Rating.test.jsx.hbs +18 -0
- package/templates/react/Rating/Rating.test.tsx.hbs +14 -0
- package/templates/react/Rating/Rating.tsx.hbs +78 -0
- package/templates/react/RelativeTime/RelativeTime.css.hbs +18 -0
- package/templates/react/RelativeTime/RelativeTime.jsx.hbs +18 -0
- package/templates/react/RelativeTime/RelativeTime.test.jsx.hbs +11 -0
- package/templates/react/RelativeTime/RelativeTime.test.tsx.hbs +14 -0
- package/templates/react/RelativeTime/RelativeTime.tsx.hbs +29 -0
- package/templates/react/ResizeObserver/ResizeObserver.css.hbs +18 -0
- package/templates/react/ResizeObserver/ResizeObserver.jsx.hbs +38 -0
- package/templates/react/ResizeObserver/ResizeObserver.test.jsx.hbs +15 -0
- package/templates/react/ResizeObserver/ResizeObserver.test.tsx.hbs +14 -0
- package/templates/react/ResizeObserver/ResizeObserver.tsx.hbs +45 -0
- package/templates/react/Scroller/Scroller.css.hbs +19 -0
- package/templates/react/Scroller/Scroller.jsx.hbs +20 -0
- package/templates/react/Scroller/Scroller.test.jsx.hbs +11 -0
- package/templates/react/Scroller/Scroller.test.tsx.hbs +14 -0
- package/templates/react/Scroller/Scroller.tsx.hbs +29 -0
- package/templates/react/Select/Select.css.hbs +32 -0
- package/templates/react/Select/Select.jsx.hbs +79 -0
- package/templates/react/Select/Select.test.jsx.hbs +20 -0
- package/templates/react/Select/Select.test.tsx.hbs +14 -0
- package/templates/react/Select/Select.tsx.hbs +140 -0
- package/templates/react/Skeleton/Skeleton.css.hbs +19 -0
- package/templates/react/Skeleton/Skeleton.jsx.hbs +18 -0
- package/templates/react/Skeleton/Skeleton.test.jsx.hbs +11 -0
- package/templates/react/Skeleton/Skeleton.test.tsx.hbs +14 -0
- package/templates/react/Skeleton/Skeleton.tsx.hbs +23 -0
- package/templates/react/Slider/Slider.css.hbs +26 -0
- package/templates/react/Slider/Slider.jsx.hbs +50 -0
- package/templates/react/Slider/Slider.test.jsx.hbs +19 -0
- package/templates/react/Slider/Slider.test.tsx.hbs +14 -0
- package/templates/react/Slider/Slider.tsx.hbs +100 -0
- package/templates/react/Spinner/Spinner.css.hbs +21 -0
- package/templates/react/Spinner/Spinner.jsx.hbs +18 -0
- package/templates/react/Spinner/Spinner.test.jsx.hbs +11 -0
- package/templates/react/Spinner/Spinner.test.tsx.hbs +14 -0
- package/templates/react/Spinner/Spinner.tsx.hbs +20 -0
- package/templates/react/SplitPanel/SplitPanel.css.hbs +24 -0
- package/templates/react/SplitPanel/SplitPanel.jsx.hbs +38 -0
- package/templates/react/SplitPanel/SplitPanel.test.jsx.hbs +16 -0
- package/templates/react/SplitPanel/SplitPanel.test.tsx.hbs +14 -0
- package/templates/react/SplitPanel/SplitPanel.tsx.hbs +55 -0
- package/templates/react/Switch/Switch.css.hbs +24 -0
- package/templates/react/Switch/Switch.jsx.hbs +51 -0
- package/templates/react/Switch/Switch.test.jsx.hbs +19 -0
- package/templates/react/Switch/Switch.test.tsx.hbs +14 -0
- package/templates/react/Switch/Switch.tsx.hbs +83 -0
- package/templates/react/Tab/Tab.css.hbs +18 -0
- package/templates/react/Tab/Tab.jsx.hbs +20 -0
- package/templates/react/Tab/Tab.test.jsx.hbs +11 -0
- package/templates/react/Tab/Tab.test.tsx.hbs +14 -0
- package/templates/react/Tab/Tab.tsx.hbs +27 -0
- package/templates/react/TabGroup/TabGroup.css.hbs +27 -0
- package/templates/react/TabGroup/TabGroup.jsx.hbs +42 -0
- package/templates/react/TabGroup/TabGroup.test.jsx.hbs +11 -0
- package/templates/react/TabGroup/TabGroup.test.tsx.hbs +14 -0
- package/templates/react/TabGroup/TabGroup.tsx.hbs +57 -0
- package/templates/react/TabPanel/TabPanel.css.hbs +18 -0
- package/templates/react/TabPanel/TabPanel.jsx.hbs +20 -0
- package/templates/react/TabPanel/TabPanel.test.jsx.hbs +11 -0
- package/templates/react/TabPanel/TabPanel.test.tsx.hbs +14 -0
- package/templates/react/TabPanel/TabPanel.tsx.hbs +27 -0
- package/templates/react/Tag/Tag.css.hbs +21 -0
- package/templates/react/Tag/Tag.jsx.hbs +41 -0
- package/templates/react/Tag/Tag.test.jsx.hbs +11 -0
- package/templates/react/Tag/Tag.test.tsx.hbs +14 -0
- package/templates/react/Tag/Tag.tsx.hbs +60 -0
- package/templates/react/Textarea/Textarea.css.hbs +22 -0
- package/templates/react/Textarea/Textarea.jsx.hbs +58 -0
- package/templates/react/Textarea/Textarea.test.jsx.hbs +11 -0
- package/templates/react/Textarea/Textarea.test.tsx.hbs +14 -0
- package/templates/react/Textarea/Textarea.tsx.hbs +114 -0
- package/templates/react/Tooltip/Tooltip.css.hbs +21 -0
- package/templates/react/Tooltip/Tooltip.jsx.hbs +63 -0
- package/templates/react/Tooltip/Tooltip.test.jsx.hbs +15 -0
- package/templates/react/Tooltip/Tooltip.test.tsx.hbs +14 -0
- package/templates/react/Tooltip/Tooltip.tsx.hbs +104 -0
- package/templates/react/Tree/Tree.css.hbs +22 -0
- package/templates/react/Tree/Tree.jsx.hbs +41 -0
- package/templates/react/Tree/Tree.test.jsx.hbs +11 -0
- package/templates/react/Tree/Tree.test.tsx.hbs +14 -0
- package/templates/react/Tree/Tree.tsx.hbs +52 -0
- package/templates/react/TreeItem/TreeItem.css.hbs +32 -0
- package/templates/react/TreeItem/TreeItem.jsx.hbs +57 -0
- package/templates/react/TreeItem/TreeItem.test.jsx.hbs +11 -0
- package/templates/react/TreeItem/TreeItem.test.tsx.hbs +14 -0
- package/templates/react/TreeItem/TreeItem.tsx.hbs +87 -0
- package/templates/react/ZoomableFrame/ZoomableFrame.css.hbs +21 -0
- package/templates/react/ZoomableFrame/ZoomableFrame.jsx.hbs +52 -0
- package/templates/react/ZoomableFrame/ZoomableFrame.test.jsx.hbs +11 -0
- package/templates/react/ZoomableFrame/ZoomableFrame.test.tsx.hbs +14 -0
- package/templates/react/ZoomableFrame/ZoomableFrame.tsx.hbs +92 -0
- package/templates/react/vite-env.d.ts.hbs +21 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
output.log("[DEBUG] No vite.config found, skipping");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
31
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
32
|
+
output.log("[DEBUG] Path aliases already configured in vite.config");
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
36
|
+
const lastImportMatch = content.match(/(import .+;)\n*(?!import)/s);
|
|
37
|
+
if (lastImportMatch) {
|
|
38
|
+
content = content.replace(
|
|
39
|
+
lastImportMatch[1],
|
|
40
|
+
`${lastImportMatch[1]}
|
|
41
|
+
import path from 'path';`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const configMatch = content.match(
|
|
46
|
+
/export default defineConfig\(\{([^}]*?)\}\)/s
|
|
47
|
+
);
|
|
48
|
+
if (!configMatch) {
|
|
49
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const configContent = configMatch[1];
|
|
53
|
+
const hasResolve = configContent.includes("resolve:");
|
|
54
|
+
if (hasResolve) {
|
|
55
|
+
output.log("[DEBUG] resolve config exists, skipping");
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const resolveConfig = `
|
|
59
|
+
resolve: {
|
|
60
|
+
alias: {
|
|
61
|
+
'@': path.resolve(__dirname, './src'),
|
|
62
|
+
},
|
|
63
|
+
},`;
|
|
64
|
+
content = content.replace(
|
|
65
|
+
/export default defineConfig\(\{/,
|
|
66
|
+
`export default defineConfig({${resolveConfig}`
|
|
67
|
+
);
|
|
68
|
+
await fs2.writeFile(configPath, content);
|
|
69
|
+
output.log("[DEBUG] \u2713 vite.config updated with path aliases");
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
async function configureTSConfigPathAliases(cwd, output) {
|
|
73
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
74
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
75
|
+
output.log("[DEBUG] No tsconfig.app.json found, skipping");
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
79
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
80
|
+
output.log("[DEBUG] Path aliases already in tsconfig.app.json");
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
84
|
+
tsconfig.compilerOptions.baseUrl = ".";
|
|
85
|
+
tsconfig.compilerOptions.paths = {
|
|
86
|
+
"@/*": ["./src/*"]
|
|
87
|
+
};
|
|
88
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
89
|
+
output.log("[DEBUG] \u2713 tsconfig.app.json updated with path aliases");
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
configureTSConfigPathAliases,
|
|
94
|
+
configureVitePathAliases
|
|
95
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
30
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
34
|
+
const lines = content.split("\n");
|
|
35
|
+
let lastImportIndex = -1;
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
if (lines[i].trim().startsWith("import ")) {
|
|
38
|
+
lastImportIndex = i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (lastImportIndex >= 0) {
|
|
42
|
+
lines.splice(lastImportIndex + 1, 0, "import path from 'path';");
|
|
43
|
+
content = lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (content.includes("resolve:")) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const resolveConfig = `
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': path.resolve(__dirname, './src'),
|
|
53
|
+
},
|
|
54
|
+
},`;
|
|
55
|
+
const defineConfigMatch = content.match(/export default defineConfig\(\{/);
|
|
56
|
+
if (!defineConfigMatch) {
|
|
57
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
content = content.replace(
|
|
61
|
+
/export default defineConfig\(\{/,
|
|
62
|
+
`export default defineConfig({${resolveConfig}`
|
|
63
|
+
);
|
|
64
|
+
await fs2.writeFile(configPath, content);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
async function configureTSConfigPathAliases(cwd, _output) {
|
|
68
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
69
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
73
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
77
|
+
tsconfig.compilerOptions.baseUrl = tsconfig.compilerOptions.baseUrl || ".";
|
|
78
|
+
tsconfig.compilerOptions.paths = {
|
|
79
|
+
...tsconfig.compilerOptions.paths,
|
|
80
|
+
// Preserve existing paths
|
|
81
|
+
"@/*": ["./src/*"]
|
|
82
|
+
};
|
|
83
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
configureTSConfigPathAliases,
|
|
88
|
+
configureVitePathAliases
|
|
89
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
output.log("[DEBUG] No vite.config found, skipping");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
31
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
32
|
+
output.log("[DEBUG] Path aliases already configured in vite.config");
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
36
|
+
const lines = content.split("\n");
|
|
37
|
+
let lastImportIndex = -1;
|
|
38
|
+
for (let i = 0; i < lines.length; i++) {
|
|
39
|
+
if (lines[i].trim().startsWith("import ")) {
|
|
40
|
+
lastImportIndex = i;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (lastImportIndex >= 0) {
|
|
44
|
+
lines.splice(lastImportIndex + 1, 0, "import path from 'path';");
|
|
45
|
+
content = lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const configMatch = content.match(
|
|
49
|
+
/export default defineConfig\(\{([^}]*?)\}\)/s
|
|
50
|
+
);
|
|
51
|
+
if (!configMatch) {
|
|
52
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const configContent = configMatch[1];
|
|
56
|
+
const hasResolve = configContent.includes("resolve:");
|
|
57
|
+
if (hasResolve) {
|
|
58
|
+
output.log("[DEBUG] resolve config exists, skipping");
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const resolveConfig = `
|
|
62
|
+
resolve: {
|
|
63
|
+
alias: {
|
|
64
|
+
'@': path.resolve(__dirname, './src'),
|
|
65
|
+
},
|
|
66
|
+
},`;
|
|
67
|
+
content = content.replace(
|
|
68
|
+
/export default defineConfig\(\{/,
|
|
69
|
+
`export default defineConfig({${resolveConfig}`
|
|
70
|
+
);
|
|
71
|
+
await fs2.writeFile(configPath, content);
|
|
72
|
+
output.log("[DEBUG] \u2713 vite.config updated with path aliases");
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
async function configureTSConfigPathAliases(cwd, output) {
|
|
76
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
77
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
78
|
+
output.log("[DEBUG] No tsconfig.app.json found, skipping");
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
82
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
83
|
+
output.log("[DEBUG] Path aliases already in tsconfig.app.json");
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
87
|
+
tsconfig.compilerOptions.baseUrl = ".";
|
|
88
|
+
tsconfig.compilerOptions.paths = {
|
|
89
|
+
"@/*": ["./src/*"]
|
|
90
|
+
};
|
|
91
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
92
|
+
output.log("[DEBUG] \u2713 tsconfig.app.json updated with path aliases");
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
configureTSConfigPathAliases,
|
|
97
|
+
configureVitePathAliases
|
|
98
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
output.log("[DEBUG] No vite.config found, skipping");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
31
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
32
|
+
output.log("[DEBUG] Path aliases already configured in vite.config");
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
36
|
+
content = content.replace(
|
|
37
|
+
/(import .+ from ['"]vite['"][^;]*;)/,
|
|
38
|
+
"$1\nimport path from 'path';"
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const configMatch = content.match(
|
|
42
|
+
/export default defineConfig\(\{([^}]*?)\}\)/s
|
|
43
|
+
);
|
|
44
|
+
if (!configMatch) {
|
|
45
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const configContent = configMatch[1];
|
|
49
|
+
const hasResolve = configContent.includes("resolve:");
|
|
50
|
+
if (hasResolve) {
|
|
51
|
+
output.log("[DEBUG] resolve config exists, skipping");
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const resolveConfig = `
|
|
55
|
+
resolve: {
|
|
56
|
+
alias: {
|
|
57
|
+
'@': path.resolve(__dirname, './src'),
|
|
58
|
+
},
|
|
59
|
+
},`;
|
|
60
|
+
content = content.replace(
|
|
61
|
+
/export default defineConfig\(\{/,
|
|
62
|
+
`export default defineConfig({${resolveConfig}`
|
|
63
|
+
);
|
|
64
|
+
await fs2.writeFile(configPath, content);
|
|
65
|
+
output.log("[DEBUG] \u2713 vite.config updated with path aliases");
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
async function configureTSConfigPathAliases(cwd, output) {
|
|
69
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
70
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
71
|
+
output.log("[DEBUG] No tsconfig.app.json found, skipping");
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
75
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
76
|
+
output.log("[DEBUG] Path aliases already in tsconfig.app.json");
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
80
|
+
tsconfig.compilerOptions.baseUrl = ".";
|
|
81
|
+
tsconfig.compilerOptions.paths = {
|
|
82
|
+
"@/*": ["./src/*"]
|
|
83
|
+
};
|
|
84
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
85
|
+
output.log("[DEBUG] \u2713 tsconfig.app.json updated with path aliases");
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
configureTSConfigPathAliases,
|
|
90
|
+
configureVitePathAliases
|
|
91
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
30
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
34
|
+
const lines = content.split("\n");
|
|
35
|
+
let lastImportIndex = -1;
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
if (lines[i].trim().startsWith("import ")) {
|
|
38
|
+
lastImportIndex = i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (lastImportIndex >= 0) {
|
|
42
|
+
lines.splice(lastImportIndex + 1, 0, "import path from 'path';");
|
|
43
|
+
content = lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (content.includes("resolve:")) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const resolveConfig = `
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': path.resolve(__dirname, './src'),
|
|
53
|
+
},
|
|
54
|
+
},`;
|
|
55
|
+
const defineConfigMatch = content.match(/export default defineConfig\(\{/);
|
|
56
|
+
if (!defineConfigMatch) {
|
|
57
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
content = content.replace(
|
|
61
|
+
/export default defineConfig\(\{/,
|
|
62
|
+
`export default defineConfig({${resolveConfig}`
|
|
63
|
+
);
|
|
64
|
+
await fs2.writeFile(configPath, content);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
async function configureTSConfigPathAliases(cwd, _output) {
|
|
68
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
69
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
73
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
77
|
+
tsconfig.compilerOptions.baseUrl = tsconfig.compilerOptions.baseUrl || ".";
|
|
78
|
+
tsconfig.compilerOptions.paths = {
|
|
79
|
+
...tsconfig.compilerOptions.paths,
|
|
80
|
+
// Preserve existing paths
|
|
81
|
+
"@/*": ["./src/*"]
|
|
82
|
+
};
|
|
83
|
+
if (Array.isArray(tsconfig.compilerOptions.types) && tsconfig.compilerOptions.types.length === 1 && tsconfig.compilerOptions.types[0] === "vite/client") {
|
|
84
|
+
delete tsconfig.compilerOptions.types;
|
|
85
|
+
}
|
|
86
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
configureTSConfigPathAliases,
|
|
91
|
+
configureVitePathAliases
|
|
92
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/utils/path-aliases.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/path-aliases.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
output.log("[DEBUG] No vite.config found, skipping");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
31
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
32
|
+
output.log("[DEBUG] Path aliases already configured in vite.config");
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
36
|
+
const lines = content.split("\n");
|
|
37
|
+
let lastImportIndex = -1;
|
|
38
|
+
for (let i = 0; i < lines.length; i++) {
|
|
39
|
+
if (lines[i].trim().startsWith("import ")) {
|
|
40
|
+
lastImportIndex = i;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (lastImportIndex >= 0) {
|
|
44
|
+
lines.splice(lastImportIndex + 1, 0, "import path from 'path';");
|
|
45
|
+
content = lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (content.includes("resolve:")) {
|
|
49
|
+
output.log("[DEBUG] resolve config exists, skipping");
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const resolveConfig = `
|
|
53
|
+
resolve: {
|
|
54
|
+
alias: {
|
|
55
|
+
'@': path.resolve(__dirname, './src'),
|
|
56
|
+
},
|
|
57
|
+
},`;
|
|
58
|
+
const defineConfigMatch = content.match(/export default defineConfig\(\{/);
|
|
59
|
+
if (!defineConfigMatch) {
|
|
60
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
content = content.replace(
|
|
64
|
+
/export default defineConfig\(\{/,
|
|
65
|
+
`export default defineConfig({${resolveConfig}`
|
|
66
|
+
);
|
|
67
|
+
await fs2.writeFile(configPath, content);
|
|
68
|
+
output.log("[DEBUG] \u2713 vite.config updated with path aliases");
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
async function configureTSConfigPathAliases(cwd, output) {
|
|
72
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
73
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
74
|
+
output.log("[DEBUG] No tsconfig.app.json found, skipping");
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
78
|
+
if (tsconfig.compilerOptions?.paths?.["@/*"]) {
|
|
79
|
+
output.log("[DEBUG] Path aliases already in tsconfig.app.json");
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
83
|
+
tsconfig.compilerOptions.baseUrl = ".";
|
|
84
|
+
tsconfig.compilerOptions.paths = {
|
|
85
|
+
"@/*": ["./src/*"]
|
|
86
|
+
};
|
|
87
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
88
|
+
output.log("[DEBUG] \u2713 tsconfig.app.json updated with path aliases");
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
configureTSConfigPathAliases,
|
|
93
|
+
configureVitePathAliases
|
|
94
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// src/utils/project-config.ts
|
|
2
|
+
import fs2 from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/json.ts
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
async function readJSONWithComments(filePath) {
|
|
8
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
9
|
+
const stripped = stripJSONComments(content);
|
|
10
|
+
return JSON.parse(stripped);
|
|
11
|
+
}
|
|
12
|
+
function stripJSONComments(content) {
|
|
13
|
+
return content.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/utils/project-config.ts
|
|
17
|
+
async function configureVitePathAliases(cwd, output) {
|
|
18
|
+
const viteConfigTs = path.join(cwd, "vite.config.ts");
|
|
19
|
+
const viteConfigJs = path.join(cwd, "vite.config.js");
|
|
20
|
+
let configPath = null;
|
|
21
|
+
if (await fs2.pathExists(viteConfigTs)) {
|
|
22
|
+
configPath = viteConfigTs;
|
|
23
|
+
} else if (await fs2.pathExists(viteConfigJs)) {
|
|
24
|
+
configPath = viteConfigJs;
|
|
25
|
+
}
|
|
26
|
+
if (!configPath) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
let content = await fs2.readFile(configPath, "utf-8");
|
|
30
|
+
if (content.includes("alias:") && content.includes("'@'")) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (!content.includes("import path from 'path'") && !content.includes('import path from "path"')) {
|
|
34
|
+
const lines = content.split("\n");
|
|
35
|
+
let lastImportIndex = -1;
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
if (lines[i].trim().startsWith("import ")) {
|
|
38
|
+
lastImportIndex = i;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (lastImportIndex >= 0) {
|
|
42
|
+
lines.splice(lastImportIndex + 1, 0, "import path from 'path';");
|
|
43
|
+
content = lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (content.includes("resolve:")) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const resolveConfig = `
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: {
|
|
52
|
+
'@': path.resolve(__dirname, './src'),
|
|
53
|
+
},
|
|
54
|
+
},`;
|
|
55
|
+
const defineConfigMatch = content.match(/export default defineConfig\(\{/);
|
|
56
|
+
if (!defineConfigMatch) {
|
|
57
|
+
output.warn("Could not parse vite.config, skipping path alias config");
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
content = content.replace(
|
|
61
|
+
/export default defineConfig\(\{/,
|
|
62
|
+
`export default defineConfig({${resolveConfig}`
|
|
63
|
+
);
|
|
64
|
+
await fs2.writeFile(configPath, content);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
async function configureTSConfig(cwd, _output) {
|
|
68
|
+
const tsconfigAppPath = path.join(cwd, "tsconfig.app.json");
|
|
69
|
+
if (!await fs2.pathExists(tsconfigAppPath)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const tsconfig = await readJSONWithComments(tsconfigAppPath);
|
|
73
|
+
let modified = false;
|
|
74
|
+
tsconfig.compilerOptions = tsconfig.compilerOptions || {};
|
|
75
|
+
if (!tsconfig.compilerOptions.paths?.["@/*"]) {
|
|
76
|
+
tsconfig.compilerOptions.baseUrl = tsconfig.compilerOptions.baseUrl || ".";
|
|
77
|
+
tsconfig.compilerOptions.paths = {
|
|
78
|
+
...tsconfig.compilerOptions.paths,
|
|
79
|
+
"@/*": ["./src/*"]
|
|
80
|
+
};
|
|
81
|
+
modified = true;
|
|
82
|
+
}
|
|
83
|
+
if (tsconfig.compilerOptions.esModuleInterop !== true) {
|
|
84
|
+
tsconfig.compilerOptions.esModuleInterop = true;
|
|
85
|
+
modified = true;
|
|
86
|
+
}
|
|
87
|
+
if (tsconfig.compilerOptions.allowSyntheticDefaultImports !== true) {
|
|
88
|
+
tsconfig.compilerOptions.allowSyntheticDefaultImports = true;
|
|
89
|
+
modified = true;
|
|
90
|
+
}
|
|
91
|
+
if (tsconfig.compilerOptions.verbatimModuleSyntax === true) {
|
|
92
|
+
delete tsconfig.compilerOptions.verbatimModuleSyntax;
|
|
93
|
+
modified = true;
|
|
94
|
+
}
|
|
95
|
+
if (Array.isArray(tsconfig.compilerOptions.types)) {
|
|
96
|
+
if (tsconfig.compilerOptions.types.length === 1 && tsconfig.compilerOptions.types[0] === "vite/client") {
|
|
97
|
+
delete tsconfig.compilerOptions.types;
|
|
98
|
+
modified = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (tsconfig.compilerOptions.moduleResolution === "bundler" || tsconfig.compilerOptions.moduleResolution === "Bundler") {
|
|
102
|
+
} else if (!tsconfig.compilerOptions.moduleResolution) {
|
|
103
|
+
tsconfig.compilerOptions.moduleResolution = "bundler";
|
|
104
|
+
modified = true;
|
|
105
|
+
}
|
|
106
|
+
if (modified) {
|
|
107
|
+
await fs2.writeJSON(tsconfigAppPath, tsconfig, { spaces: 2 });
|
|
108
|
+
}
|
|
109
|
+
return modified;
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
configureTSConfig,
|
|
113
|
+
configureTSConfig as configureTSConfigPathAliases,
|
|
114
|
+
configureVitePathAliases
|
|
115
|
+
};
|