|
2 | 2 |
|
3 | 3 | ## Quick Overview
|
4 | 4 |
|
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. |
6 | 6 |
|
7 | 7 | ## Core Packages
|
8 | 8 |
|
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 |
13 | 13 |
|
14 |
| -## Key Commands |
| 14 | +## Essential Commands |
15 | 15 |
|
16 | 16 | ```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 |
47 | 26 | ```
|
48 | 27 |
|
49 |
| -## Development Setup |
| 28 | +## Requirements |
50 | 29 |
|
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` |
58 | 33 |
|
59 |
| -3. **Server token**: `60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6` |
| 34 | +## Key Files |
60 | 35 |
|
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 |
62 | 41 |
|
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) |
69 | 43 |
|
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 |
71 | 50 |
|
72 |
| -### Adding Components |
| 51 | +## Common Issues |
73 | 52 |
|
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` |
75 | 57 |
|
76 |
| -### Testing Examples |
| 58 | +## AI Assistant Notes |
77 | 59 |
|
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 |
201 | 61 | - 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) |
0 commit comments