Skip to content

Commit 706ae5a

Browse files
committed
test
1 parent bf3f7ea commit 706ae5a

File tree

4 files changed

+61
-185
lines changed

4 files changed

+61
-185
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ jobs:
6464
- name: Serve Storybook and run all tests
6565
run: |
6666
npx serve -l 6006 storybook-static &
67-
sleep 5
68-
npm run test:all
67+
npx wait-on http://localhost:6006 --timeout 30000
68+
npm run test:all:ci
6969
working-directory: storybook
7070

7171
- name: Upload test results

CLAUDE.md

Lines changed: 42 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -2,203 +2,63 @@
22

33
## Quick Overview
44

5-
React component library for building Jupyter-compatible applications. Monorepo with Lerna managing 4 main packages and multiple examples.
5+
React component library for Jupyter notebooks. Monorepo with 4 packages managed by Lerna.
66

77
## Core Packages
88

9-
- `@datalayer/jupyter-react` - Main React components for notebooks, cells, terminals
10-
- `@datalayer/jupyter-lexical` - Rich text editor with Lexical framework integration
11-
- `@datalayer/jupyter-docusaurus-plugin` - Plugin for Docusaurus sites
12-
- `datalayer-jupyter-vscode` - VS Code extension for notebooks
9+
- `@datalayer/jupyter-react` - React components for notebooks, cells, terminals
10+
- `@datalayer/jupyter-lexical` - Rich text editor integration
11+
- `@datalayer/jupyter-docusaurus-plugin` - Docusaurus plugin
12+
- `datalayer-jupyter-vscode` - VS Code extension
1313

14-
## Key Commands
14+
## Essential Commands
1515

1616
```bash
17-
# Install dependencies
18-
npm install
19-
20-
# Build all packages
21-
npm run build
22-
23-
# Start Jupyter server (required for development)
24-
npm run jupyter:server
25-
26-
# Run specific examples
27-
npm run jupyter:ui:vite # Vite example
28-
npm run jupyter:ui:nextjs # Next.js example
29-
npm run jupyter:ui:lexical # Lexical editor example
30-
npm run jupyter:ui:docusaurus # Docusaurus example
31-
32-
# Run tests
33-
npm test
34-
npm run test:storybook # Test Storybook stories
35-
npm run test:mdx # Test MDX documentation
36-
npm run test:all # Run all tests
37-
38-
# Code quality
39-
npm run lint # Check for linting errors (quiet mode - errors only)
40-
npm run lint:fix # Auto-fix linting issues
41-
npm run format # Format code with Prettier
42-
npm run format:check # Check code formatting
43-
npm run type-check # TypeScript type checking
44-
45-
# Storybook
46-
npm run storybook
17+
npm install # Install dependencies
18+
npm run build # Build all packages
19+
npm run jupyter:server # Start Jupyter server (port 8686)
20+
npm run storybook # Start Storybook (port 6006)
21+
npm run lint # Check errors only (--quiet)
22+
npm run lint:fix # Auto-fix issues
23+
npm run format # Format code
24+
npm run type-check # TypeScript checking
25+
npm test # Run tests
4726
```
4827

49-
## Development Setup
28+
## Requirements
5029

51-
1. **Requirements**:
52-
- Node.js >= 20.0.0
53-
- npm (not yarn - the project uses npm workspaces)
54-
2. **Ports**:
55-
- Jupyter server: 8686
56-
- Frontend: 3208 (varies by example)
57-
- Storybook: 6006
30+
- Node.js >= 20.0.0 (use .nvmrc)
31+
- npm (not yarn)
32+
- Server token: `60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6`
5833

59-
3. **Server token**: `60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6`
34+
## Key Files
6035

61-
## Architecture Notes
36+
- `eslint.config.js` - ESLint v9 flat config
37+
- `.prettierrc.json` - Formatter config
38+
- `.prettierignore` - Excludes MDX files
39+
- `patches/` - Third-party fixes (auto-applied)
40+
- `packages/react/webpack.config.js` - Build config
6241

