Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
250127b
Refactor root of yarn monorepo from code to the git root. And NX agen…
kasperpeulen Nov 18, 2025
ec6d354
Fix distribution config
kasperpeulen Nov 27, 2025
3b0a2d7
Fix pretty docs
kasperpeulen Nov 27, 2025
7733316
Fix check
kasperpeulen Nov 27, 2025
69fbe0c
Clean up last things
kasperpeulen Nov 27, 2025
fbc2af4
Make sure the settings.json is deleted before the onboarding test.
kasperpeulen Nov 27, 2025
ac61afb
Update scripts/run-registry.ts
kasperpeulen Nov 27, 2025
ec1bd5d
Fix lint
kasperpeulen Nov 28, 2025
81a8497
Merge remote-tracking branch 'origin/kasper/yarn-monorepo-refactor' i…
kasperpeulen Nov 28, 2025
69106f4
Fix
kasperpeulen Nov 28, 2025
f35970d
Fix
kasperpeulen Nov 28, 2025
d80cf75
Fix
kasperpeulen Nov 28, 2025
c31e808
Merge remote-tracking branch 'origin/next' into kasper/yarn-monorepo-…
kasperpeulen Nov 28, 2025
ae1ebf8
Fix
kasperpeulen Nov 28, 2025
f04dd28
Cleanup
kasperpeulen Nov 28, 2025
d58d659
Make ports backwards compatible for local dev
kasperpeulen Nov 28, 2025
4446340
Remove TODOs
kasperpeulen Nov 28, 2025
5dd20f9
Revert
kasperpeulen Nov 28, 2025
7c89c17
Fix
kasperpeulen Nov 28, 2025
6e6a31c
Fix
kasperpeulen Nov 28, 2025
02e22fa
Fix
kasperpeulen Nov 28, 2025
40cdf8b
Fix
kasperpeulen Nov 28, 2025
39a4409
Fix
kasperpeulen Nov 28, 2025
b4b8b24
Fix
kasperpeulen Nov 28, 2025
729408e
Only move sandboxes to cache when NX is used
kasperpeulen Nov 28, 2025
b9a60d1
Fix build
kasperpeulen Nov 28, 2025
c7244fa
Fix
kasperpeulen Nov 28, 2025
73841fd
Fix
kasperpeulen Nov 28, 2025
a4f5eda
Fix
kasperpeulen Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,761 changes: 1,399 additions & 1,362 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .circleci/src/jobs/bench-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- run:
name: Running Bench
command: yarn task --task bench --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench) --no-link --start-from=never --junit
Expand Down
4 changes: 2 additions & 2 deletions .circleci/src/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ steps:
- restore_cache:
name: Restore Yarn cache
keys:
- build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
- build-yarn-2-cache-v5--{{ checksum "yarn.lock" }}
- run:
name: Compile
command: |
Expand All @@ -25,7 +25,7 @@ steps:
path: code/bench/esbuild-metafiles
- save_cache:
name: Save Yarn cache
key: build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
key: build-yarn-2-cache-v5--{{ checksum "yarn.lock" }}
paths:
- ~/.yarn/berry/cache
- persist_to_workspace:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/check-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task check-sandbox)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- run:
name: Type check Sandboxes
command: yarn task --task check-sandbox --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task check-sandbox) --no-link --start-from=never --junit
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
- restore_cache:
name: Restore Yarn cache
keys:
- build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
- build-yarn-2-cache-v5--{{ checksum "yarn.lock" }}
- run:
name: Compile
command: |
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/chromatic-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task chromatic)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- run:
name: Running Chromatic
command: yarn task --task chromatic --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task chromatic) --no-link --start-from=never --junit
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/create-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
if [[ $TEMPLATE != bench/* ]]; then
yarn --cwd scripts jiti ./event-log-checker.ts build $TEMPLATE
fi
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && rm -rf node_modules
cd $(yarn get-sandbox-dir --template $TEMPLATE) && rm -rf node_modules
environment:
STORYBOOK_TELEMETRY_DEBUG: 1
STORYBOOK_TELEMETRY_URL: 'http://localhost:6007/event-log'
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/e2e-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests-dev)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- run:
name: Running E2E Tests
# TEST_FILES should include all relevant test files, in this case we use the default playwright pattern
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/e2e-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- run:
name: Running E2E Tests
# TEST_FILES should include all relevant test files, in this case we use the default playwright pattern
Expand Down
4 changes: 2 additions & 2 deletions .circleci/src/jobs/pretty-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ steps:
- restore_cache:
name: Restore Yarn cache
keys:
- prettydocs-yarn-2-cache-v8--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
- prettydocs-yarn-2-cache-v8--{{ checksum "yarn.lock" }}
- run:
name: Install
command: |
cd scripts
yarn install
- save_cache:
name: Save Yarn cache
key: prettydocs-yarn-2-cache-v8--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
key: prettydocs-yarn-2-cache-v8--{{ checksum "yarn.lock" }}
paths:
- ~/.yarn/berry/cache
- run:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/test-runner-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- start-event-collector
- run:
name: Running Test Runner
Expand Down
2 changes: 1 addition & 1 deletion .circleci/src/jobs/vitest-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
name: Install sandbox dependencies
command: |
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task vitest-integration)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
cd $(yarn get-sandbox-dir --template $TEMPLATE) && yarn
- start-event-collector
- run:
name: Running story tests in Vitest
Expand Down
2 changes: 1 addition & 1 deletion .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"snapshot": "snapshot-20250521-0222c8bd-0a11-48ab-a2a8-380203843e05",
"install": "cd /workspace/scripts && yarn && cd ../code && yarn && yarn task --task=compile --start-from=compile",
"install": "yarn && yarn task --task=compile --start-from=compile",
"start": "cd /workspace/code && yarn test",
"terminals": []
}
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
STORYBOOK_DISABLE_TELEMETRY=true
IN_STORYBOOK_SANDBOX=true
SANDBOX_ROOT=../storybook-sandboxes
5 changes: 2 additions & 3 deletions .github/actions/setup-node-and-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ runs:
with:
path: |
~/.yarn/berry/cache
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
key: yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
yarn-v1-${{ hashFiles('yarn.lock') }}
yarn-v1

- name: Install script dependencies
Expand Down
12 changes: 6 additions & 6 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Storybook is a large monorepo built with TypeScript, React, and various other fr

## System Requirements

- **Node.js**: 22.16.0 (see `.nvmrc`)
- **Node.js**: 22.21.1 (see `.nvmrc`)
- **Package Manager**: Yarn 4.9.1
- **Operating System**: Linux/macOS (CI environment)

Expand All @@ -17,7 +17,7 @@ Storybook is a large monorepo built with TypeScript, React, and various other fr
```
storybook/
├── .github/ # GitHub configurations and workflows
├── code/ # Main monorepo codebase
├── code/ # Main codebase
│ ├── .storybook/ # Configuration for internal UI Storybook
│ ├── core/ # Core Storybook package
│ ├── lib/ # Core supporting libraries
Expand All @@ -30,15 +30,15 @@ storybook/
├── sandbox/ # Generated sandbox environments (created by yarn task --task sandbox)
├── scripts/ # Build and development scripts
├── docs/ # Documentation
└── test-storybooks/ # Test configurations
└── test-storybooks/ # Test repos
```

## Essential Commands and Build Times

### Installation & Setup
```bash
# Install all dependencies (run from repository root)
yarn i
yarn
# Time: ~2.5 minutes
# Timeout: Use 300+ seconds for bash commands
```
Expand Down Expand Up @@ -148,7 +148,7 @@ The repository includes 20 task scripts in `scripts/tasks/`:
## Recommended Development Workflow

### For Code Changes
1. Install dependencies: `yarn i` (if needed)
1. Install dependencies: `yarn` (if needed)
2. Compile packages: `yarn task --task compile`
3. Make your changes
4. Compile packages with `cd code && yarn task --task compile`
Expand Down Expand Up @@ -285,7 +285,7 @@ cd code && yarn storybook:vitest
## Troubleshooting

### Common Issues
1. **Build Failures**: Often resolved by running `yarn i` followed by `yarn task --task compile`
1. **Build Failures**: Often resolved by running `yarn` followed by `yarn task --task compile`
2. **Port Conflicts**: Storybook UI uses port 6006 by default
3. **Memory Issues**: Large compilation tasks may require increased Node.js memory limits
4. **Environment-Specific Issues**: Sandbox generation may occasionally fail due to dependency conflicts - use Storybook UI for testing as fallback
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/nx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: nx

on:
push:
branches:
- next
# TODO remove
- kasper/yarn-monorepo-refactor
pull_request:
types: [opened, synchronize, labeled, reopened]

permissions:
actions: read
contents: read
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add missing pull-requests: read permission for label-based conditionals.

The workflow reads PR labels in conditional steps (lines 36-44) but lacks the required pull-requests: read permission. Without this permission, the label checks may fail silently or behave unexpectedly, especially for external pull requests.

Apply this diff to add the missing permission:

 permissions:
   actions: read
   contents: read
+  pull-requests: read
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
permissions:
actions: read
contents: read
permissions:
actions: read
contents: read
pull-requests: read
🤖 Prompt for AI Agents
.github/workflows/nx.yml around lines 10 to 12: the workflow currently grants
only actions: read and contents: read but omits pull-requests: read which is
required for steps that check PR labels; update the permissions block to include
pull-requests: read so label-based conditionals can access PR metadata (add the
permission alongside the existing ones).


env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
nx:
runs-on: ubuntu-latest
env:
ALL_TASKS: check,knip,test,pretty-docs,lint,sandbox,build,e2e-tests,e2e-tests-dev,test-runner,vitest-integration,check-sandbox,e2e-ui,jest,vitest,playwright-ct,cypress
steps:
- uses: actions/checkout@v4
with:
filter: tree:0
fetch-depth: 0
- run: npx nx@latest start-ci-run --distribute-on="./.nx/workflows/distribution-config.yaml" --stop-agents-after="$ALL_TASKS"
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- run: yarn install --immutable
- uses: nrwl/nx-set-shas@v4

# --- PRs ---
- if: github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'ci:normal')
run: yarn nx run-many -t $ALL_TASKS -c production -p="tag:ci:normal"
- if: github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'ci:merged')
run: yarn nx run-many -t $ALL_TASKS -c production -p="tag:ci:normal,tag:ci:merged"
- if: github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'ci:daily')
run: yarn nx run-many -t $ALL_TASKS -c production -p="tag:ci:normal,tag:ci:merged,tag:ci:daily"

# --- Pushes ---
- if: github.event_name == 'push' &&
github.ref == 'refs/heads/next'
run: yarn nx run-many -t $ALL_TASKS -c production -p="tag:ci:normal,tag:ci:merged"
# TODO remove
- if: github.event_name == 'push' &&
github.ref == 'refs/heads/kasper/yarn-monorepo-refactor'
run: yarn nx run-many -t $ALL_TASKS -c production -p="tag:ci:normal"
25 changes: 16 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@ test-results
/.npmrc
tsconfig.vitest-temp.json

# Yarn stuff
.env.local

# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# For sandboxes
/**/.pnp.*
/**/.yarn/*
!/**/.yarn/releases
!/**/.yarn/patches
!/**/.yarn/plugins
!/**/.yarn/releases
!/**/.yarn/sdks
!/**/.yarn/versions
!/**/.yarn/patches
/**/.pnp.*
!/node_modules

# test-storybooks
test-storybooks/ember-cli/ember-output
Expand Down Expand Up @@ -55,15 +65,12 @@ code/playwright/.cache/
code/bench-results/

/packs
code/.nx/cache
code/.nx/workspace-data
.vite-inspect
.nx/cache
.nx/workspace-data
!**/fixtures/**/yarn.lock
code/core/report
node_modules/.svelte2tsx-language-server-files

*storybook.log

.junie
.junie
1 change: 0 additions & 1 deletion .ignore

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
22.16.0
22.21.1

Loading
Loading