Skip to content
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

Build: Introducing Bun for Script Execution #28046

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
00b0956
CI: Configure bun on CircleCI
valentinpalkovic Jun 6, 2024
58da775
Docs: Edit contribution guide to setup bun
valentinpalkovic Jun 6, 2024
78404c7
Build: Use bun to run scripts instead of esbuild-register
valentinpalkovic Jun 6, 2024
f9aec85
Build: Modify scripts to make them compatible for Bun runtime
valentinpalkovic Jun 6, 2024
332b49f
Build: Cleanup
valentinpalkovic Jun 6, 2024
7a6f7e0
Build: Streamline yarn version
valentinpalkovic Jun 6, 2024
ac5af01
Build: Remove esbuild-register from scripts
valentinpalkovic Jun 6, 2024
a29c582
Build: Install @types/bun
valentinpalkovic Jun 6, 2024
7180b58
Dependencies: Update execa in scripts
valentinpalkovic Jun 6, 2024
6f93864
Update lock file
valentinpalkovic Jun 7, 2024
9044223
WIP
valentinpalkovic Jun 7, 2024
29d8c88
chore: Add process.exit in addon-bundle and esm-bundle scripts
valentinpalkovic Jun 7, 2024
50aa377
Chore: Update autogemerated frameworks.ts
valentinpalkovic Jun 7, 2024
e3913b5
Fix compodoc script execution
valentinpalkovic Jun 7, 2024
249ae4c
Build: Fix verdaccio
valentinpalkovic Jun 10, 2024
2266685
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jun 10, 2024
7dc80d6
Remove timeout
valentinpalkovic Jun 10, 2024
ba6c56c
Build: Add temporary user to verdaccio registry
valentinpalkovic Jun 10, 2024
e2a35e1
Dependency: Set pino to v9
valentinpalkovic Jun 10, 2024
4478cc5
Revert changes on addUser function
valentinpalkovic Jun 10, 2024
50d80ae
Add missing bun orb
valentinpalkovic Jun 11, 2024
40347b1
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jun 11, 2024
22e4d61
Build: Use tsx instead of bun to run verdaccio
valentinpalkovic Jun 19, 2024
ec50aa0
refactor: update exec.ts to use execaNode for running node commands
valentinpalkovic Jun 19, 2024
d30bae7
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jun 19, 2024
af56908
Build: Save list of supported frameworks in alphabetical order
valentinpalkovic Jun 19, 2024
c37ec6a
Add bun-orb to script-checks job in CircleCI
valentinpalkovic Jun 25, 2024
a4609b6
Use updated playwright image for CI
valentinpalkovic Jun 25, 2024
c10f8c2
Use updated Bun version on CI
valentinpalkovic Jun 25, 2024
b8d5fc8
Revert "Use updated playwright image for CI"
valentinpalkovic Jun 25, 2024
e9713a1
Install unzip for test-portable-stories jobs
valentinpalkovic Jun 25, 2024
e68e5f4
chore: Update Playwright image version to v1.42.1-focal
valentinpalkovic Jun 25, 2024
af565d4
Add --debug flag to yarn task commands in CircleCI config
valentinpalkovic Jun 25, 2024
395c7c7
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jun 28, 2024
8e67707
WIP
valentinpalkovic Jul 1, 2024
5021fc1
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jul 2, 2024
884fa85
Merge remote-tracking branch 'origin/next' into valentin/bun
valentinpalkovic Jul 12, 2024
754dc72
Upgrade to Bun 1.1.18
valentinpalkovic Jul 12, 2024
2b09afc
Fix trailing comma
valentinpalkovic Jul 12, 2024
a7783f8
Small fixes
valentinpalkovic Jul 12, 2024
a0e77a3
Upgrade NX and TypeScript
valentinpalkovic Jul 12, 2024
b237cd6
Add process exit to close the verdaccio server
valentinpalkovic Jul 12, 2024
b9d1111
Update lock file
valentinpalkovic Jul 12, 2024
ac3c8e1
Add rimraf devDependency
valentinpalkovic Jul 12, 2024
349a5a3
Merge branch 'next' into valentin/bun
ndelangen Jul 16, 2024
01567dc
dedupe
ndelangen Jul 16, 2024
2ff0513
fix check command
ndelangen Jul 16, 2024
eebb41c
cleanup deprecated nx option
ndelangen Jul 16, 2024
d3fc596
attempt at fixing this:
ndelangen Jul 17, 2024
3997257
test at debugging:
ndelangen Jul 17, 2024
a995464
try something else
ndelangen Jul 17, 2024
e679544
try more fixes
ndelangen Jul 17, 2024
2ad9512
fixes
ndelangen Jul 17, 2024
cf88938
debugging
ndelangen Jul 17, 2024
84d2574
fix
ndelangen Jul 17, 2024
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
61 changes: 45 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ executors:
default: "small"
working_directory: /tmp/storybook
docker:
- image: mcr.microsoft.com/playwright:v1.42.1-jammy
- image: mcr.microsoft.com/playwright:v1.42.1-focal
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand Down Expand Up @@ -140,7 +140,8 @@ jobs:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.1
version: 1.1.18
- node/install
- restore_cache:
name: Restore Yarn cache
keys:
Expand Down Expand Up @@ -203,7 +204,8 @@ jobs:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.1
version: 1.1.18
- node/install
- attach_workspace:
at: .
- nx/set-shas:
Expand All @@ -222,6 +224,8 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -285,6 +289,8 @@ jobs:
steps:
# switched this to the CircleCI helper to get the full git history for TurboSnap
- checkout
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
Expand All @@ -306,14 +312,16 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Enable Corepack
command: sudo corepack enable yarn
- run:
name: Creating Sandboxes
command: yarn task --task sandbox --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox) --no-link --start-from=never --junit
command: yarn task --task sandbox --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox)
- persist_to_workspace:
Expand All @@ -333,11 +341,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Smoke Testing Sandboxes
command: yarn task --task smoke-test --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task smoke-test) --no-link --start-from=never --junit
command: yarn task --task smoke-test --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task smoke-test) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task smoke-test)
- store_test_results:
Expand All @@ -354,17 +364,18 @@ jobs:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.1
version: 1.1.18
- node/install
- attach_workspace:
at: .
- run:
name: Starting Event Collector
command: node --loader esbuild-register/loader -r esbuild-register ./event-log-collector.ts
command: bun ./event-log-collector.ts
working_directory: scripts
background: true
- run:
name: Building Sandboxes
command: yarn task --task build --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) --no-link --start-from=never --junit
command: yarn task --task build --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) --no-link --start-from=never --junit --debug
environment:
STORYBOOK_TELEMETRY_URL: "http://localhost:6007/event-log"
- run:
Expand All @@ -373,7 +384,7 @@ jobs:
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task build)
if [[ $TEMPLATE != bench/* ]]
then
node --loader esbuild-register/loader -r esbuild-register ./event-log-checker.ts build $TEMPLATE
bun ./event-log-checker.ts build $TEMPLATE
fi
working_directory: scripts
- report-workflow-on-failure:
Expand All @@ -396,11 +407,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Running Test Runner
command: yarn task --task test-runner --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) --no-link --start-from=never --junit
command: yarn task --task test-runner --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
- store_test_results:
Expand All @@ -416,11 +429,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Running Test Runner in Dev mode
command: yarn task --task test-runner-dev --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev) --no-link --start-from=never --junit
command: yarn task --task test-runner-dev --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev)
- store_test_results:
Expand All @@ -435,11 +450,13 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- checkout
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- 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
command: yarn task --task chromatic --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task chromatic) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task chromatic)
- store_test_results:
Expand All @@ -455,11 +472,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Running E2E Tests
command: yarn task --task e2e-tests --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests) --no-link --start-from=never --junit
command: yarn task --task e2e-tests --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests)
- store_test_results:
Expand All @@ -478,11 +497,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- run:
name: Running E2E Tests
command: yarn task --task e2e-tests-dev --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests-dev) --no-link --start-from=never --junit
command: yarn task --task e2e-tests-dev --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests-dev) --no-link --start-from=never --junit --debug
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests-dev)
- store_test_results:
Expand All @@ -501,11 +522,13 @@ jobs:
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
- bun-orb/setup:
version: 1.1.18
- attach_workspace:
at: .
- 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
command: yarn task --task bench --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench) --no-link --start-from=never --junit --debug
- run:
name: Uploading results
command: yarn upload-bench $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench) << pipeline.parameters.ghPrNumber >> << pipeline.parameters.ghBaseBranch >>
Expand All @@ -525,6 +548,8 @@ jobs:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- bun-orb/setup:
version: 1.1.18
- when:
condition:
equal: ["npm", << parameters.packageManager >>]
Expand Down Expand Up @@ -615,6 +640,11 @@ jobs:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- run:
name: Install unzip
command: apt install zip
- bun-orb/setup:
version: 1.1.18
- run:
name: Install dependencies
command: yarn install --no-immutable
Expand All @@ -637,7 +667,6 @@ jobs:
name: Run Cypress CT tests
command: yarn cypress
working_directory: test-storybooks/portable-stories-kitchen-sink/<< parameters.directory >>
- report-workflow-on-failure
workflows:
docs:
when:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/canary-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ jobs:

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1

bun-version: 1.1.18
- name: Cache dependencies
uses: actions/cache@v4
with:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/generate-sandboxes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ jobs:
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1

- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.18

- name: Setup git user
run: |
git config --global user.name "storybook-bot"
Expand Down Expand Up @@ -88,7 +92,7 @@ jobs:

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
bun-version: 1.1.18

- uses: actions/setup-node@v4
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/prepare-non-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ jobs:

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1

bun-version: 1.1.18
- name: Cache dependencies
uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
bun-version: 1.1.18

- name: Cache dependencies
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
bun-version: 1.1.18

- name: Cache dependencies
uses: actions/cache@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
- name: Set node version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.18
- name: install and compile
run: yarn task --task compile --start-from=auto
- name: test
Expand Down
Empty file modified .yarn/releases/yarn-4.3.0.cjs
100755 → 100644
Empty file.
19 changes: 10 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

Storybook is developed against a specific node version which is defined in an `.nvmrc` file. You can use any Node version manager that uses the `.nvmrc` configuration file (we recommend [fnm](https://fnm.vercel.app/)).

## Ensure you have the required system utilities

You will need to have the following installed:
- git
- node
- yarn
- [bun](https://bun.sh/)
Contributing to Storybook requires Linux or MacOS. If you are using Windows, you can use WSL2 to run the development environment.

## Using fnm as a Node version manager

Expand All @@ -19,10 +13,17 @@ You will need to have the following installed:
eval "$(fnm env --use-on-cd --corepack-enabled --version-file-strategy recursive)"
```

## Install bun

Linux/Mac:

```sh
curl -fsSL https://bun.sh/install | bash
```

## Running the local development environment

- Ensure if you are using Windows to use the Windows Subsystem for Linux (WSL).
- Run `yarn start` in the root directory to run a basic test Storybook "sandbox".
Run `yarn start` in the root directory to run a basic test Storybook "sandbox".

The `yarn start` script will generate a React Vite TypeScript sandbox with a set of test stories inside it, as well as taking all steps required to get it running (building the various packages we need etc). There is no need to run `yarn` or `yarn install` as `yarn start` will do this for you.

Expand Down
3 changes: 2 additions & 1 deletion code/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.nx/cache
.nx/cache
.nx/workspace-data
4 changes: 2 additions & 2 deletions code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"!src/**/*"
],
"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
"check": "bun ../../../scripts/prepare/check.ts",
"prep": "bun ../../../scripts/prepare/addon-bundle.ts"
},
"dependencies": {
"@storybook/addon-highlight": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"!src/**/*"
],
"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
"check": "bun ../../../scripts/prepare/check.ts",
"prep": "bun ../../../scripts/prepare/addon-bundle.ts"
},
"dependencies": {
"@storybook/global": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"!src/**/*"
],
"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
"check": "bun ../../../scripts/prepare/check.ts",
"prep": "bun ../../../scripts/prepare/addon-bundle.ts"
},
"dependencies": {
"@storybook/global": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions code/addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"!src/**/*"
],
"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
"check": "bun ../../../scripts/prepare/check.ts",
"prep": "bun ../../../scripts/prepare/addon-bundle.ts"
},
"dependencies": {
"dequal": "^2.0.2",
Expand Down
Loading
Loading