63-
- Components wrap JupyterLab functionality in React declarative API
64-
- Supports IPyWidgets, kernels, outputs, file browser
65-
- Server communication via ServiceManager
66-
- Uses Lumino widgets under the hood but exposes React interface
67-
- State management with Zustand
68-
- Real-time collaboration with Y.js
42+
## Recent Fixes (2024)
6943

70-
## Common Tasks
44+
- MDX comments: `{/_``{/** **/}` in 13 files
45+
- Node requirement: 18 → 20+
46+
- Webpack warnings: 7 → 2 (source-map exclusions)
47+
- @jupyterlite patch for missing logos
48+
- ESLint v9 flat config migration
49+
- React 18 deprecations fixed
7150

72-
### Adding Components
51+
## Common Issues
7352

74-
Create in `packages/react/src/components/`
53+
1. **Storybook errors**: Check MDX syntax, run `npx patch-package`
54+
2. **Node version**: Use Node 20+ (`nvm use`)
55+
3. **Lint errors**: Run `npm run lint:fix`
56+
4. **Build fails**: Run `npm run type-check`
7557

76-
### Testing Examples
58+
## AI Assistant Notes
7759

78-
Use `examples/` folders with various frameworks
79-
80-
### Documentation
81-
82-
Update in `docs/` (Docusaurus site)
83-
84-
### Storybook
85-
86-
Components showcased in `storybook/`
87-
88-
## Code Quality Configuration
89-
90-
### ESLint
91-
92-
- Uses ESLint v9 flat config (`eslint.config.js`)
93-
- TypeScript support with @typescript-eslint
94-
- React and React Hooks plugins
95-
- Ignores: `attic/`, `.docusaurus/`, `ipyreactive/`, `ipyscript/`
96-
97-
### Prettier
98-
99-
- Config: `.prettierrc.json`
100-
- Single quotes, trailing commas (all)
101-
- 80 character line width
102-
- LF line endings
103-
- Ignores `attic/` folder and `*.mdx` files (to prevent MDX comment corruption)
104-
105-
### Pre-commit Hooks
106-
107-
- Husky + lint-staged
108-
- Runs ESLint, Prettier, and TypeScript checks
109-
- Conventional commits with commitlint
110-
111-
## Important Files
112-
113-
- `lerna.json` - Monorepo configuration
114-
- `eslint.config.js` - ESLint flat config
115-
- `.prettierrc.json` - Prettier configuration
116-
- `.prettierignore` - Prettier exclusions (includes MDX files)
117-
- `.nvmrc` - Node version specification
118-
- `dev/config/jupyter_server_config.py` - Server settings
119-
- `packages/react/src/jupyter/JupyterContext.tsx` - Core context provider
120-
- `packages/react/src/state/JupyterReactState.ts` - Zustand store
121-
- `patches/` - Third-party module patches (applied via patch-package)
122-
123-
## CI/CD
124-
125-
### GitHub Actions Workflows
126-
127-
- `build.yml` - Main CI pipeline (build, test, visual tests)
128-
- `fix-license-header.yml` - Auto-fix license headers
129-
- `publish-dev.yml` - Publish dev versions
130-
131-
### Testing in CI
132-
133-
- Build verification
134-
- Storybook story testing
135-
- MDX documentation testing
136-
- Visual regression with Playwright
137-
- Docker container builds
138-
139-
## Recent Updates (2024)
140-
141-
### Configuration Modernization
142-
143-
- Migrated from `prettier.config.js` to `.prettierrc.json`
144-
- Updated ESLint to v9 flat config format
145-
- Removed deprecated `.eslintignore` in favor of ignores in config
146-
- Added `--quiet` flag to lint command (show errors only)
147-
- Updated Node.js requirement from 18 to 20+
148-
- Added .nvmrc file for Node version management
149-
150-
### Code Quality Fixes
151-
152-
- Fixed all React 18 deprecations (ReactDOM.render → createRoot)
153-
- Added missing key props in list iterations
154-
- Fixed optional chain assertions with proper null checks
155-
- Replaced `@ts-ignore` with `@ts-expect-error`
156-
- Fixed React Hook rules violations
157-
- Replaced `Function` types with proper signatures
158-
- Added security attributes to external links (`rel="noreferrer"`)
159-
160-
### Storybook MDX Fixes
161-
162-
- Fixed malformed MDX comments from `{/_` to `{/**`
163-
- Updated all 13 MDX story files to use proper JSX comment syntax
164-
- Added MDX files to .prettierignore to prevent comment corruption
165-
166-
### Build & CI Improvements
167-
168-
- Fixed webpack source map warnings by excluding problematic packages
169-
- Created patch for @jupyterlite/javascript-kernel-extension missing logo files
170-
- Updated GitHub Actions workflows to use Node 20
171-
- Added patch-package for third-party module fixes
172-
173-
## Troubleshooting
174-
175-
### Common Issues
176-
177-
1. **Build fails with TypeScript errors**
178-
- Run `npm run type-check` to identify issues
179-
- Check for unused `@ts-expect-error` directives
180-
181-
2. **Lint errors**
182-
- Run `npm run lint` to see only errors (not warnings)
183-
- Use `npm run lint:fix` for auto-fixable issues
184-
185-
3. **Server connection issues**
186-
- Ensure Jupyter server is running on port 8686
187-
- Check token in server config
188-
189-
4. **Storybook build errors**
190-
- Check MDX comment syntax (must be `{/** **/}`)
191-
- Verify patches are applied: `npx patch-package`
192-
- Missing logo files error fixed by @jupyterlite patch
193-
194-
5. **Node version issues**
195-
- Use Node 20+ (check with `node --version`)
196-
- Use .nvmrc file: `nvm use`
197-
198-
## Notes for AI Assistants
199-
200-
- The `attic/` folder contains archived/experimental code - do not modify
60+
- Never modify `attic/` folder
20161
- Always use npm, not yarn
202-
- Prefer editing existing files over creating new ones
203-
- Run lint and type checks before committing
204-
- Use conventional commit messages
62+
- Prefer editing over creating files
63+
- Run lint/type checks before committing
64+
- MDX files excluded from Prettier (comment corruption)

