Skip to content

Commit 6ee29d3

Browse files
Update storybook to use latest version, update stories and add tests (#391)
* Update storybook to use latest version, update stories and add basic tests * test * test * test * Automatic application of license header --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 324225a commit 6ee29d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+779
-64
lines changed

.github/workflows/build.yml

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
shell: bash -l {0}
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929
- name: Setup conda
3030
uses: conda-incubator/setup-miniconda@v3
3131
with:
@@ -34,23 +34,19 @@ jobs:
3434
channel-priority: true
3535
environment-file: environment.yml
3636
activate-environment: datalayer
37-
- name: Get yarn cache directory path
38-
id: yarn-cache-dir-path
39-
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
40-
41-
- uses: actions/cache@v3
42-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
37+
- name: Setup npm cache
38+
uses: actions/cache@v4
4339
with:
44-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
45-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
40+
path: ~/.npm
41+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json', '**/package.json') }}
4642
restore-keys: |
47-
${{ runner.os }}-yarn-
43+
${{ runner.os }}-npm-
4844
- name: Install the npm dependencies
4945
run: |
50-
yarn install
46+
npm install
5147
- name: Run the build
5248
run: |
53-
yarn build
49+
npm run build
5450
5551
visual-test:
5652
runs-on: ubuntu-latest
@@ -65,7 +61,7 @@ jobs:
6561
uses: actions/checkout@v4
6662

6763
- name: Setup Node 💾
68-
uses: actions/setup-node@v3
64+
uses: actions/setup-node@v4
6965
with:
7066
node-version: '18'
7167
-
@@ -75,7 +71,7 @@ jobs:
7571
id: yarn-cache-dir-path
7672
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
7773
- name: Setup yarn cache
78-
uses: actions/cache@v3
74+
uses: actions/cache@v4
7975
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
8076
with:
8177
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -89,7 +85,7 @@ jobs:
8985
run: yarn install
9086

9187
- name: Set up browser cache
92-
uses: actions/cache@v3
88+
uses: actions/cache@v4
9389
with:
9490
path: |
9591
${{ github.workspace }}/pw-browsers
@@ -110,14 +106,66 @@ jobs:
110106
yarn run test:visual -u
111107
working-directory: packages/react
112108

113-
- uses: actions/upload-artifact@v3
109+
- uses: actions/upload-artifact@v4
114110
if: ${{ failure() }}
115111
with:
116112
name: jupyter-react-test
117113
path: |
118114
packages/react/test-assets/
119115
packages/react/stories/**/*-snapshots/*
120116
117+
storybook-test:
118+
name: Test Storybook Stories and Docs
119+
runs-on: ubuntu-latest
120+
timeout-minutes: 30
121+
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v4
125+
126+
- name: Setup Node
127+
uses: actions/setup-node@v4
128+
with:
129+
node-version: '18'
130+
131+
- name: Setup npm cache
132+
uses: actions/cache@v4
133+
with:
134+
path: ~/.npm
135+
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json', '**/package.json') }}
136+
restore-keys: |
137+
npm-${{ runner.os }}-
138+
139+
- name: Install Dependencies
140+
run: npm install
141+
142+
- name: Build all packages
143+
run: npm run build
144+
145+
- name: Install Playwright
146+
run: npx playwright install chromium --with-deps
147+
working-directory: storybook
148+
149+
- name: Build Storybook
150+
run: npm run build:storybook
151+
working-directory: storybook
152+
153+
- name: Serve Storybook and run all tests
154+
run: |
155+
npx serve -l 6006 storybook-static &
156+
sleep 5
157+
npm run test:all
158+
working-directory: storybook
159+
160+
- name: Upload test results
161+
if: failure()
162+
uses: actions/upload-artifact@v4
163+
with:
164+
name: storybook-test-results
165+
path: |
166+
storybook/test-results/
167+
storybook/html-report/
168+
121169
docker-dev:
122170
# Don't run if the previous case fails
123171
needs: build
@@ -158,7 +206,7 @@ jobs:
158206
type=semver,pattern={{major}}.{{minor}}
159207
-
160208
name: Build and push
161-
uses: docker/build-push-action@v5
209+
uses: docker/build-push-action@v6
162210
with:
163211
context: .
164212
file: ".devcontainer/Dockerfile"

.github/workflows/publish-dev.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828
-
2929
# Setup .npmrc file to publish to GitHub Packages
30-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3131
with:
3232
node-version: '20.x'
3333
registry-url: 'https://npm.pkg.github.com'
@@ -41,7 +41,7 @@ jobs:
4141
id: yarn-cache-dir-path
4242
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
4343

44-
- uses: actions/cache@v3
44+
- uses: actions/cache@v4
4545
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
4646
with:
4747
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -79,7 +79,7 @@ jobs:
7979
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8080

8181
# Keep only the 3 latest pre releases
82-
- uses: actions/delete-package-versions@v4
82+
- uses: actions/delete-package-versions@v5
8383
with:
8484
package-name: 'jupyter-react'
8585
package-type: 'npm'

.licenserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ header:
3838
- 'packages/lexical/src/ui/PrettierButton.tsx_tmp'
3939
- 'packages/react/third-party-license.txt'
4040
- 'patches/'
41+
- '**/robots.txt'
4142

4243
comment: on-failure

CLAUDE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Jupyter UI - AI Assistant Guide
2+
3+
## Quick Overview
4+
React component library for building Jupyter-compatible applications. Monorepo with Lerna managing 4 main packages and multiple examples.
5+
6+
## Core Packages
7+
- `@datalayer/jupyter-react` - Main React components for notebooks, cells, terminals
8+
- `@datalayer/jupyter-lexical` - Rich text editor with Lexical framework integration
9+
- `@datalayer/jupyter-docusaurus-plugin` - Plugin for Docusaurus sites
10+
- `datalayer-jupyter-vscode` - VS Code extension for notebooks
11+
12+
## Key Commands
13+
```bash
14+
# Install dependencies
15+
npm install
16+
17+
# Build all packages
18+
npm run build
19+
20+
# Start Jupyter server (required for development)
21+
npm run jupyter:server
22+
23+
# Run specific examples
24+
npm run jupyter:ui:vite # Vite example
25+
npm run jupyter:ui:nextjs # Next.js example
26+
npm run jupyter:ui:lexical # Lexical editor example
27+
28+
# Run tests
29+
npm test
30+
31+
# Lint and format
32+
npm run lint
33+
34+
# Storybook
35+
npm run storybook
36+
```
37+
38+
## Development Setup
39+
1. Requires Node.js >= 18.0.0
40+
2. Uses port 8686 for Jupyter server, 3208 for frontend
41+
3. Server token: `60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6`
42+
43+
## Architecture Notes
44+
- Components wrap JupyterLab functionality in React declarative API
45+
- Supports IPyWidgets, kernels, outputs, file browser
46+
- Server communication via ServiceManager
47+
- Uses Lumino widgets under the hood but exposes React interface
48+
49+
## Common Tasks
50+
- Adding components: Create in `packages/react/src/components/`
51+
- Testing examples: Use `examples/` folders with various frameworks
52+
- Documentation: Update in `docs/` (Docusaurus site)
53+
- Storybook: Components showcased in `storybook/`
54+
55+
## Important Files
56+
- `lerna.json` - Monorepo configuration
57+
- `dev/config/jupyter_server_config.py` - Server settings
58+
- `packages/react/src/jupyter/JupyterContext.tsx` - Core context provider

0 commit comments

Comments
 (0)