From Zero to One: Crafting My Custom Component Library

第一步:项目初始化与配置

首先我们需要创建项目并设置基本配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mkdir myui
cd myui

npm init -y

# 安装核心依赖
pnpm install react react-dom typescript @types/react @types/react-dom --save-dev

# 安装构建工具
pnpm install rollup @rollup/plugin-node-resolve @rollup/plugin-commonjs @rollup/plugin-typescript rollup-plugin-dts rollup-plugin-peer-deps-external --save-dev

# 安装测试工具
pnpm install jest @testing-library/react @testing-library/jest-dom @types/jest ts-jest --save-dev

# 安装 Storybook
npx storybook init

From Zero to One: Crafting My Custom Component Library
https://www.hardyhu.cn/2025/03/31/From-Zero-to-One-Crafting-My-Custom-Component-Library/
Author
John Doe
Posted on
March 31, 2025
Licensed under