SUMMARY.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ The Lexical package supports plugins for:
362362
- **Prettier JSON Config**: Replaced CommonJS config with .prettierrc.json
363363
- **Line Endings**: Enforced LF line endings for cross-platform consistency
364364
- **Trailing Commas**: Added support for better TypeScript compatibility
365+
- **Node.js 20+**: Updated minimum requirement from Node 18 to Node 20
366+
- **NVM Support**: Added .nvmrc file for consistent Node version management
365367

366368
### Code Quality Fixes
367369

@@ -371,6 +373,19 @@ The Lexical package supports plugins for:
371373
- **Security**: Added rel="noreferrer" to external links
372374
- **Hook Rules**: Fixed conditional hook calls
373375

376+
### Storybook Fixes
377+
378+
- **MDX Comment Syntax**: Fixed malformed comments in 13 MDX files from `{/_` to `{/** **/}`
379+
- **Prettier Exclusion**: Added MDX files to .prettierignore to prevent comment corruption
380+
- **Missing Logo Files**: Created patch for @jupyterlite/javascript-kernel-extension to fix missing logo references
381+
382+
### Build & CI Improvements
383+
384+
- **Webpack Warnings**: Reduced source map warnings from 7 to 2 by excluding problematic packages
385+
- **Patch-Package**: Added automatic patching of third-party modules during npm install
386+
- **GitHub Actions**: Updated all workflows to use Node 20
387+
- **Build Stability**: Fixed CI build failures in Storybook
388+
374389
### Testing Infrastructure
375390

376391
- **Storybook Test Runner**: Automated testing for all component stories

storybook/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"test:storybook": "test-storybook",
2828
"test:storybook:ci": "test-storybook --ci --maxWorkers=2",
2929
"test:mdx": "node test-storybook.js",
30-
"test:all": "test-storybook --ci --maxWorkers=2 && node test-storybook.js"
30+
"test:all": "test-storybook --ci --maxWorkers=2 && node test-storybook.js",
31+
"test:all:ci": "test-storybook --ci --maxWorkers=2 --url http://localhost:6006 && node test-storybook.js"
3132
},
3233
"dependencies": {
3334
"@datalayer/jupyter-lexical": "^1.0.0",

0 commit comments

Comments
 (0)