-
Notifications
You must be signed in to change notification settings - Fork 115
Migrate tools #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Leioy
wants to merge
19
commits into
kubesphere:master
Choose a base branch
from
Leioy:migrate-tools
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Migrate tools #371
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cf752fb
feat: migrate to pnpm workspace
Leioy e0efb26
feat:unit test tool migrate to vitest,testing-library and add new docs
Leioy 15b48a3
fix: standardize peer dependencies and resolve TypeScript issues
Leioy 6e28ee4
fix: eslint errors
Leioy bcc2c12
chore: upgrade outdated dependencies to latest versions
Leioy 56362e2
feat: Refactor TypeScript configurations to separate type checking fr…
Leioy 249f898
feat: Add comprehensive test coverage for numerous components, update…
Leioy 029e741
docs: Update component and hook documentation, refactor icon usage, a…
Leioy c2f9119
chore: update ESLint configuration to ignore the docusaurus directory…
Leioy a8dbbc7
feat: Remove blog functionality, update site branding with new logos …
Leioy 6a4ff93
chore: update pnpm dependencies
Leioy 19673f7
chore: rename package name to docusaurus
Leioy 2fde3d3
chore: Change Docusaurus baseUrl from `/kube-design/` to `/`
Leioy be4ed71
fix: adjust dropdown menu CSS to resolve hover issues
Leioy 08ace4b
feat: add docsearch
Leioy 055d252
feat: Add ESM output for icons and migrate Storybook to Vite builder …
Leioy b74ea2e
feat: Update docs build/start scripts to reference docusaurus directo…
Leioy 9ec36a9
Merge branch 'master' of upstream into migrate-tools
Leioy 7afc7ee
chore: Update pnpm lockfile to reflect dependency changes
Leioy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ public | |
| .cache | ||
| .eslintrc.js | ||
| *.d.ts | ||
| docusaurus/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Update Algolia DocSearch Index | ||
|
|
||
| on: | ||
| # 1. Automatically triggered on push to main branch (most common) | ||
| push: | ||
| branches: | ||
| - main | ||
| - master # Add master branch if you use it | ||
|
|
||
| # 2. Manual trigger (important!) | ||
| workflow_dispatch: | ||
| # Optional: Add an input field for manually entering the site URL (remove these lines if not needed) | ||
| inputs: | ||
| site_url: | ||
| description: 'Site URL (defaults to start_urls from config)' | ||
| required: false | ||
| default: '' | ||
|
|
||
| jobs: | ||
| algolia: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Read docsearch.json configuration | ||
| id: algolia_config | ||
| run: | | ||
| CONFIG=$(cat docusaurus/algolia-crawler-config.json | jq -c .) | ||
| echo "config=$CONFIG" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Override start_urls in config if URL is manually entered (optional feature) | ||
| if: github.event.inputs.site_url != '' | ||
| run: | | ||
| NEW_CONFIG=$(jq --arg url "${{ github.event.inputs.site_url }}" \ | ||
| '.start_urls[0].url = $url' docsearch.json) | ||
| echo "$NEW_CONFIG" > docsearch.json.tmp | ||
| mv docsearch.json.tmp docsearch.json | ||
| echo "Replaced with manually entered URL: ${{ github.event.inputs.site_url }}" | ||
|
|
||
| - name: Run Algolia official crawler | ||
| env: | ||
| APPLICATION_ID: ${{ secrets.APPLICATION_ID }} # Your Application ID | ||
| API_KEY: ${{ secrets.API_KEY }} # Your Admin API Key (write permission) | ||
| CONFIG: ${{ steps.algolia_config.outputs.config }} | ||
| run: | | ||
| docker run --rm \ | ||
| --env APPLICATION_ID=${APPLICATION_ID} \ | ||
| --env API_KEY=${API_KEY} \ | ||
| --env "CONFIG=${CONFIG}" \ | ||
| algolia/docsearch-scraper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,4 +37,7 @@ docs/.next | |
| !docs/lib | ||
|
|
||
| # history | ||
| .history/ | ||
| .history/ | ||
|
|
||
| **/__snapshots__/ | ||
| coverage/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| shamefully-hoist=true | ||
| strict-peer-dependencies=false | ||
| auto-install-peers=true | ||
| node-linker=hoisted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| Kube Design is a comprehensive React component library originally built for KubeSphere Console, featuring components, hooks, and icons. The project uses a monorepo structure with multiple packages and documentation platforms. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Monorepo Structure | ||
| - **Packages**: Located in `/packages/` with individual build configurations | ||
| - **Documentation**: Multiple platforms (Next.js docs, Nextra, Astro) | ||
| - **Build System**: Custom TypeScript/Rollup-based build with ESM/CJS output | ||
| - **Testing**: Vitest with React Testing Library and jest-axe for accessibility | ||
|
|
||
| ### Key Packages | ||
| - `@kubed/components` - Main React component library (50+ components) | ||
| - `@kubed/icons` - Icon system with generation pipeline | ||
| - `@kubed/hooks` - React utility hooks | ||
| - `@kubed/charts` - Chart components | ||
| - `@kubed/code-editor` - Code editor component | ||
| - `@kubed/diff-viewer` - Diff viewer component | ||
| - `@kubed/log-viewer` - Log viewer component | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ### Core Commands | ||
| ```bash | ||
| # Install dependencies | ||
| pnpm install | ||
|
|
||
| # Build all packages | ||
| pnpm build:all | ||
|
|
||
| # Build specific package | ||
| pnpm build components | ||
|
|
||
| # Development with live reload | ||
| pnpm storybook # Storybook on port 7001 | ||
| pnpm start:docs # Next.js docs development | ||
|
|
||
| # Linting and Type Checking | ||
| pnpm lint # ESLint for all packages | ||
| pnpm typecheck # TypeScript checking | ||
| pnpm test # Run all tests + syncpack | ||
|
|
||
| # Testing | ||
| pnpm test:watch # Watch mode testing | ||
| pnpm test:coverage # Coverage reports | ||
| pnpm test:ui # Vitest UI interface | ||
| ``` | ||
|
|
||
| ### Package-Specific Commands | ||
| ```bash | ||
| # Build individual packages | ||
| pnpm build components # Build components package | ||
| pnpm build icons # Build icons package | ||
| pnpm build:docs # Build documentation | ||
|
|
||
| # Generate documentation | ||
| pnpm docs:docgen # Auto-generate component docs | ||
| ``` | ||
|
|
||
| ## Build System | ||
|
|
||
| ### Build Configuration | ||
| - **Output Formats**: ESM (`esm/`), CJS (`cjs/`), TypeScript definitions (`lib/`) | ||
| - **Builder**: Custom TypeScript/Rollup configuration in `/scripts/` | ||
| - **Source**: Each package has `src/` → builds to `esm/` + `cjs/` + `lib/` | ||
|
|
||
| ### Build Options | ||
| ```bash | ||
| # Available build flags | ||
| --analyze # Generate bundle analysis | ||
| --sourcemap # Include source maps (default: true) | ||
| --minify # Minify UMD files (default: false) | ||
| --formats # Output formats: es, cjs (default: both) | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Test Setup | ||
| - **Framework**: Vitest with React Testing Library | ||
| - **Environment**: jsdom with styled-components support | ||
| - **Accessibility**: jest-axe for a11y testing | ||
| - **Coverage**: Reports in HTML, JSON, and text formats | ||
|
|
||
| ### Test Patterns | ||
| - Component tests: `*.test.tsx` alongside components | ||
| - Story files: `*.story.tsx` for Storybook | ||
| - Test utilities: `@kubed/tests` package with shared helpers | ||
|
|
||
| ### Running Tests | ||
| ```bash | ||
| # Single test file | ||
| vitest run Button.test.tsx | ||
|
|
||
| # Test with coverage for specific package | ||
| vitest run --coverage.include="packages/components/src/Button/**/*" | ||
|
|
||
| # Test specific pattern | ||
| vitest run Alert | ||
| ``` | ||
|
|
||
| ## Documentation Platforms | ||
|
|
||
| ### 1. Next.js Documentation (`/docs/`) | ||
| - **Tech**: Next.js 14 with MDX, i18n support | ||
| - **Run**: `pnpm start:docs` (port 3000) | ||
| - **Build**: `pnpm build:docs` | ||
|
|
||
| ### 2. Nextra Documentation (`/nextra/`) | ||
| - **Tech**: Next.js 15 with Nextra 4 | ||
| - **Run**: `pnpm dev` from /nextra directory | ||
| - **Features**: Pagefind search, Tailwind CSS | ||
|
|
||
| ### 3. Astro Documentation (`/astro/`) | ||
| - **Tech**: Astro with React components | ||
| - **Run**: `pnpm dev` from /astro directory | ||
|
|
||
| ## Package Development | ||
|
|
||
| ### Creating New Components | ||
| 1. Create component in `packages/components/src/[ComponentName]/` | ||
| 2. Add `.story.tsx` for Storybook | ||
| 3. Add `.test.tsx` for tests | ||
| 4. Export from `packages/components/src/index.ts` | ||
| 5. Run `pnpm build components` to build | ||
|
|
||
| ### Component Structure | ||
| ``` | ||
| ComponentName/ | ||
| ├── ComponentName.tsx # Main component | ||
| ├── ComponentName.styles.ts # Styled components | ||
| ├── ComponentName.story.tsx # Storybook story | ||
| ├── ComponentName.test.tsx # Component tests | ||
| └── index.ts # Re-export | ||
| ``` | ||
|
|
||
| ### Icon System | ||
| - **Source**: SVG files in `packages/icons/source/` | ||
| - **Generation**: `pnpm build icons` generates React components | ||
| - **Output**: Multiple icon sets (fill, duotone variants) | ||
|
|
||
| ## Tooling | ||
|
|
||
| ### Dependencies | ||
| - **Package Manager**: pnpm with workspace support | ||
| - **Styling**: styled-components with theme system | ||
| - **TypeScript**: Strict mode with ES2015 target | ||
| - **Linting**: ESLint with Airbnb config + TypeScript | ||
| - **Formatting**: Prettier | ||
|
|
||
| ### Configuration Files | ||
| - **TypeScript**: `tsconfig.base.json` (base), individual package configs | ||
| - **Build**: `scripts/utils/build-package.ts` (shared build logic) | ||
| - **Testing**: `vitest.config.ts` (test configuration) | ||
| - **Linting**: ESLint config at root level | ||
|
|
||
| ## Environment Setup | ||
|
|
||
| ### Node.js Requirements | ||
| - Node.js 16+ (recommended: latest LTS) | ||
| - pnpm 8+ (package manager) | ||
|
|
||
| ### IDE Integration | ||
| - TypeScript path mapping configured for `@kubed/*` packages | ||
| - Storybook for component development | ||
| - Vitest for test running | ||
|
|
||
| ## Common Development Flow | ||
|
|
||
| 1. **Start development**: `pnpm storybook` for component work | ||
| 2. **Create component**: Add to `packages/components/src/` | ||
| 3. **Test**: `pnpm test:watch` for TDD | ||
| 4. **Build**: `pnpm build [package]` to verify builds | ||
| 5. **Document**: Update MDX files in `/docs/` or `/nextra/` | ||
| 6. **Check**: `pnpm lint && pnpm typecheck` before commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
parserOptionsandrulesin these twooverridesblocks are identical. To improve maintainability and reduce duplication, you can merge them into a single block by combining thefilesarrays.