Merge branch 'next' into chore_docs_addon_changes

This commit is contained in:
Norbert de Langen 2023-06-30 13:15:27 +02:00 committed by GitHub
commit 3db82fcdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1722 changed files with 25218 additions and 75267 deletions

View File

@ -43,7 +43,7 @@ executors:
default: 'small'
working_directory: /tmp/storybook
docker:
- image: mcr.microsoft.com/playwright:v1.32.3-focal
- image: mcr.microsoft.com/playwright:v1.35.0-focal
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
@ -144,93 +144,13 @@ jobs:
- code/node_modules
- code/addons
- code/frameworks
- code/deprecated
- code/lib
- code/builders
- code/ui
- code/renderers
- code/presets
- .verdaccio-cache
cra-bench:
executor:
class: large
name: sb_playwright
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Running local registry
command: |
cd code
yarn local-registry --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6001
- run:
name: set up cra repro, skip tests
command: |
cd code
SANDBOX_ROOT=../bench yarn task --task sandbox --template cra/default-ts --skip-template-stories --start-from=never --no-link
- run:
name: Run @storybook/bench on repro
command: |
cd bench/cra-default-ts
rm -rf node_modules
mkdir node_modules
../../code/node_modules/.bin/sb-bench 'yarn install' --label cra
- report-workflow-on-failure
- run:
name: prep artifacts
when: always
command: tar cvzf /tmp/cra-default-ts-bench.tar.gz bench/cra-default-ts
- store_artifacts:
path: /tmp/cra-default-ts-bench.tar.gz
destination: cra-default-ts-bench.tar.gz
react-vite-bench:
executor:
class: large
name: sb_playwright
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Running local registry
command: |
cd code
yarn local-registry --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6001
- run:
name: set up react-vite repro, skip tests
command: |
cd code
SANDBOX_ROOT=../bench yarn task --task sandbox --template react-vite/default-ts --skip-template-stories --start-from=never --no-link
- run:
name: Run @storybook/bench on repro
command: |
cd bench/react-vite-default-ts
rm -rf node_modules
mkdir node_modules
../../code/node_modules/.bin/sb-bench 'yarn install' --label react-vite
- report-workflow-on-failure
- run:
name: prep artifacts
when: always
command: tar cvzf /tmp/react-vite-default-ts-bench.tar.gz bench/react-vite-default-ts
- store_artifacts:
path: /tmp/react-vite-default-ts-bench.tar.gz
destination: react-vite-default-ts-bench.tar.gz
lint:
executor:
class: large
@ -349,9 +269,9 @@ jobs:
at: .
- run:
name: Creating Sandboxes
command: yarn task --task sandbox --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> sandbox)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task sandbox)
- persist_to_workspace:
root: .
paths:
@ -374,9 +294,9 @@ jobs:
at: .
- run:
name: Smoke Testing Sandboxes
command: yarn task --task smoke-test --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> smoke-test)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task smoke-test)
- store_test_results:
path: test-results
build-sandboxes:
@ -400,18 +320,19 @@ jobs:
background: true
- run:
name: Building Sandboxes
command: yarn task --task build --template $(yarn get-template << pipeline.parameters.workflow >> 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
- run:
name: Verifying Telemetry
command: yarn ts-node ./event-log-checker build $(yarn get-template << pipeline.parameters.workflow >> build)
command: yarn ts-node ./event-log-checker build $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build)
working_directory: scripts
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> build)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build)
- store_test_results:
path: test-results
- persist_to_workspace:
root: .
paths:
- sandbox/*/bench/*.json
- sandbox/*/storybook-static
test-runner-production:
parameters:
@ -429,9 +350,9 @@ jobs:
at: .
- run:
name: Running Test Runner
command: yarn task --task test-runner --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> test-runner)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
- store_test_results:
path: test-results
test-runner-dev:
@ -450,9 +371,9 @@ jobs:
at: .
- run:
name: Running Test Runner in Dev mode
command: yarn task --task test-runner-dev --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> test-runner-dev)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner-dev)
- store_test_results:
path: test-results
chromatic-sandboxes:
@ -470,9 +391,9 @@ jobs:
at: .
- run:
name: Running Chromatic
command: yarn task --task chromatic --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> chromatic)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task chromatic)
- store_test_results:
path: test-results
e2e-production:
@ -491,9 +412,9 @@ jobs:
at: .
- run:
name: Running E2E Tests
command: yarn task --task e2e-tests --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> e2e-tests)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests)
- store_test_results:
path: test-results
- store_artifacts: # this is where playwright puts more complex stuff
@ -515,14 +436,36 @@ jobs:
at: .
- run:
name: Running E2E Tests
command: yarn task --task e2e-tests-dev --template $(yarn get-template << pipeline.parameters.workflow >> 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
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> e2e-tests-dev)
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task e2e-tests-dev)
- store_test_results:
path: test-results
- store_artifacts: # this is where playwright puts more complex stuff
path: code/playwright-results/
destination: playwright
bench:
parameters:
parallelism:
type: integer
default: 2
executor:
class: medium
name: sb_playwright
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- 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
- run:
name: Uploading results
command: yarn upload-bench $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
workflows:
ci:
@ -594,18 +537,12 @@ workflows:
- coverage:
requires:
- unit-tests
- cra-bench:
requires:
- build
- react-vite-bench:
requires:
- build
- create-sandboxes:
parallelism: 9
parallelism: 11
requires:
- build
- build-sandboxes:
parallelism: 9
parallelism: 11
requires:
- create-sandboxes
- chromatic-sandboxes:
@ -623,6 +560,10 @@ workflows:
parallelism: 9
requires:
- build-sandboxes
- bench:
parallelism: 2
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
# - test-runner-dev:
# requires:
@ -651,18 +592,12 @@ workflows:
- coverage:
requires:
- unit-tests
- cra-bench:
requires:
- build
- react-vite-bench:
requires:
- build
- create-sandboxes:
parallelism: 18
parallelism: 20
requires:
- build
- build-sandboxes:
parallelism: 18
parallelism: 20
requires:
- create-sandboxes
- chromatic-sandboxes:
@ -681,6 +616,10 @@ workflows:
parallelism: 18
requires:
- build-sandboxes
- bench:
parallelism: 2
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
# - test-runner-dev:
# parallelism: 4
@ -708,14 +647,14 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 32
parallelism: 34
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 32
parallelism: 34
requires:
- create-sandboxes
- chromatic-sandboxes:

88
.github/workflows/canary-release-pr.WIP vendored Normal file
View File

@ -0,0 +1,88 @@
name: Publish canary release of PR
run-name: 'Canary release: PR #${{ github.event.pull_request.number }} at ${{ github.sha }}'
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- next
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
pull-requests: write
jobs:
release-canary:
name: Release canary version
runs-on: ubuntu-latest
environment: canary-release
defaults:
run:
working-directory: scripts
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.yarn/berry/cache
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
restore-keys: |
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
yarn-v1
- name: Install dependencies
working-directory: .
run: yarn task --task=install --start-from=install
- name: Set version
id: version
run: |
SHORT_SHA=$(git rev-parse --short ${{ github.sha }})
yarn release:version --release-type prerelease --pre-id pr-${{ github.event.pull_request.number }}-$SHORT_SHA --verbose
- name: Publish v${{ steps.version.outputs.next-version }}
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release:publish --tag pr-${{ github.event.pull_request.number }} --verbose
- name: Create comment on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }}\
--repo "${{github.repository }}"\
--body "🚀 This pull request has been published as version \`${{ steps.version.outputs.next-version }}\` and with the tag \`pr-${{ github.event.pull_request.number }}\`.
[You can see it on the npm registry here](https://npmjs.com/package/@storybook/cli/v/${{ steps.version.outputs.next-version }})".
- name: Create failing comment on PR
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }}\
--repo "${{github.repository }}"\
--body "Failed to publish canary version of this pul request. See the failed workflow run at See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# - name: Report failure to Discord
# if: failure()
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
# uses: Ilshidur/action-discord@master
# with:
# args: 'The GitHub Action for publishing version ${{ steps.version.outputs.current-version }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

View File

@ -1,6 +1,19 @@
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- edited
branches:
- main
- next
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
name: Danger JS
jobs:
@ -13,7 +26,7 @@ jobs:
node-version: '16'
- uses: actions/checkout@v3
- name: Danger JS
uses: danger/danger-js@10.9.0
uses: danger/danger-js@11.2.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

View File

@ -0,0 +1,179 @@
name: Prepare patch PR
run-name: Prepare patch PR, triggered by ${{ github.triggering_actor }}
on:
push:
branches:
- next
workflow_dispatch:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
prepare-patch-pull-request:
name: Prepare patch pull request
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: scripts
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.yarn/berry/cache
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
restore-keys: |
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
yarn-v1
- name: Install Dependencies
working-directory: .
run: |
yarn task --task=install
- name: Check if pull request is frozen
if: github.event_name != 'workflow_dispatch'
id: check-frozen
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:is-pr-frozen --patch
- name: Cancel when frozen
if: steps.check-frozen.outputs.frozen == 'true' && github.event_name != 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# From https://stackoverflow.com/a/75809743
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Check for unreleased changes
id: unreleased-changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:unreleased-changes-exists --unpicked-patches
- name: Fetch next branch
run:
# depth needs to be set to a high enough number that it will contain all the merge commits to cherry-pick
# as of May 2023, the whole repo had 55K commits
git fetch --depth=2000 origin next
- name: Pick patches
id: pick-patches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
yarn release:pick-patches
- name: Bump version
id: bump-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
run: |
yarn release:version --release-type patch --verbose
# We need the current version to set the branch name, even when not bumping the version
- name: Get current version
id: current-version
if: steps.unreleased-changes.outputs.has-changes-to-release == 'false'
run: |
yarn release:get-current-version --verbose
- name: Set version output
id: versions
run: |
echo "current=${{ steps.bump-version.outputs.current-version || steps.current-version.outputs.current-version }}" >> "$GITHUB_OUTPUT"
echo "next=${{ steps.bump-version.outputs.next-version || steps.current-version.outputs.current-version }}" >> "$GITHUB_OUTPUT"
- name: Write changelog
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn release:write-changelog ${{ steps.versions.outputs.next }} --unpicked-patches --verbose
- name: 'Commit changes to branch: version-patch-from-${{ steps.versions.outputs.current }}'
working-directory: .
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b version-patch-from-${{ steps.versions.outputs.current }}
git add .
git commit -m "Bump version from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.next }}" || true
git push --force origin version-patch-from-${{ steps.versions.outputs.current }}
- name: Generate PR description
id: description
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:generate-pr-description --unpicked-patches --manual-cherry-picks='${{ steps.pick-patches.outputs.failed-cherry-picks }}' ${{ steps.unreleased-changes.outputs.has-changes-to-release == 'true' && format('{0}={1} {2}={3}', '--current-version', steps.versions.outputs.current, '--next-version', steps.versions.outputs.next) || '' }} --verbose
- name: Create or update pull request with release
if: steps.unreleased-changes.outputs.has-changes-to-release == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if PR_STATE=$(gh pr view --json state --jq .state 2>/dev/null) && [[ -n "$PR_STATE" && "$PR_STATE" == *"OPEN"* ]]; then
gh pr edit \
--repo "${{github.repository }}" \
--title "Release: Patch ${{ steps.versions.outputs.next }}" \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}" \
--title "Release: Patch ${{ steps.versions.outputs.next }}" \
--label "release" \
--base latest-release \
--head version-patch-from-${{ steps.versions.outputs.current }} \
--body "${{ steps.description.outputs.description }}"
fi
- name: Create or update pull request without release
if: steps.unreleased-changes.outputs.has-changes-to-release == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if PR_STATE=$(gh pr view --json state --jq .state 2>/dev/null) && [[ -n "$PR_STATE" && "$PR_STATE" == *"OPEN"* ]]; then
gh pr edit \
--repo "${{github.repository }}"\
--title "Release: Merge patches to \`main\` (without version bump)" \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}"\
--title "Release: Merge patches to \`main\` (without version bump)" \
--label "release" \
--base latest-release \
--head version-patch-from-${{ steps.versions.outputs.current }} \
--body "${{ steps.description.outputs.description }}"
fi
- name: Report job failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The GitHub Action for preparing the release pull request bumping from v${{ steps.versions.outputs.current }} to v${{ steps.versions.outputs.next }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

164
.github/workflows/prepare-prerelease.yml vendored Normal file
View File

@ -0,0 +1,164 @@
name: Prepare prerelease PR
run-name: Prepare prerelease PR, triggered by ${{ github.triggering_actor }}
on:
push:
branches:
- next
workflow_dispatch:
inputs:
release-type:
description: 'Which release type to use for bumping the version'
required: true
default: 'prerelease'
type: choice
options:
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
pre-id:
description: For prerelease versions, what prerelease identifier to use, eg. 'alpha', 'beta', 'rc'
required: false
type: string
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
prepare-prerelease-pull-request:
name: Prepare prerelease pull request
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: scripts
steps:
- name: Checkout next
uses: actions/checkout@v3
with:
ref: next
# this needs to be set to a high enough number that it will contain the last version tag
# as of May 2023, the whole repo had 55K commits
fetch-depth: 10000
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.yarn/berry/cache
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
restore-keys: |
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
yarn-v1
- name: Install Dependencies
working-directory: .
run: |
yarn task --task=install
- name: Check if pull request is frozen
if: github.event_name != 'workflow_dispatch'
id: check-frozen
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:is-pr-frozen
- name: Cancel when frozen
if: steps.check-frozen.outputs.frozen == 'true' && github.event_name != 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# From https://stackoverflow.com/a/75809743
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
# tags are needed to get changes and changelog generation
- name: Fetch git tags
run: git fetch --tags origin
- name: Check for unreleased changes
id: unreleased-changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:unreleased-changes-exists
- name: Cancel when no release necessary
if: steps.unreleased-changes.outputs.has-changes-to-release == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# From https://stackoverflow.com/a/75809743
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
- name: Bump version
id: bump-version
run: |
yarn release:version --release-type ${{ inputs.release-type || 'prerelease' }} ${{ inputs.pre-id && format('{0} {1}', '--pre-id', inputs.pre-id) || '' }} --verbose
- name: Write changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn release:write-changelog ${{ steps.bump-version.outputs.next-version }} --verbose
- name: 'Commit changes to branch: version-prerelease-from-${{ steps.bump-version.outputs.current-version }}'
working-directory: .
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b version-prerelease-from-${{ steps.bump-version.outputs.current-version }}
git add .
git commit -m "Bump version from ${{ steps.bump-version.outputs.current-version }} to ${{ steps.bump-version.outputs.next-version }}" || true
git push --force origin version-prerelease-from-${{ steps.bump-version.outputs.current-version }}
- name: Generate PR description
id: description
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:generate-pr-description --current-version ${{ steps.bump-version.outputs.current-version }} --next-version ${{ steps.bump-version.outputs.next-version }} --verbose
- name: Create or update pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TYPE=${{ inputs.release-type || 'prerelease' }}
CAPITALIZED_RELEASE_TYPE=${RELEASE_TYPE^}
if PR_STATE=$(gh pr view --json state --jq .state 2>/dev/null) && [[ -n "$PR_STATE" && "$PR_STATE" == *"OPEN"* ]]; then
gh pr edit \
--repo "${{github.repository }}" \
--title "Release: $CAPITALIZED_RELEASE_TYPE ${{ inputs.pre-id && format('{0} ', inputs.pre-id) }}${{ steps.bump-version.outputs.next-version }}" \
--body "${{ steps.description.outputs.description }}"
else
gh pr create \
--repo "${{github.repository }}"\
--title "Release: $CAPITALIZED_RELEASE_TYPE ${{ inputs.pre-id && format('{0} ', inputs.pre-id) }}${{ steps.bump-version.outputs.next-version }}" \
--label "release" \
--base next-release \
--head version-prerelease-from-${{ steps.bump-version.outputs.current-version }} \
--body "${{ steps.description.outputs.description }}"
fi
- name: Report job failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The GitHub Action for preparing the release pull request bumping from v${{ steps.bump-version.outputs.current-version }} to v${{ steps.bump-version.outputs.next-version }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

147
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,147 @@
name: Publish
run-name: Publish new version on ${{ github.ref_name }}, triggered by ${{ github.triggering_actor }}
on:
push:
branches:
- latest-release
- next-release
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
jobs:
publish:
name: Publish new version
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: scripts
steps:
- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@v3
with:
fetch-depth: 100
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.yarn/berry/cache
key: yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
restore-keys: |
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}-${{ hashFiles('code/yarn.lock') }}
yarn-v1-${{ hashFiles('scripts/yarn.lock') }}
yarn-v1
- name: Install script dependencies
run: |
yarn install
- name: Get current version
id: version
run: yarn release:get-current-version
- name: Check if publish is needed
id: publish-needed
run: yarn release:is-version-published ${{ steps.version.outputs.current-version }}
- name: Check release vs prerelease
if: steps.publish-needed.outputs.published == 'false'
id: is-prerelease
run: yarn release:is-prerelease
- name: Install code dependencies
if: steps.publish-needed.outputs.published == 'false'
working-directory: .
run: yarn task --task=install --start-from=install
- name: Publish
if: steps.publish-needed.outputs.published == 'false'
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release:publish --tag ${{ steps.is-prerelease.outputs.prerelease == 'true' && 'next' || 'latest' }} --verbose
- name: Get target branch
id: target
run: echo "target=${{ github.ref_name == 'next-release' && 'next' || 'main' }}" >> $GITHUB_OUTPUT
- name: Get changelog for ${{ steps.version.outputs.current-version }}
if: steps.publish-needed.outputs.published == 'false'
id: changelog
run: yarn release:get-changelog-from-file ${{ steps.version.outputs.current-version }}
# tags are needed to get list of patches to label as picked
- name: Fetch git tags
if: github.ref_name == 'latest-release'
run: git fetch --tags origin
- name: Label patch PRs as picked
if: github.ref_name == 'latest-release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release:label-patches
- name: Create GitHub Release
if: steps.publish-needed.outputs.published == 'false'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
v${{ steps.version.outputs.current-version }} \
--repo "${{ github.repository }}" \
--target ${{ github.ref_name }} \
--title "v${{ steps.version.outputs.current-version }}" \
--notes "${{ steps.changelog.outputs.changelog }}" \
${{ steps.is-prerelease.outputs.prerelease == 'true' && '--prerelease' || '' }}
- name: Merge ${{ github.ref_name }} into ${{ steps.target.outputs.target }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin ${{ steps.target.outputs.target }}
git checkout ${{ steps.target.outputs.target }}
git merge ${{ github.ref_name }}
git push origin ${{ steps.target.outputs.target }}
- name: Sync CHANGELOG.md from `main` to `next`
if: github.ref_name == 'latest-release'
run: |
git fetch origin next
git checkout next
git pull
git checkout origin/main ./CHANGELOG.md
git add ./CHANGELOG.md
git commit -m "Update CHANGELOG.md for v${{ steps.version.outputs.current-version }}"
git push origin next
# Force push from next to main if it is not a prerelease, and this release is from next-release
# This happens when eg. next has been tracking 7.1.0-alpha.X, and now we want to release 7.1.0
# This will keep release-next, next and main all tracking v7.1.0
# - name: Force push ${{ steps.target.outputs.target }} to main
# if: steps.publish-needed.outputs.published == 'false' && steps.target.outputs.target == 'next' && !steps.is-prerelease.outputs.prerelease
# run: |
# git push --force origin ${{ steps.target.outputs.target }}:main
- name: Report job failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The GitHub Action for publishing version ${{ steps.version.outputs.current-version }} (triggered by ${{ github.triggering_actor }}) failed! See run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

View File

@ -54,7 +54,7 @@ jobs:
trigger-pr-tests:
runs-on: ubuntu-latest
needs: get-branch
if: github.event_name == 'pull_request_target' && ((github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ci:pr')) && !contains(github.event.pull_request.labels.*.name, 'ci:merged') && !contains(github.event.pull_request.labels.*.name, 'ci:daily'))
if: github.event_name == 'pull_request_target' && (((github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'release')) || contains(github.event.pull_request.labels.*.name, 'ci:pr')) && !contains(github.event.pull_request.labels.*.name, 'ci:merged') && !contains(github.event.pull_request.labels.*.name, 'ci:daily'))
steps:
- name: Trigger PR tests
run: >
@ -107,4 +107,4 @@ jobs:
}'
env:
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
BRANCH: ${{ needs.get-branch.outputs.branch }}
BRANCH: ${{ needs.get-branch.outputs.branch }}

1
.gitignore vendored
View File

@ -49,3 +49,4 @@ code/test-results/
code/playwright-results/
code/playwright-report/
code/playwright/.cache/
code/bench-results/

File diff suppressed because one or more lines are too long

View File

@ -2,4 +2,10 @@ installStatePath: ./.yarn/root-install-state.gz
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.4.1.cjs
npmPublishAccess: public
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-3.5.1.cjs

View File

@ -1,61 +1,90 @@
## 7.1.0-alpha.25 (May 26, 2023)
## 7.0.21
- Angular: Fix 16.1 compatibility - [#23064](https://github.com/storybookjs/storybook/pull/23064), thanks [@ndelangen](https://github.com/ndelangen)!
- Angular: Fix ivy preset - [#23070](https://github.com/storybookjs/storybook/pull/23070), thanks [@ndelangen](https://github.com/ndelangen)!
- CLI: Improve steps in storybook init - [#22502](https://github.com/storybookjs/storybook/pull/22502), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Skip builder selection for react native - [#23042](https://github.com/storybookjs/storybook/pull/23042), thanks [@dannyhw](https://github.com/dannyhw)!
- Core: Fix `builder-manager` adding multiple dashes to relative path - [#22974](https://github.com/storybookjs/storybook/pull/22974), thanks [@MarioCadenas](https://github.com/MarioCadenas)!
- Core: Improve `of={...}` DocBlock error in story index - [#22782](https://github.com/storybookjs/storybook/pull/22782), thanks [@shilman](https://github.com/shilman)!
- Dependencies: Set vue-component-type-helpers to latest - [#23015](https://github.com/storybookjs/storybook/pull/23015), thanks [@ndelangen](https://github.com/ndelangen)!
- Vue3: Fix source decorator to generate correct story code - [#22518](https://github.com/storybookjs/storybook/pull/22518), thanks [@chakAs3](https://github.com/chakAs3)!
- Web-components: Fix custom-elements order of property application - [#19183](https://github.com/storybookjs/storybook/pull/19183), thanks [@sonntag-philipp](https://github.com/sonntag-philipp)!
## 7.0.20 (June 8, 2023)
#### Bug Fixes
- Server: Fix .stories.yml support [#22906](https://github.com/storybooks/storybook/pull/22906)
- Docs: Fix Source block snippet updates [#22835](https://github.com/storybooks/storybook/pull/22835)
- Core: Fix indexing errors by excluding node_modules stories [#22873](https://github.com/storybooks/storybook/pull/22873)
- CLI: Fix upgrade notification message [#22933](https://github.com/storybooks/storybook/pull/22933)
- Angular: Add --open/--no-open flag to dev command [#22964](https://github.com/storybooks/storybook/pull/22964)
- Angular: Silence compodoc when running storybook with --quiet [#22957](https://github.com/storybooks/storybook/pull/22957)
#### Maintenance
- Core: Improve MDX of error in story index [#22782](https://github.com/storybooks/storybook/pull/22782)
#### Build
- Build: Fix the theme output during development [#22841](https://github.com/storybooks/storybook/pull/22841)
- Revert "Docs: E2E tests for Source block update fix" [#22934](https://github.com/storybookjs/storybook/pull/22934)
## 7.0.19 (June 8, 2023)
Bad release
## 7.0.18 (May 26, 2023)
#### Bug Fixes
- Vue3: Fix TS 5.0 compat with vue-component-type-helpers [#22814](https://github.com/storybooks/storybook/pull/22814)
#### Build
- Build: Fix the local storybook [#22805](https://github.com/storybooks/storybook/pull/22805)
- Build: Add more checks to ci:daily workflow [#22815](https://github.com/storybooks/storybook/pull/22815)
- Build: Revert conditional decorator story and downgrade Typescript version [#22812](https://github.com/storybooks/storybook/pull/22812)
## 7.1.0-alpha.24 (May 26, 2023)
#### Bug Fixes
- Vue3: Fix reactive args updates in decorators [#22717](https://github.com/storybooks/storybook/pull/22717)
- Vue3: Revert v7 breaking change, restore reactive v6-compat API [#22692](https://github.com/storybooks/storybook/pull/22692)
#### Build
- Build: Update Nx to latest version [#22694](https://github.com/storybooks/storybook/pull/22694)
- Build: Add more checks to ci:daily workflow [#22815](https://github.com/storybooks/storybook/pull/22815)
- Build: Fix Nextjs E2E tests [#22816](https://github.com/storybooks/storybook/pull/22816)
- Build: Bring back new Vue3 tests to main [#22685](https://github.com/storybooks/storybook/pull/22685)
## 7.1.0-alpha.23 (May 24, 2023)
#### Bug Fixes
- Core: Fix `managerHead` preset in `main.ts` [#22701](https://github.com/storybooks/storybook/pull/22701)
## 7.1.0-alpha.22 (May 24, 2023)
## 7.0.17 (May 24, 2023)
#### Bug Fixes
- Vite: Fix pnpm support by replacing @storybook/global with `window` [#22709](https://github.com/storybooks/storybook/pull/22709)
- Core: Fix `managerHead` preset in `main.ts` [#22701](https://github.com/storybooks/storybook/pull/22701)
## 7.1.0-alpha.21 (May 23, 2023)
## 7.0.16 (May 24, 2023)
#### Features
Accidental no-op
- Webpack: Add option to use swc instead of babel [#22075](https://github.com/storybooks/storybook/pull/22075)
## 7.0.15 (May 24, 2023)
#### Bug Fixes
- UI: Fix `.mp3` support for builder-manager [#22699](https://github.com/storybooks/storybook/pull/22699)
- CLI: Fix support for BROWSER env var [#21473](https://github.com/storybooks/storybook/pull/21473)
- Vite: Fix missing @storybook/global dependency [#22700](https://github.com/storybooks/storybook/pull/22700)
- Next.js: Fix compatibility with Next 13.4.3 [#22697](https://github.com/storybooks/storybook/pull/22697)
- CLI: Fix error parsing on NPM proxy [#22690](https://github.com/storybooks/storybook/pull/22690)
- Core: Only connect to serverChannel in development mode [#22575](https://github.com/storybooks/storybook/pull/22575)
- CLI: Improve error handling when dealing with angular.json files [#22663](https://github.com/storybooks/storybook/pull/22663)
- CLI: Skip prompting for eslint plugin with --yes flag [#22651](https://github.com/storybooks/storybook/pull/22651)
- CLI: Fix upgrade to not upgrade nx packages [#22419](https://github.com/storybooks/storybook/pull/22419)
- CLI: Only handle CTRL + C on init event [#22687](https://github.com/storybooks/storybook/pull/22687)
- Angular: Remove console.log [#22671](https://github.com/storybooks/storybook/pull/22671)
- NextJS: Fix compatibility with Next 13.4.3 [#22697](https://github.com/storybooks/storybook/pull/22697)
## 7.1.0-alpha.20 (May 20, 2023)
## 7.0.14 (May 23, 2023)
#### Bug Fixes
- Core: Only connect to serverChannel in development mode [#22575](https://github.com/storybooks/storybook/pull/22575)
- CLI: Fix error parsing on NPM proxy [#22690](https://github.com/storybooks/storybook/pull/22690)
#### Maintenance
- Core: Create server channel from window.location [#22055](https://github.com/storybooks/storybook/pull/22055)
## 7.0.13 (May 22, 2023)
#### Bug Fixes
- Angular: Fix process I/O for compodoc command [#22441](https://github.com/storybooks/storybook/pull/22441)
- CLI: Improve error handling when dealing with angular.json files [#22663](https://github.com/storybooks/storybook/pull/22663)
- CLI: Skip prompting for eslint plugin with --yes flag [#22651](https://github.com/storybooks/storybook/pull/22651)
- CLI: Account for windows paths when copying templates [#22644](https://github.com/storybooks/storybook/pull/22644)
- CLI: Fix pnpm init command [#22635](https://github.com/storybooks/storybook/pull/22635)
- UI: Add legacy font formats [#22576](https://github.com/storybooks/storybook/pull/22576)
@ -63,25 +92,23 @@
#### Maintenance
- Angular: Enable unit tests [#22355](https://github.com/storybooks/storybook/pull/22355)
- CLI: Reduce installation noise and improve error handling [#22554](https://github.com/storybooks/storybook/pull/22554)
- Actions: Fix type of withActions [#22455](https://github.com/storybooks/storybook/pull/22455)
- CLI: Only handle CTRL + C on init event [#22687](https://github.com/storybooks/storybook/pull/22687)
- CLI: Don't touch nx packages on upgrade [#22419](https://github.com/storybooks/storybook/pull/22419)
#### Build
- Build: add discord notification when generating sandboxes fails [#22638](https://github.com/storybooks/storybook/pull/22638)
- Build: set correct ref on sandboxes Github action [#22625](https://github.com/storybooks/storybook/pull/22625)
- Build: Add discord notification when generating sandboxes fails [#22638](https://github.com/storybooks/storybook/pull/22638)
- Build: Set correct ref on sandboxes Github action [#22625](https://github.com/storybooks/storybook/pull/22625)
- Build: Fix sandbox generation scripts [#22620](https://github.com/storybooks/storybook/pull/22620)
## 7.1.0-alpha.19 (May 16, 2023)
#### Bug Fixes
- Normalize paths exposed to vite-builder's `storybook-stories.js` file [#22327](https://github.com/storybooks/storybook/pull/22327)
## 7.1.0-alpha.18 (May 15, 2023)
## 7.0.12 (May 15, 2023)
#### Bug Fixes
- Core: Fix source snippets for stories with mapped args [#22135](https://github.com/storybooks/storybook/pull/22135)
- CLI: Fix `getFrameworkPackage` logic [#22559](https://github.com/storybooks/storybook/pull/22559)
- CLI: Remove automigrate reference from init command [#22561](https://github.com/storybooks/storybook/pull/22561)
@ -89,69 +116,41 @@
- CLI: Detach automigrate command from storybook init [#22523](https://github.com/storybooks/storybook/pull/22523)
## 7.1.0-alpha.17 (May 12, 2023)
## 7.0.11 (May 12, 2023)
#### Bug Fixes
- Toolbars: Fix title behavior in UI [#22496](https://github.com/storybooks/storybook/pull/22496)
- CLI: Fix storybook upgrade precheckfailure object [#22517](https://github.com/storybooks/storybook/pull/22517)
- CLI: Throw errors instead of rejecting promises [#22515](https://github.com/storybooks/storybook/pull/22515)
- CSF: Expose story id in composeStories [#22471](https://github.com/storybooks/storybook/pull/22471)
- CLI: Remove unsupported frameworks/renderers and improve builder detection [#22492](https://github.com/storybooks/storybook/pull/22492)
## 7.1.0-alpha.16 (May 11, 2023)
#### Bug Fixes
- Web-components: Fix source decorator to handle document fragments [#22513](https://github.com/storybooks/storybook/pull/22513)
- Angular: Adjust child process I/O for compodoc command [#22441](https://github.com/storybooks/storybook/pull/22441)
- Core: Fix windows path error in StoryStore v6 [#22512](https://github.com/storybooks/storybook/pull/22512)
#### Maintenance
- CLI: Prompt to force initialization when storybook is detected [#22392](https://github.com/storybooks/storybook/pull/22392)
- CLI: Do not show a migration summary on sb init [#22109](https://github.com/storybooks/storybook/pull/22109)
- UI: Show current search shortcut in search box sidebar [#21619](https://github.com/storybooks/storybook/pull/21619)
- Outline: Fix additional outline border in docs mode [#21773](https://github.com/storybooks/storybook/pull/21773)
- Measure: Deactivate when switching to Docs mode [#21602](https://github.com/storybooks/storybook/pull/21602)
- CSF: Expose story id in composeStories [#22471](https://github.com/storybooks/storybook/pull/22471)
- CLI: Prompt to force initialization when storybook folder is detected [#22392](https://github.com/storybooks/storybook/pull/22392)
- UI: Fix css inconsistency in Button and Icon components [#22497](https://github.com/storybooks/storybook/pull/22497)
#### Build
- Sandboxes: Pin @vitejs/plugin-react to avoid conflict [#22501](https://github.com/storybooks/storybook/pull/22501)
## 7.1.0-alpha.15 (May 11, 2023)
## 7.0.10 (May 9, 2023)
#### Bug Fixes
- CLI: Do not show a migration summary on sb init [#22109](https://github.com/storybooks/storybook/pull/22109)
- Toolbars: Fix title behavior in UI [#22496](https://github.com/storybooks/storybook/pull/22496)
- UI: Show current search shortcut in search box sidebar [#21619](https://github.com/storybooks/storybook/pull/21619)
- Measure: Deactivate when switching to Docs mode [#21602](https://github.com/storybooks/storybook/pull/21602)
- Outline: Fix additional outline border in docs mode [#21773](https://github.com/storybooks/storybook/pull/21773)
## 7.1.0-alpha.14 (May 9, 2023)
#### Bug Fixes
- CLI: Scope styles in sample components from the CLI templates [#22162](https://github.com/storybooks/storybook/pull/22162)
- CLI: Fix copyTemplate failures on `init` [#22375](https://github.com/storybooks/storybook/pull/22375)
- CLI: Fix server init [#22443](https://github.com/storybooks/storybook/pull/22443)
- Server: Add json indexer [#22460](https://github.com/storybooks/storybook/pull/22460)
- CLI: Scope styles in sample components from the CLI templates [#22162](https://github.com/storybooks/storybook/pull/22162)
- React: Use correct default annotations for composeStories [#22308](https://github.com/storybooks/storybook/pull/22308)
- UI: Fix opacity of list-item color [#22074](https://github.com/storybooks/storybook/pull/22074)
- Server: Add json indexer [#22460](https://github.com/storybooks/storybook/pull/22460)
- UI: Fix opacity from list-item color [#22074](https://github.com/storybooks/storybook/pull/22074)
#### Maintenance
- CLI: Refactor package manager methods to be async [#22401](https://github.com/storybooks/storybook/pull/22401)
- Angular: Improve Error message for angular.json not found [#22377](https://github.com/storybooks/storybook/pull/22377)
- TypeScript: Migrate @storybook/instrumenter to strict TS [#22370](https://github.com/storybooks/storybook/pull/22370)
- TypeScript: Migrate @storybook/core-events to strict TS [#22448](https://github.com/storybooks/storybook/pull/22448)
- TypeScript: Migrate @storybook/core-client to strict TS [#22447](https://github.com/storybooks/storybook/pull/22447)
- TypeScript: Migrate @storybook/react-vite and @storybook/preact-vite to strict TS [#22428](https://github.com/storybooks/storybook/pull/22428)
- TypeScript: Migrate @storybook/svelte-vite to strict TS [#22411](https://github.com/storybooks/storybook/pull/22411)
- TypeScript: Migrate @storybook/types to strict TS [#22397](https://github.com/storybooks/storybook/pull/22397)
- TypeScript: Migrate @storybook/addon-storysource to strict TS [#22367](https://github.com/storybooks/storybook/pull/22367)
- TypeScript: Migrate @storybook/client-api to strict TS [#22421](https://github.com/storybooks/storybook/pull/22421)
- TypeScript: Migrate @storybook/sveltekit to strict TS [#22412](https://github.com/storybooks/storybook/pull/22412)
- TypeScript: Migrate @storybook/source-loader to strict TS [#22420](https://github.com/storybooks/storybook/pull/22420)
- Improve Error message for Angular.json file not found [#22377](https://github.com/storybooks/storybook/pull/22377)
## 7.1.0-alpha.13 (May 5, 2023)
## 7.0.9 (May 5, 2023)
#### Bug Fixes
@ -160,201 +159,104 @@
#### Maintenance
- Angular: Allow TypeScript 4.0.0 and 5.0.0 [#22391](https://github.com/storybooks/storybook/pull/22391)
- Angular: Enable Angular Unit tests [#22355](https://github.com/storybooks/storybook/pull/22355)
- TypeScript: Migrate @storybook/theming to strict TS [#22376](https://github.com/storybooks/storybook/pull/22376)
- TypeScript: Migrate @storybook/channel-websocket to strict TS [#22364](https://github.com/storybooks/storybook/pull/22364)
- TypeScript: Migrate @storybook/addon-outline to strict TS [#22369](https://github.com/storybooks/storybook/pull/22369)
- TypeScript: Migrate @storybook/addon-viewbook to strict ts [#22339](https://github.com/storybooks/storybook/pull/22339)
- TypeScript: Migrate @storybook/channels to strict TS [#22365](https://github.com/storybooks/storybook/pull/22365)
#### Build
- Add Angular Prerelease sandbox [#22379](https://github.com/storybooks/storybook/pull/22379)
## 7.1.0-alpha.12 (May 3, 2023)
## 7.0.8 (May 3, 2023)
#### Bug Fixes
- Typescript: Fix bad typings caused by tsup bug [#22261](https://github.com/storybooks/storybook/pull/22261)
- Migrate: skip the automigration for gf markdown when user isn't using mdx [#22186](https://github.com/storybooks/storybook/pull/22186)
- UI: Addon panel does not update after disabling/enabling an addon [#22258](https://github.com/storybooks/storybook/pull/22258)
- Typescript: Fix bad typings caused by tsup bug [#22261](https://github.com/storybooks/storybook/pull/22261)
- Core: Fix source snippets for stories with mapped args [#22135](https://github.com/storybooks/storybook/pull/22135)
- Vue3: Fix compiler error when there is double tag [#22286](https://github.com/storybooks/storybook/pull/22286)
- Args: Fix multiple mapped args return array of labels [#22169](https://github.com/storybooks/storybook/pull/22169)
- CLI: Add web-components webpack5 to missing-babelrc automigration [#22202](https://github.com/storybooks/storybook/pull/22202)
- Docs: Fix inline story style [#21870](https://github.com/storybooks/storybook/pull/21870)
- UI: Fix shift + 7 shortcut to focus search field [#22073](https://github.com/storybooks/storybook/pull/22073)
- UI: Fix controls missing when navigating from story [#21967](https://github.com/storybooks/storybook/pull/21967)
- NextJS: Fix tsconfig resolution [#22160](https://github.com/storybooks/storybook/pull/22160)
#### Maintenance
- Telemetry: Persist sessionId across runs [#22325](https://github.com/storybooks/storybook/pull/22325)
- Packaging: Move `types` condition to the front in all `package.json.exports` maps [#22321](https://github.com/storybooks/storybook/pull/22321)
- Core: Rename manager UI mjs to js [#22247](https://github.com/storybooks/storybook/pull/22247)
- Angular: Add support for Angular 16 [#22096](https://github.com/storybooks/storybook/pull/22096)
- Packaging: Don't generate ESM dist for preset files [#22330](https://github.com/storybooks/storybook/pull/22330)
- Typescript: Migrate `@storybook/csf-tools` to strict TS [#22312](https://github.com/storybooks/storybook/pull/22312)
- Typescript: Migrate @storybook/postinstall and @storybook/router to strict TS [#22200](https://github.com/storybooks/storybook/pull/22200)
- Maintenance: Fix urls for all packages in package.json [#22101](https://github.com/storybooks/storybook/pull/22101)
- Docs: Improve component typings [#22050](https://github.com/storybooks/storybook/pull/22050)
#### Build
- Build: Comment out flaky test [#22310](https://github.com/storybooks/storybook/pull/22310)
- Build: Migrate `@storybook/web-components-vite` to strict TS [#22309](https://github.com/storybooks/storybook/pull/22309)
- Build: Migrate `@storybook/html-vite` to strict TS [#22293](https://github.com/storybooks/storybook/pull/22293)
- Build: Migrate @storybook/preset-vue-webpack to strict TS [#22320](https://github.com/storybooks/storybook/pull/22320)
- Build: Use `next` branch for sandbox and repro commands [#22238](https://github.com/storybooks/storybook/pull/22238)
## 7.1.0-alpha.11 (April 28, 2023)
#### Features
- Feature: Add support for Angular 16 [#22096](https://github.com/storybooks/storybook/pull/22096)
#### Bug Fixes
- Vue3: Rollback v7 breaking change and keep reactive v6-compatible API [#22229](https://github.com/storybooks/storybook/pull/22229)
#### Maintenance
- Core: Add tests for mapping behaviour in #22169 [#22301](https://github.com/storybooks/storybook/pull/22301)
#### Dependency Upgrades
- Update glob to v10.0.0 [#22171](https://github.com/storybooks/storybook/pull/22171)
## 7.1.0-alpha.10 (April 28, 2023)
#### Bug Fixes
- Vue3: Fix compiler error when there is double tag [#22286](https://github.com/storybooks/storybook/pull/22286)
- Args: Fix multiple mapped args return array of labels [#22169](https://github.com/storybooks/storybook/pull/22169)
- Angular: Fix storyshots by removing deprecated import [#22134](https://github.com/storybooks/storybook/pull/22134)
- Ember: Fix wrong path [#22203](https://github.com/storybooks/storybook/pull/22203)
- CLI: Add web-components webpack5 to missing-babelrc automigration [#22202](https://github.com/storybooks/storybook/pull/22202)
- Docs: Fix inline story style [#21870](https://github.com/storybooks/storybook/pull/21870)
#### Build
- Fix vue-cli/default-js sandbox [#22259](https://github.com/storybooks/storybook/pull/22259)
- Core: Fix `DOCS_RENDERED` test [#22255](https://github.com/storybooks/storybook/pull/22255)
- Packaging: Fix url for all packages in package.json [#22101](https://github.com/storybooks/storybook/pull/22101)
- Add regex to ignore outdated Browserslist in Jest initialization base file [#22260](https://github.com/storybooks/storybook/pull/22260)
## 7.1.0-alpha.9 (April 26, 2023)
#### Features
- NextJS: Allow disabling next/image lazy loading [#21909](https://github.com/storybooks/storybook/pull/21909)
- Core: Allow Flow syntax in stories [#21859](https://github.com/storybooks/storybook/pull/21859)
#### Bug Fixes
- Vue3: Support multiple setup functions [#22170](https://github.com/storybooks/storybook/pull/22170)
- UI: Fix shift + 7 shortcut to focus search field [#22073](https://github.com/storybooks/storybook/pull/22073)
- UI: Fix controls missing when navigating from story [#21967](https://github.com/storybooks/storybook/pull/21967)
#### Maintenance
- Core: Rename manager UI mjs to js [#22247](https://github.com/storybooks/storybook/pull/22247)
- Remove dead code [#22019](https://github.com/storybooks/storybook/pull/22019)
- Vue3: Move TS stories into a separate folder [#22235](https://github.com/storybooks/storybook/pull/22235)
#### Build
- Build: Migrate @storybook/addon-docs to strict-ts [#22180](https://github.com/storybooks/storybook/pull/22180)
- Build: Migrate @storybook/highlight to strict TS [#22181](https://github.com/storybooks/storybook/pull/22181)
- Build: Enable strict TS by default [#22143](https://github.com/storybooks/storybook/pull/22143)
## 7.1.0-alpha.8 (April 24, 2023)
#### Features
- Core: Support custom hosts using window.location server channel URL [#22055](https://github.com/storybooks/storybook/pull/22055)
## 7.0.7 (April 24, 2023)
#### Bug Fixes
- Core: Pass parameters in `SET_INDEX` for docs entries [#22154](https://github.com/storybooks/storybook/pull/22154)
- Addon-actions: Fix ESM by upgrading from uuid-browser to uuid [#22037](https://github.com/storybooks/storybook/pull/22037)
- Addon-actions: Fix decorator type [#22175](https://github.com/storybooks/storybook/pull/22175)
- NextJS: Fix tsconfig resolution [#22160](https://github.com/storybooks/storybook/pull/22160)
- Core: Pass parameters in `SET_INDEX` for docs entries [#22154](https://github.com/storybooks/storybook/pull/22154)
- Core: Add new tags to distinguish docs attachment [#22120](https://github.com/storybooks/storybook/pull/22120)
- Core: Restore Docs `useParameter` using `DOCS_PREPARED` [#22118](https://github.com/storybooks/storybook/pull/22118)
#### Maintenance
- CSF: Improve error message for bad default export [#22190](https://github.com/storybooks/storybook/pull/22190)
- CLI: Add addon query-params to list of SB7 incompatible addons [#22095](https://github.com/storybooks/storybook/pull/22095)
- UI: Add remount story shortcut [#21401](https://github.com/storybooks/storybook/pull/21401)
#### Build
- Build: Fix sandbox publish script [#22206](https://github.com/storybooks/storybook/pull/22206)
- Build: Fix lit sandboxes [#22201](https://github.com/storybooks/storybook/pull/22201)
- Vite sandboxes: use stable Vite 4.3 [#22183](https://github.com/storybooks/storybook/pull/22183)
- Build: Fix sandbox publish script [#22206](https://github.com/storybooks/storybook/pull/22206)
## 7.1.0-alpha.7 (April 19, 2023)
## 7.0.6 (April 19, 2023)
#### Bug Fixes
- Vue3: Fix reactive decorators [#21954](https://github.com/storybooks/storybook/pull/21954)
#### Build
- Build: Improve sandboxes commit message [#22136](https://github.com/storybooks/storybook/pull/22136)
## 7.1.0-alpha.6 (April 18, 2023)
#### Bug Fixes
- Core: Restore Docs `useParameter` using `DOCS_PREPARED` [#22118](https://github.com/storybooks/storybook/pull/22118)
- Core: Add new tags to distinguish docs attachment [#22120](https://github.com/storybooks/storybook/pull/22120)
- Core: Fix `module` guard in non-webpack environments [#22085](https://github.com/storybooks/storybook/pull/22085)
#### Build
- Build: Skip docs pages e2e tests for ssv6 examples [#22141](https://github.com/storybooks/storybook/pull/22141)
- Build: Upgrade Playwright to 1.32.3 [#22087](https://github.com/storybooks/storybook/pull/22087)
#### Dependency Upgrades
- Remove unused babel dependencies [#21984](https://github.com/storybooks/storybook/pull/21984)
## 7.1.0-alpha.5 (April 17, 2023)
#### Maintenance
- CLI: Mark qwik as using addon-interactions [#22000](https://github.com/storybooks/storybook/pull/22000)
#### Build
- Revert "Build: Update dangerfile temporarily to check for patch label" [#22108](https://github.com/storybooks/storybook/pull/22108)
- Build: Upgrade Playwright to 1.32.3 [#22087](https://github.com/storybooks/storybook/pull/22087)
## 7.1.0-alpha.4 (April 15, 2023)
## 7.0.5 (April 15, 2023)
#### Bug Fixes
- Docs: Fix source snippets when parameters.docs.source.type = 'code' [#22048](https://github.com/storybooks/storybook/pull/22048)
- CLI: Mention how to setup a monorepo manually in babelrc automigration [#22052](https://github.com/storybooks/storybook/pull/22052)
## 7.1.0-alpha.3 (April 13, 2023)
#### Bug Fixes
- UI: Fix upgrade command in about page [#22056](https://github.com/storybooks/storybook/pull/22056)
- CLI: Fix sandbox command [#21977](https://github.com/storybooks/storybook/pull/21977)
- CLI: Fix CLI sandbox command [#21977](https://github.com/storybooks/storybook/pull/21977)
## 7.1.0-alpha.2 (April 12, 2023)
## 7.0.4 (April 12, 2023)
#### Features
Storybook 7.0 is here! 🎉
- UI: Add remount story shortcut [#21401](https://github.com/storybooks/storybook/pull/21401)
- ⚡️ [First-class Vite](https://storybook.js.org/blog/first-class-vite-support-in-storybook/)
- 🔼 [Zero-config NextJS](https://storybook.js.org/blog/integrate-nextjs-and-storybook-automatically/)
- 🇸 [Zero-config SvelteKit](https://storybook.js.org/blog/storybook-for-sveltekit/)
- 🏗️ [Frameworks API](https://storybook.js.org/blog/framework-api/)
- 3⃣ [Component Story Format v3](https://storybook.js.org/blog/storybook-csf3-is-here/)
- 🛡️ [Improved type safety](https://storybook.js.org/blog/improved-type-safety-in-storybook-7/)
- 📚 [Docs overhaul with MDx2 support](https://storybook.js.org/blog/storybook-7-docs/)
- ☂️ [Code coverage for interaction testing](https://storybook.js.org/blog/code-coverage-with-the-storybook-test-runner/)
- 🖼️ [UI design refresh](https://storybook.js.org/blog/7-0-design-alpha/)
- 🏛️ [Improved stability](https://storybook.js.org/blog/storybook-ecosystem-ci/)
7.0 contains hundreds more fixes, features, and tweaks. Browse the changelogs matching `7.0.0-alpha.*`, `7.0.0-beta.*`, and `7.0.0-rc.*` for the full list of changes.
See our [Migration guide](https://storybook.js.org/migration-guides/7.0) to upgrade from earlier versions of Storybook.
#### Bug Fixes
- CLI: Catch errors thrown on sanity check of SB installs [#22039](https://github.com/storybooks/storybook/pull/22039)
#### Maintenance
#### Dependency Upgrades
- Addon-docs: Remove mdx1-csf as optional peer dep [#22038](https://github.com/storybooks/storybook/pull/22038)
- Telemetry: Add CLI version to context [#21999](https://github.com/storybooks/storybook/pull/21999)
#### Build
- Build: Use vite@beta on sandboxes [#22030](https://github.com/storybooks/storybook/pull/22030)
- Fix e2e tests failing in Firefox [#22022](https://github.com/storybooks/storybook/pull/22022)
- Vite: Use vite 4.3 beta in sandboxes [#21986](https://github.com/storybooks/storybook/pull/21986)
## 7.1.0-alpha.1 (April 11, 2023)
## 7.0.3 (April 12, 2023)
#### Bug Fixes
@ -363,42 +265,23 @@
- CLI: Fix JsPackageManager typo [#22006](https://github.com/storybooks/storybook/pull/22006)
- Viewport: Fix the `defaultOrientation` config option [#21962](https://github.com/storybooks/storybook/pull/21962)
- UI: Fix story data access for broken About page [#21951](https://github.com/storybooks/storybook/pull/21951)
- Angular: Fix components disappearing on docs page on property change [#21944](https://github.com/storybooks/storybook/pull/21944)
- React: Don't show decorators in JSX snippets [#21907](https://github.com/storybooks/storybook/pull/21907)
- Addon-docs: Include decorators by default in source decorators [#21902](https://github.com/storybooks/storybook/pull/21902)
- CLI: Fix npm list command [#21947](https://github.com/storybooks/storybook/pull/21947)
- Core: Revert Emotion `:first-child` (etc) workarounds [#21213](https://github.com/storybooks/storybook/pull/21213)
#### Maintenance
- UI: Add remount story shortcut [#21401](https://github.com/storybooks/storybook/pull/21401)
- Telemetry: Add CLI version to context [#21999](https://github.com/storybooks/storybook/pull/21999)
- CLI: Update template code references to 7.0 [#21845](https://github.com/storybooks/storybook/pull/21845)
- Addon-actions: Fix non-included type file [#21922](https://github.com/storybooks/storybook/pull/21922)
- Addon GFM: Fix node-logger dependency [#21938](https://github.com/storybooks/storybook/pull/21938)
#### Dependency Upgrades
- React-vite: Fix perf regression by pinning vite-plugin-react-docgen-ts [#22013](https://github.com/storybooks/storybook/pull/22013)
- Use future version of satellite repo dependencies [#22026](https://github.com/storybooks/storybook/pull/22026)
## 7.1.0-alpha.0 (April 5, 2023)
#### Bug Fixes
- Angular: Fix components disappearing on docs page on property change [#21944](https://github.com/storybooks/storybook/pull/21944)
- React: Don't show decorators in JSX snippets [#21907](https://github.com/storybooks/storybook/pull/21907)
- Docs: Include decorators by default in source decorators [#21902](https://github.com/storybooks/storybook/pull/21902)
- CLI: Fix npm list command [#21947](https://github.com/storybooks/storybook/pull/21947)
- Core: Revert Emotion `:first-child` (etc) workarounds [#21213](https://github.com/storybooks/storybook/pull/21213)
- Addon-actions: Fix non-included type file [#21922](https://github.com/storybooks/storybook/pull/21922)
- Addon GFM: Fix node-logger dependency [#21938](https://github.com/storybooks/storybook/pull/21938)
#### Build
- Build: Update trigger circle ci workflow to include main [#21888](https://github.com/storybooks/storybook/pull/21888)
- Build: Update dangerfile temporarily to check for patch label [#21945](https://github.com/storybooks/storybook/pull/21945)
- Build: Re-enable Vue2 Vite sandbox [#21940](https://github.com/storybooks/storybook/pull/21940)
- Build: Fix release badge on repros [#21923](https://github.com/storybooks/storybook/pull/21923)
- Build: fix the workflows to generate sandboxes [#21912](https://github.com/storybooks/storybook/pull/21912)
- Build: bump the node version in CI [#21917](https://github.com/storybooks/storybook/pull/21917)
- Build: no `pnp.cjs` in the root, regen lockfiles [#21908](https://github.com/storybooks/storybook/pull/21908)
- Build: remove pnp sandbox template [#21913](https://github.com/storybooks/storybook/pull/21913)
- Build: make the CI config ready for 7.0 release [#21808](https://github.com/storybooks/storybook/pull/21808)
#### Dependency Upgrades
- Update `@emotion/cache` version [#21941](https://github.com/storybooks/storybook/pull/21941)
## 7.0.2 (April 3, 2023)

90
CHANGELOG.prerelease.md Normal file
View File

@ -0,0 +1,90 @@
## 7.1.0-alpha.41
- Controls: Fix UI to add array items - [#22993](https://github.com/storybookjs/storybook/pull/22993), thanks [@sookmax](https://github.com/sookmax)!
- Next.js: Support disableStaticImages setting - [#23167](https://github.com/storybookjs/storybook/pull/23167), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
## 7.1.0-alpha.40
- CLI: Parse pnp paths in storybook metadata - [#23199](https://github.com/storybookjs/storybook/pull/23199), thanks [@yannbf](https://github.com/yannbf)!
- Dependencies: Pin `file-system-cache` to 2.3.0 - [#23221](https://github.com/storybookjs/storybook/pull/23221), thanks [@JReinhold](https://github.com/JReinhold)!
- PNPM: Hide ModuleNotFound error in pnpm pnp mode - [#23195](https://github.com/storybookjs/storybook/pull/23195), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
- Svelte: Support v4 - [#22905](https://github.com/storybookjs/storybook/pull/22905), thanks [@JReinhold](https://github.com/JReinhold)!
## 7.1.0-alpha.39
- CLI: Add new Configure page to templates - [#23171](https://github.com/storybookjs/storybook/pull/23171), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Fix storybook package manager command in init - [#23169](https://github.com/storybookjs/storybook/pull/23169), thanks [@yannbf](https://github.com/yannbf)!
- React: Add addon-onboarding as part of init - [#22972](https://github.com/storybookjs/storybook/pull/22972), thanks [@yannbf](https://github.com/yannbf)!
## 7.1.0-alpha.38
- CLI: Fix installing user's project before init - [#23145](https://github.com/storybookjs/storybook/pull/23145), thanks [@ndelangen](https://github.com/ndelangen)!
- CLI: Fix storybook dev after storybook init via subprocess - [#23144](https://github.com/storybookjs/storybook/pull/23144), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Suppress dev-server info table when `--quiet` is true - [#23133](https://github.com/storybookjs/storybook/pull/23133), thanks [@syabro](https://github.com/syabro)!
- Core: Allow `.mjs` extension for CSF stories - [#23125](https://github.com/storybookjs/storybook/pull/23125), thanks [@idesigncode](https://github.com/idesigncode)!
- Core: Fix compat by disabling name mangling in `esbuild` require - [#22486](https://github.com/storybookjs/storybook/pull/22486), thanks [@youngboy](https://github.com/youngboy)!
- Docs: Fix scroll location on docs navigation - [#22714](https://github.com/storybookjs/storybook/pull/22714), thanks [@gitstart-storybook](https://github.com/gitstart-storybook)!
- Interactions: Fix deeply nested nodes in the panel debugger - [#23108](https://github.com/storybookjs/storybook/pull/23108), thanks [@yannbf](https://github.com/yannbf)!
## 7.1.0-alpha.37
- Ecosystem: Prebundle node-logger and make it CJS only - [#23109](https://github.com/storybookjs/storybook/pull/23109), thanks [@ndelangen](https://github.com/ndelangen)!
- NextJS: Fix `useParams` support - [#22946](https://github.com/storybookjs/storybook/pull/22946), thanks [@gitstart-storybook](https://github.com/gitstart-storybook)!
- NextJS: Fix fonts not loading with 3+ words in name - [#23121](https://github.com/storybookjs/storybook/pull/23121), thanks [@ygkn](https://github.com/ygkn)!
- Webpack: Fix channel format for loading status - [#23139](https://github.com/storybookjs/storybook/pull/23139), thanks [@ndelangen](https://github.com/ndelangen)!
## 7.1.0-alpha.36
- CLI: Fix "Invalid version null" issues by improved version detection - [#22642](https://github.com/storybookjs/storybook/pull/22642), thanks [@valentinpalkovic](https://github.com/valentinpalkovic)!
- CLI: Prebundle boxen to resolve a ESM/CJS incompatibility - [#23080](https://github.com/storybookjs/storybook/pull/23080), thanks [@ndelangen](https://github.com/ndelangen)!
- Telemetry: Count onboarding stories - [#23092](https://github.com/storybookjs/storybook/pull/23092), thanks [@shilman](https://github.com/shilman)!
## 7.1.0-alpha.35
- CLI: Skip builder selection for react native - [#23042](https://github.com/storybookjs/storybook/pull/23042), thanks [@dannyhw](https://github.com/dannyhw)!
- Core: Fix core-common to use node-fetch - [#23077](https://github.com/storybookjs/storybook/pull/23077), thanks [@ndelangen](https://github.com/ndelangen)!
## 7.1.0-alpha.34
- Angular: Fix ivy preset - [#23070](https://github.com/storybookjs/storybook/pull/23070), thanks [@ndelangen](https://github.com/ndelangen)!
- CLI: Change Button stories layout for React starter templates - [#22951](https://github.com/storybookjs/storybook/pull/22951), thanks [@yannbf](https://github.com/yannbf)!
## 7.1.0-alpha.33
- Bug: Fix for angular 16.1 compatibility - [#23064](https://github.com/storybookjs/storybook/pull/23064), thanks [@ndelangen](https://github.com/ndelangen)!
- Builder-vite: Fix lib/channels dependency - [#23049](https://github.com/storybookjs/storybook/pull/23049), thanks [@ndelangen](https://github.com/ndelangen)!
- CLI: Improve steps in storybook init - [#22502](https://github.com/storybookjs/storybook/pull/22502), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Run `storybook dev` as part of `storybook init` - [#22928](https://github.com/storybookjs/storybook/pull/22928), thanks [@yannbf](https://github.com/yannbf)!
- Core: Merge channels into a single package - [#23032](https://github.com/storybookjs/storybook/pull/23032), thanks [@ndelangen](https://github.com/ndelangen)!
- Core: Unify cache location configurability - [#22079](https://github.com/storybookjs/storybook/pull/22079), thanks [@kubijo](https://github.com/kubijo)!
## 7.1.0-alpha.32
- Build: Remove `babel-core` & upgrade `esbuild` - [#23017](https://github.com/storybookjs/storybook/pull/23017), thanks [@ndelangen](https://github.com/ndelangen)!
- Core: Disable esbuild on files imported from `node_modules` - [#23018](https://github.com/storybookjs/storybook/pull/23018), thanks [@tmeasday](https://github.com/tmeasday)!
- Core: Integrate serverChannel into channel - [#22940](https://github.com/storybookjs/storybook/pull/22940), thanks [@ndelangen](https://github.com/ndelangen)!
- React: Lazy import `react-docgen-typescript-plugin` - [#23019](https://github.com/storybookjs/storybook/pull/23019), thanks [@tmeasday](https://github.com/tmeasday)!
## 7.1.0-alpha.31
- Dependencies: Set vue-component-type-helpers to latest - [#23015](https://github.com/storybookjs/storybook/pull/23015), thanks [@ndelangen](https://github.com/ndelangen)!
- Dependencies: Upgrade `nanoid`, prebundle it, upgrade `remark`, cleanup some `.md` files for warnings - [#23005](https://github.com/storybookjs/storybook/pull/23005), thanks [@ndelangen](https://github.com/ndelangen)!
- Dependencies: Use `latest` version of `vue-tsc` & sync versions of `angular` - [#23011](https://github.com/storybookjs/storybook/pull/23011), thanks [@ndelangen](https://github.com/ndelangen)!
## 7.1.0-alpha.30
- Web-components: Fix custom-elements order of property application - [#19183](https://github.com/storybookjs/storybook/pull/19183), thanks [@sonntag-philipp](https://github.com/sonntag-philipp)!
- Dependencies: Remove `shelljs` use - [#22995](https://github.com/storybookjs/storybook/pull/22995), thanks [@ndelangen](https://github.com/ndelangen)!
- Dependencies: Upgrade Jest related packages - [#22979](https://github.com/storybookjs/storybook/pull/22979), thanks [@ndelangen](https://github.com/ndelangen)!
- Core: Fix `builder-manager` adding multiple dashes to relative path - [#22974](https://github.com/storybookjs/storybook/pull/22974), thanks [@MarioCadenas](https://github.com/MarioCadenas)!
- Core: Add JSDoc comments to `preview-api` APIs - [#22975](https://github.com/storybookjs/storybook/pull/22975), thanks [@ndelangen](https://github.com/ndelangen)!
- Vue3: Fix source decorator to generate correct story code - [#22518](https://github.com/storybookjs/storybook/pull/22518), thanks [@chakAs3](https://github.com/chakAs3)!
- Core: Add JSDoc comments to `manager-api` APIs - [#22968](https://github.com/storybookjs/storybook/pull/22968), thanks [@ndelangen](https://github.com/ndelangen)!
- Core: Improve `of={...}` DocBlock error in story index - [#22782](https://github.com/storybookjs/storybook/pull/22782), thanks [@shilman](https://github.com/shilman)!
- UI: Simplify `overlayscrollbars` component - [#22963](https://github.com/storybookjs/storybook/pull/22963), thanks [@ndelangen](https://github.com/ndelangen)!
- Angular: Add `--open`/`--no-open` flag to `dev` command - [#22964](https://github.com/storybookjs/storybook/pull/22964), thanks [@yannbf](https://github.com/yannbf)!
- Angular: Silence compodoc when running storybook with --quiet - [#22957](https://github.com/storybookjs/storybook/pull/22957), thanks [@yannbf](https://github.com/yannbf)!
- React: Fix decorators to conditionally render children - [#22336](https://github.com/storybookjs/storybook/pull/22336), thanks [@redbugz](https://github.com/redbugz)!
- Addon-measure: Migrate to strict TS - [#22402](https://github.com/storybookjs/storybook/pull/22402), thanks [@efrenaragon96](https://github.com/efrenaragon96)!
- Feature: Add experimental status API - [#22890](https://github.com/storybookjs/storybook/pull/22890), thanks [@ndelangen](https://github.com/ndelangen)!

542
CONTRIBUTING/RELEASING.md Normal file
View File

@ -0,0 +1,542 @@
# Releasing <!-- omit in toc -->
> **Note**
> This document is relevant only for maintainers that have permissions to release new versions of Storybook. Anyone can read it for interest or to suggest changes, but it's not required knowledge.
## Table of Contents <!-- omit in toc -->
- [Introduction](#introduction)
- [Branches](#branches)
- [Release Pull Requests](#release-pull-requests)
- [Prereleases](#prereleases)
- [Patch Releases](#patch-releases)
- [Publishing](#publishing)
- [👉 How to Release](#-how-to-release)
- [1. Find the Prepared Pull Request](#1-find-the-prepared-pull-request)
- [2. Freeze the Pull Request and run CI](#2-freeze-the-pull-request-and-run-ci)
- [3. QA Each Merged Pull Request](#3-qa-each-merged-pull-request)
- [4. Re-trigger the Workflow](#4-re-trigger-the-workflow)
- [5. Make Manual Changes](#5-make-manual-changes)
- [6. Merge](#6-merge)
- [7. See the "Publish" Workflow Finish](#7-see-the-publish-workflow-finish)
- [Releasing Locally in an Emergency 🚨](#releasing-locally-in-an-emergency-)
- [Canary Releases](#canary-releases)
- [Versioning Scenarios](#versioning-scenarios)
- [Prereleases - `7.1.0-alpha.12` -\> `7.1.0-alpha.13`](#prereleases---710-alpha12---710-alpha13)
- [Prerelease promotions - `7.1.0-alpha.13` -\> `7.1.0-beta.0`](#prerelease-promotions---710-alpha13---710-beta0)
- [Minor/major releases - `7.1.0-rc.2` -\> `7.1.0` or `8.0.0-rc.3` -\> `8.0.0`](#minormajor-releases---710-rc2---710-or-800-rc3---800)
- [First prerelease of new major/minor - `7.1.0` -\> `7.2.0-alpha.0` or `8.0.0-alpha.0`](#first-prerelease-of-new-majorminor---710---720-alpha0-or-800-alpha0)
- [Patch releases to stable - subset of `7.1.0-alpha.13` -\> `7.0.14`](#patch-releases-to-stable---subset-of-710-alpha13---7014)
- [Patch releases to earlier versions - subset of `7.1.0-alpha.13` -\> `6.5.14`](#patch-releases-to-earlier-versions---subset-of-710-alpha13---6514)
- [Prerelease of upcoming patch release - `7.0.20` -\> `7.0.21-alpha.0`](#prerelease-of-upcoming-patch-release---7020---7021-alpha0)
- [Merges to `main` without versioning](#merges-to-main-without-versioning)
- [FAQ](#faq)
- [When should I use the "patch" label?](#when-should-i-use-the-patch-label)
- [How do I make changes to the release tooling/process?](#how-do-i-make-changes-to-the-release-toolingprocess)
- [Why do I need to re-trigger workflows to update the changelog?](#why-do-i-need-to-re-trigger-workflows-to-update-the-changelog)
- [Which combination of inputs creates the version bump I need?](#which-combination-of-inputs-creates-the-version-bump-i-need)
- [Which changes are considered "releasable", and what does it mean?](#which-changes-are-considered-releasable-and-what-does-it-mean)
- [Why are no release PRs being prepared?](#why-are-no-release-prs-being-prepared)
- [Why do we need separate release branches?](#why-do-we-need-separate-release-branches)
## Introduction
This document explains the release process for the Storybook monorepo. There are two types:
1. Prereleases and major/minor releases - releasing any content that is on the `next` branch
2. Patch releases - picking any content from `next` to `main`, that needs to be patched back to the current stable minor release
The release process is based on automatically created "Release Pull Requests", that when merged will trigger a new version to be released.
A designated Releaser -- which may rotate between core team members -- will go through the release process in the current Release PR. This process is implemented with NodeJS scripts in [`scripts/release`](../scripts/release/) and three GitHub Actions workflows:
- [Prepare Prerelease PR](../.github/workflows/prepare-prerelease.yml)
- [Prepare Patch PR](../.github/workflows/prepare-patch-release.yml)
- [Publish](../.github/workflows/publish.yml)
> **Note**
> This document distinguishes between **patch** releases and **prereleases**. This is a simplification; stable major and minor releases work the same way as prereleases. The distinction reflects the difference between patching an existing minor version on `main` or releasing a new minor/major/prerelease from `next`.
### Branches
To understand the release structure, it's important to know the branching strategy used. All development is done on the `next` branch, where new features and bug fixes are added. This branch contains content to be released in the next prerelease (eg. `v7.1.0-alpha.22`).
The `main` branch contains the content for the current stable release (eg. `v7.0.20`). When changes need to be made to both the next major/minor release and the current patch release (bug fixes or small improvements), they are made to `next`. If the change needs to be patched back to the current minor version (eg. from `7.1.0-alpha.20` to `7.0.18`), the PR containing the fix is labeled with the **"patch"** label, so the release workflow can pick it up. This ensures changes are tested in a prerelease before being released to stable.
The actual (pre)releases are not made from `next` nor `main`, but from `next-release` and `latest-release` respectively. This indirection is explained in [the "Why do we need separate release branches?" section](#why-do-we-need-separate-release-branches) below.
The branches in the monorepo can be summarized in this diagram (simplified):
```mermaid
%%{init: { 'gitGraph': { 'showCommitLabel': false } } }%%
gitGraph
commit
branch latest-release
branch next
commit
branch next-release
commit
commit tag: "7.1.0-alpha.18"
checkout next
merge next-release
commit id: "bugfix"
commit
checkout latest-release
cherry-pick id: "bugfix"
commit tag: "7.0.20"
checkout next-release
merge next
commit tag: "7.1.0-alpha.19"
checkout next
merge next-release
commit
checkout main
merge latest-release
```
## Release Pull Requests
Two GitHub Actions workflows automatically create release pull requests, one for each type of release. These pull requests act as the "interface" for the Releaser to create a new release. Although the behavior between the two is similar, some minor differences exist, as described in the subsections below.
The high-level flow is:
1. When a PR is merged to `next` (or a commit is pushed), both release pull requests are (re)generated.
2. They create a new branch - `version-(patch|prerelease)-from-<CURRENT-VERSION>`.
3. They bump all versions according to the version strategy.
4. They update `CHANGELOG(.prerelease).md` with all changes detected.
5. They commit everything.
6. They **force push**.
7. They open/edit a pull request towards `next-release` or `latest-release`.
A few key points to note in this flow:
- The PRs are regenerated on any changes to `next`, or can be manually triggered (see [the Re-trigger the Workflow section](#4-re-trigger-the-workflow)).
- The changes are force pushed to the branch, so any manual changes on the release branch before merging risk being overwritten if someone else merges a new change to `next`, triggering the workflow. To avoid this, apply the **"freeze"** label to the pull request.
- The version bumps and changelogs are committed during the preparation, but the packages are not published until later.
- The release pull requests don't target their working branches (`next` and `main`), but rather `next-release` and `latest-release`.
### Prereleases
> **Note**
> Workflow: [`prepare-prerelease.yml`](../.github/workflows/prepare-prerelease.yml)
Prereleases are prepared with all content from the `next` branch. The changelog is generated by examining the git history, and looking up all the commits and pull requests between the current prerelease (on `next-release`) and `HEAD` of `next`.
The default versioning strategy is to increase the current prerelease number, as described in [Prereleases - `7.1.0-alpha.12` -> `7.1.0-alpha.13`](#prereleases---710-alpha12---710-alpha13). If there is no prerelease number (i.e., we just released a new stable minor/major version), it will add one to a patch bump, so it would go from `7.2.0` to `7.2.1-0` by default.
Prerelease PRs are only created if there are actual changes to release. Content labeled with "build" or "documentation" is [not considered "releasable"](#which-changes-are-considered-releasable-and-what-does-it-mean) and is not user-facing, so it doesn't make sense to create a release. This is explained in more detail in [Why are no release PRs being prepared?](#why-are-no-release-prs-being-prepared).
The preparation workflow will create a new branch from `next`, called `version-prerelease-from-<CURRENT-PRERELEASE-VERSION>`, and open a pull request targeting `next-release`. When the Releaser merges it, the [publish workflow](#publishing) will merge `next-release` into `next`.
Here's an example of a workflow where a feature and a bugfix have been created and then released to a new `7.1.0-alpha.29` version. All the commits highlighted with square dots are the ones that will be considered when generating the changelog.
```mermaid
%%{init: { 'gitGraph': { 'mainBranchName': 'next' } } }%%
gitGraph
commit
branch next-release
commit tag: "7.1.0-alpha.28"
checkout next
merge next-release
commit type: HIGHLIGHT id: "direct commit"
branch new-feature
commit
commit
checkout next
merge new-feature type: HIGHLIGHT
branch some-bugfix
commit
checkout next
merge some-bugfix type: HIGHLIGHT
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.28 tag: "7.1.0-alpha.29"
checkout next
merge next-release
```
### Patch Releases
> **Note**
> Workflow: [`prepare-patch-release.yml`](../.github/workflows/prepare-patch-release.yml)
Patch releases are created by [cherry-picking](https://www.atlassian.com/git/tutorials/cherry-pick) any merged, unreleased pull requests that have the "**patch**" label applied to the `next` branch. The merge commit of said pull requests are cherry-picked.
Sometimes it is desired to pick pull requests back to `main` even if they are not considered "releasable". Unlike prerelease preparation, patch releases will not be canceled if the content is not releasable. It might not make sense to create a new patch release if the changes are only for documentation and/or internal build systems. However, getting the changes back to `main` is the only way to deploy the documentation to the production docs site. You may also want to cherry-pick changes to internal CI to fix issues. These are valid scenarios where you want to cherry-pick the changes without being blocked on "releasable" content. In these cases, where all cherry picks are non-releasable, the preparation workflow creates a "merging" pull request instead of a "releasing" pull request. This pull request does not bump versions or update changelogs; it just cherry-picks the changes and allows you to merge them into `latest-release` -> `main`.
The preparation workflow sequentially cherry-picks each patch pull request to its branch. If this cherry-picking fails due to conflicts or other reasons, it is ignored and the next pull request is processed. All failing cherry-picks are listed in the release pull request's description, for the Releaser to manually cherry-pick during the release process. This problem occurs more often when `main` and `next` diverge, i.e. the longer it has been since a stable major/minor release.
Similar to the prerelease flow, the preparation workflow for patches will create a new branch from `main` called `version-patch-from-<CURRENT-STABLE-VERSION>`, and open a pull request that targets `latest-release`. When the pull request is merged by the Releaser, the [publish workflow](#publishing) will eventually merge `latest-release` into `main`.
Here is an example of a workflow where a feature and two bug fixes have been merged to `next`. Only the bug fixes have the "**patch**" label, so only those two go into the new `7.0.19` release. Note that it is the merge commits to `next` that are cherry-picked, not the commits on the bugfix branches.
```mermaid
gitGraph
commit
branch latest-release
branch next
checkout latest-release
commit tag: "v7.0.18"
checkout main
merge latest-release
checkout next
commit
branch some-patched-bugfix
commit
commit id: "patch1"
checkout next
merge some-patched-bugfix
branch new-feature
commit
checkout next
merge new-feature
branch other-patched-bugfix
commit id: "patch2"
checkout next
merge other-patched-bugfix
checkout main
branch version-patch-from-7.0.18
cherry-pick id: "patch1"
cherry-pick id: "patch2"
commit id: "version bump"
checkout latest-release
merge version-patch-from-7.0.18 tag: "v7.0.19"
checkout main
merge latest-release
```
### Publishing
> **Note**
> Workflow: [`publish.yml`](../.github/workflows/publish.yml)
When either a prerelease or a patch release branch is merged into `main` or `next-release`, the publishing workflow is triggered. This workflow performs the following tasks:
1. Install dependencies and build all packages.
2. Publish packages to npm.
3. (If this is a patch release, add the "**picked**" label to all relevant pull requests.)
4. Create a new GitHub Release, including a version tag in the release branch (`latest-release` or `next-release`).
5. Merge the release branch into the core branch (`main` or `next`).
6. (If this is a patch release, copy the `CHANGELOG.md` changes from `main` to `next`.)
7. (If this is [a promotion from a prerelease to a stable release](#minormajor-releases---710-rc2---710-or-800-rc3---800), force push `next` to `main`.)
The publish workflow runs in the "release" GitHub environment, which has the npm token required to publish packages to the `@storybook` npm organization. For security reasons, this environment can only be accessed from the four "core" branches: `main`, `next`, `latest-release` and `next-release`.
## 👉 How to Release
This section explains what a Releaser should do when it's time to release. The steps are also outlined in the release pull requests, to provide guidance for inexperienced Releasers.
The high-level workflow for a Releaser is:
1. Find the prepared pull request
2. Freeze the pull request
3. Make changes to merged pull requests (revert, rename, relabel)
4. Re-trigger the workflow to get changes from step 3 in
5. Make any manual changes needed
6. Merge
7. Check that the "publish" workflow has finished successfully
### 1. Find the Prepared Pull Request
Look for the release pull request that has been prepared for the type of release you're about to release:
- "Release: Prerelease `<NEXT-VERSION>`" for prereleases
- "Release: Patch `<NEXT-VERSION>`" for patch releases
- "Release: Merge patches to `main` (without version bump)" for patches without releases
For example: https://github.com/storybookjs/storybook/pull/23148
### 2. Freeze the Pull Request and run CI
Add the "**freeze**" label to the pull request. This will stop the preparation workflows from running when new changes to `next` are merged. This allows you to make changes without worrying about other people's work overriding yours.
The "**freeze**" label does not cancel the workflows when they are triggered manually, so you can still run the workflow.
You also need to add the "**ci:daily**" label to the pull request to trigger CI runs. This will start a full CI run and re-run on any changes. CI does not run by default to avoid unnecessary re-runs until a new release is being created.
### 3. QA Each Merged Pull Request
It is important to verify that the release includes the right content. Key elements to account for are:
1. Is the change suitable for the version bump?
For example, check if it's a breaking change that isn't allowed in a minor prerelease, or if it's a new feature in a patch release. If it's not suitable, revert the pull request and notify the author.
Sometimes when doing a patch release, a pull request can have the "patch" label but you don't want that change to be part of this release. Maybe you're not confident in the change, or you require more input from maintainers before releasing it. In those situations you should remove the "patch" label from the pull request and follow through with the release (make sure to re-trigger the workflow). When the release is done, add the patch label back again, so it will be part of the next release.
2. Is the pull request title correct?
The title of pull requests is added to the user-facing changelogs, so it must be accurate and understandable. It should follow the pattern "[Area]: [Summary]", where [Area] is the part of the repo that has been changed, and the summary is what has changed.
It's easy to confuse [Area] with labels, but they are not the same. For example, the "**build**" label indicates that the changes are internal, but a "build" [Area] is _not_ correct. The area could be "Core" or "CI", but rarely is the area being changed actually the "build" area.
If a pull request changes multiple places, it can be hard to choose an area - this is often the case when upgrading dependencies - so use your best judgement. There's no hard rule, but a good guideline is that the more precise it is, the more useful it is to read later.
3. Is the pull request labeled correctly?
Some labels have specific meanings when it comes to releases. It's important that each pull request has labels that accurately describe the change, as labels can determine if a pull request is included in the changelog or not. This is explained further in the [Which changes are considered "releasable", and what does it mean?](#which-changes-are-considered-releasable-and-what-does-it-mean) section.
4. Patches: has it already been released in a prerelease?
If this is a patch release, make sure that all pull requests have already been released in a prerelease. If some haven't, create a new prerelease first.
This is not a technical requirement, but it's a good practice to ensure that a change doesn't break a prerelease before releasing it to stable.
### 4. Re-trigger the Workflow
Any changes made to pull requests' titles, labels or even reverts won't be reflected in the release pull request because it's hopefully frozen at this point. Even if it isn't, the workflow only triggers on pushes to `next`, not when pull request meta data is changed.
Therefore, if any changes were made in step 3, you need to re-trigger the workflow manually to regenerate the changelog and the version bump. If no changes were made, this step can be skipped.
It's important to remember that triggering the workflow will force push changes to the branch, so it must be done before committing any changes manually (the next step). Otherwise, these will be overwritten.
> **Warning**
> When re-triggering the workflow, any new content merged to `next` will also become part of the release pull request. You can't assume the same content with fixes will be seen, as new content may have been merged in since the pull request was frozen.
When triggering the workflows, always choose the `next` branch as the base, unless you know exactly what you are doing.
The workflows can be triggered here:
- [Prepare prerelease PR](https://github.com/storybookjs/storybook/actions/workflows/prepare-prerelease.yml)
- [Prepare patch PR](https://github.com/storybookjs/storybook/actions/workflows/prepare-patch-release.yml)
Crucially for prereleases, this is also where you change the versioning strategy if you need something else than the default as described in [Preparing - Prereleases](#prereleases). When triggering the prerelease workflow manually, you can optionally add inputs:
![Screenshot of triggering the prerelease workflow in GitHub Actions, with a form that shows a release type selector and a prerelease identifier text field](prerelease-workflow-inputs.png)
See [Versioning Scenarios](#versioning-scenarios) for a description of each version bump scenario, how to activate it and what it does, and [Which combination of inputs creates the version bump I need?](#which-combination-of-inputs-creates-the-version-bump-i-need) for a detailed description of the workflow inputs.
### 5. Make Manual Changes
It's possible and valid to push manual changes directly on the release branch when needed. This could be to alter the changelog in a way that can't be done automatically, or another critical change is needed for the release to work. Any changes made will be merged to `next|main` once the release has been published.
It's recommended to use the automated process as much as possible to ensure that the information in GitHub is the single source of truth, and that pull requests and changelogs are in sync.
### 6. Merge
When the pull request was frozen, a CI run was triggered on the branch. If it's green, it's time to merge the pull request. If CI is failing for some reason, consult with the rest of the core team. These release pull requests are almost exact copies of `next|main` so CI should only fail if they fail too.
### 7. See the "Publish" Workflow Finish
Merging the pull request will trigger [the publish workflow](https://github.com/storybookjs/storybook/actions/workflows/publish.yml), which does the final publishing. As a Releaser, you're responsible for this to finish successfully, so you should watch it until the end. If it fails, it will notify in Discord, so you can monitor that instead if you want to.
Done! 🚀
## Releasing Locally in an Emergency 🚨
Things can fail, code can break, and bugs can exist. When automation is broken, there may be a need for an emergency escape hatch to release new fixes. In such a situation, it's valid to run the whole release process locally instead of relying on pull requests and workflows. You don't need to create pull requests or split preparation and publishing; you can do it all at once, but make sure you still follow the correct branching strategy.
You need a token to the npm registry to publish (set as `YARN_NPM_AUTH_TOKEN`), which you can get from @shilman or @ndelangen.
You can inspect the workflows to see what they are running and copy that, but here is a general sequence of steps to mimic the automated workflow. Feel free to deviate from this as needed.
Before you start you should make sure that your working tree is clean and the repository is in a clean state by running `git clean -xdf`.
1. Create a new branch from either `next` (prereleases) or `main` (patches)
2. Get all tags: `git fetch --tags origin`
3. Install dependencies: `yarn task --task=install --start-from=install`
4. `cd scripts`
5. (If patch release) Cherry pick:
1. `yarn release:pick-patches`
2. Manually cherry pick any necessary patches based on the previous output
6. Bump versions: `yarn release:version --verbose --release-type <RELEASE_TYPE> --pre-id <PRE_ID>`
7. To see a list of changes (for your own to-do list), run `yarn release:generate-pr-description --current-version <CURRENT_VERSION> --next-version <NEXT_VERSION_FROM_PREVIOUS_STEP> --verbose`
8. Write changelogs: `yarn release:write-changelog <NEXT_VERSION_FROM_PREVIOUS_STEP> --verbose`
9. `git add .`.
10. Commit changes: `git commit -m "Bump version from <CURRENT_VERSION> to <NEXT_VERSION_FROM_PREVIOUS_STEP> MANUALLY"`
11. Merge changes to the release branch:
1. `git checkout <"latest-release" | "next-release">`
2. `git merge <PREVIOUS_BRANCH>`
3. `git push origin`
12. (If automatic publishing is still working, it should kick in now and the rest of the steps can be skipped)
13. `cd ..`
14. Publish to the registry: `YARN_NPM_AUTH_TOKEN=<NPM_TOKEN> yarn release:publish --tag <"next" OR "latest"> --verbose`
15. (If patch release) `yarn release:label-patches`
16. Manually create a GitHub Release with a tag that is the new version and the target being `latest-release` or `next-release`.
17. Merge to core branch:
1. `git checkout <"next"|"main">`
2. `git merge <"next-release"|"latest-release">`
3. `git push origin`
18. (If patch release) Sync `CHANGELOG.md` to `next` with:
1. `git checkout next`
2. `git pull`
3. `git checkout origin/main ./CHANGELOG.md`
4. `git add ./CHANGELOG.md`
5. `git commit -m "Update CHANGELOG.md for v<NEXT_VERSION>"`
6. `git push origin`
## Canary Releases
Not implemented yet. Still work in progress, stay tuned.
## Versioning Scenarios
There are multiple types of releases that use the same principles, but are done somewhat differently.
### Prereleases - `7.1.0-alpha.12` -> `7.1.0-alpha.13`
This is the default strategy for prereleases, there's nothing special needed to trigger this scenario.
### Prerelease promotions - `7.1.0-alpha.13` -> `7.1.0-beta.0`
To promote a prerelease to a new prerelease ID, during the [Re-trigger the Workflow](#4-re-trigger-the-workflow) step, choose:
- Release type: Prerelease
- Prerelease ID: The ID to promote to. For example, for alpha to beta, write "beta".
### Minor/major releases - `7.1.0-rc.2` -> `7.1.0` or `8.0.0-rc.3` -> `8.0.0`
To promote a prerelease to a new prerelease ID, during the [Re-trigger the Workflow](#4-re-trigger-the-workflow) step, choose:
- Release type: Patch
- Prerelease ID: Leave empty
The "Patch" release type ensures the current prerelease version gets promoted to a stable version without any major/minor/patch bumps.
This scenario is special as it turns the `next` branch into a stable branch (until the next prerelease). Therefore, this will also force push `next` to `main`, to ensure that `main` contains the latest stable release. Consequently, the history for `main` is lost.
### First prerelease of new major/minor - `7.1.0` -> `7.2.0-alpha.0` or `8.0.0-alpha.0`
This is the first prerelease after a stable major/minor has been released. The default versioning strategy for prereleases won't work here, because it will do `7.1.0` -> `7.1.1-0`. You need to use the workflow inputs to bump the major/minor correctly:
- Release type: Premajor for `8.0.0-alpha.0` or Preminor for `7.2.0-alpha.0`
- Prerelease ID: "alpha"
### Patch releases to stable - subset of `7.1.0-alpha.13` -> `7.0.14`
This is the default patch release scenario, which cherry picks patches to `main`.
### Patch releases to earlier versions - subset of `7.1.0-alpha.13` -> `6.5.14`
This happens so rarely on a case by case basis, so this is a completely manual process. The Releaser will find the git tag that matches the patch to bump, eg. `v6.5.14`, check it out, make the necessary changes and follow [the manual release process](#releasing-locally-in-case-of-emergency-🚨).
### Prerelease of upcoming patch release - `7.0.20` -> `7.0.21-alpha.0`
In some cases, a patch change is so big and complex that it makes sense to first release it as a prerelease of the current patch stable version to see if it works, before releasing it to stable shortly thereafter.
No process is defined for this.
### Merges to `main` without versioning
As described in more details in [the Patch Releases section](#patch-releases), there are scenarios where you want to patch [unreleasable](#which-changes-are-considered-releasable-and-what-does-it-mean) content back to `main` without bumping versions or publishing a new release. This happens automatically as long as all the unpicked patch pull requests have unreleasable labels. In that case the prepared patch pull request will change form slighty, to just cherry-picking the patches without bumping the versions.
## FAQ
### When should I use the "patch" label?
Not all pull requests need to be patched back to the stable release, which is why only those with the **"patch"** label gets that treatment. But how do you decide whether or not a give pull requests should have that label?
First of all, patches are only for fixes and minor improvements, and not completely new features. A pull request that introduces a new feature shouldn't be patched back to the stable release.
Second, any destabilizing changes shouldn't be patched back either. Breaking changes are reserved for major releases, but changes can be destabilizing without being strictly breaking, and those shouldn't be patched back either. An example is moving the settings panel in the manager to a completely different place, but with the same functionality. Many wouldn't consider this breaking because no usage will stop working because of this, but it can be considered a destabilizing change because user behavior have to change as a result of this.
When in doubt ask the core team for their input.
### How do I make changes to the release tooling/process?
The whole process is based on [GitHub Action workflows](../.github/workflows/) and [scripts](../scripts/release/), so you can modify them if you know what you're doing.
The short answer to "how", is to make changes as a regular pull request that is also patched back to `main`.
There's a longer answer too, but it's pretty confusing:
The scripts run from either `main` or `next`, so if you're changing a release script, you must patch it back to `main` for it to have an effect on patch releases. If you need the change to take effect immediately, you must manually cherry pick it to `main`.
For workflow file changes, they usually run from `next`, but patching them back is recommended for consistency. The "publish" workflow runs from `latest-release` and `next-release`, so you should always patch changes back for _that_. 🙃
### Why do I need to re-trigger workflows to update the changelog?
Changes to pull requests' titles, labels or even reverts won't be reflected in the release pull request. This is because the workflow only triggers on pushes to `next`, not when pull request meta data is changed.
Therefore, if you've made any changes to pull requests, you must re-trigger the workflow manually to regenerate the changelog and the version bump. You could also make the changes to the changelog manually, but it means that the pull requests and their title/labels are no longer the single source of truth.
### Which combination of inputs creates the version bump I need?
Each versioning scenario including how to trigger it with inputs is described in [Versioning Scenarios](#versioning-scenarios). You can also see [the tests for the versioning script](https://github.com/storybookjs/storybook/blob/next/scripts/release/__tests__/version.test.ts#L137-L161) to determine which inputs create which outputs.
### Which changes are considered "releasable", and what does it mean?
A specific set of labels define which kind of change a pull request is, and whether it is a "releasable" change or not. Releasable changes will appear in the changelog and will trigger version bumps, while unreleasable changes will not.
The exact list of labels and their type is written [here](https://github.com/storybookjs/storybook/blob/next/scripts/release/utils/get-changes.ts#L9-L21). Currently, releasable labels are:
- BREAKING CHANGE
- Feature request
- Bug
- Maintenance
- Dependencies
And unreleasable labels are:
- Documentation
- Build
If a pull request does not have any of the above labels at the time of release, it is considered an unreleasable change. Unreleasable changes are changes that do not affect the user through releases. Documentation-only changes are unreleasable, because they are not part of packages and do not change behavior. Similarly, "build" changes are only internal-facing and do not change behavior. This could be tests, CI, etc.
### Why are no release PRs being prepared?
This is most likely because `next` only contains [unreleasable changes](#which-changes-are-considered-releasable-and-what-does-it-mean), which causes the preparation workflow to cancel itself. That's because it doesn't make sense to prepare a new release if all the changes are unreleasable, as that wouldn't bump the version nor write a new changelog entry, so "releasing" it would just merge it back to `next` without any differences.
You can always see the workflows and if they have been cancelled [here for prereleases](https://github.com/storybookjs/storybook/actions/workflows/prepare-prerelease.yml) and [here for patch releases](https://github.com/storybookjs/storybook/actions/workflows/prepare-patch-release.yml).
### Why do we need separate release branches?
A simpler branching approach would be to merge the versioning branches back to `main` or `next` instead of `latest-release` or `next-release`, and then trigger the publishing directly on that branch. That is what tools like [Changesets](https://github.com/changesets/changesets) do.
The problem with that is you could end up publishing changes that were not part of the prepared pull request, and thus not part of QA nor the changelog.
For example, if the Releaser is creating a new release with the frozen branch and another team member merges a new pull request - "some-simultaneous-bugfix - to `next` _during_ the QA steps:
```mermaid
%%{init: { 'gitGraph': { 'mainBranchName': 'next' } } }%%
gitGraph
commit type: HIGHLIGHT
branch new-feature
commit
commit
checkout next
merge new-feature type: HIGHLIGHT
branch some-simultaneous-bugfix
commit
checkout next
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
checkout next
merge some-simultaneous-bugfix type: HIGHLIGHT id: "whoops!"
merge version-prerelease-from-7.1.0-alpha.28 tag: "v7.1.0-alpha.29"
```
When publishing at the last commit with tag `v7.1.0-alpha.29`, it will publish whatever the content is at that point (all the square dots), which includes the "whoops!" commit from merging the bugfix. But the bugfix was never part of the release pull request because it got prepared before the bugfix was merged in.
If we instead publish from `next-release` and then merge to `next`, the bugfix won't be part of the current release, but the next one:
```mermaid
%%{init: { 'gitGraph': { 'mainBranchName': 'next' } } }%%
gitGraph
commit type: HIGHLIGHT
branch next-release
branch new-feature
commit
commit
checkout next
merge new-feature type: HIGHLIGHT
branch some-simultanous-bugfix
commit
checkout next
branch version-prerelease-from-7.1.0-alpha.28
commit id: "bump version"
checkout next
merge some-simultanous-bugfix id: "whoops!"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.28 tag: "v7.1.0-alpha.29"
checkout next
merge next-release
branch version-prerelease-from-7.1.0-alpha.29
commit id: "bump version again"
checkout next-release
merge version-prerelease-from-7.1.0-alpha.29 tag: "v7.1.0-alpha.30"
checkout next
merge next-release
```
This is because the way that "unreleased" changes are found is to list all the commits that are part of the current history of `HEAD`, _except_ for the commits that are part of the history of the latest version tag. And since the bugfix is not part of the history of the previous version, it will be included.

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -25,6 +25,7 @@
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [Ignore story files from node\_modules](#ignore-story-files-from-node_modules)
- [7.0 Core changes](#70-core-changes)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [Story context is prepared before for supporting fine grained updates](#story-context-is-prepared-before-for-supporting-fine-grained-updates)
@ -833,6 +834,28 @@ With [nginx](https://www.nginx.com/), you need to extend [the MIME type handling
It would otherwise default to serving the `.mjs` files as `application/octet-stream`.
##### Ignore story files from node_modules
In 6.x Storybook literally followed the glob patterns specified in your `.storybook/main.js` `stories` field. Storybook 7.0 ignores files from `node_modules` unless your glob pattern includes the string `"node_modules"`.
Given the following `main.js`:
```js
export default {
stories: ['../**/*.stories.*']
}
```
If you want to restore the previous behavior to include `node_modules`, you can update it to:
```js
export default {
stories: ['../**/*.stories.*', '../**/node_modules/**/*.stories.*']
}
```
The first glob would have node_modules automatically excluded by Storybook, and the second glob would include all stories that are under a nested `node_modules` directory.
### 7.0 Core changes
#### 7.0 feature flags removed
@ -1110,7 +1133,7 @@ In v6.x `@storybook/web-components` had a peer dependency on `lit-html` v1 or v2
#### Create React App: dropped CRA4 support
Since v7 [drops webpack4 support](#webpack4-support-discontinued), it longer supports Create React App < 5.0. If you're using an earlier version of CRA, please upgrade or stay on Storybook 6.x.
Since v7 [drops webpack4 support](#webpack4-support-discontinued), it no longer supports Create React App < 5.0. If you're using an earlier version of CRA, please upgrade or stay on Storybook 6.x.
#### HTML: No longer auto-dedents source code
@ -1187,8 +1210,8 @@ This can result in errors if you are using experimental JS features in your addo
or using babel dependent features such as Component selectors in Emotion.
ESbuild also places some constraints on things you can import into your addon's manager code: only woff2 files are supported, and not all image file types are supported.
Here's the list of supported file types:
https://github.com/storybookjs/storybook/blob/4a37372f649e85e7a0c35b0493da016dbb5dee17/code/lib/builder-manager/src/index.ts#L54-L64
Here's the [list](https://github.com/storybookjs/storybook/blob/next/code/builders/builder-manager/src/index.ts#L53-L70) of supported file types.
This is not configurable.
If this is a problem for your addon, you need to pre-compile your addon's manager code to ensure it works.

View File

@ -69,7 +69,15 @@ module.exports = {
},
{
// these packages use pre-bundling, dependencies will be bundled, and will be in devDepenencies
files: ['addons/**/*', 'frameworks/**/*', 'lib/**/*', 'renderers/**/*', 'ui/**/*'],
files: [
'addons/**/*',
'frameworks/**/*',
'lib/**/*',
'builders/**/*',
'deprecated/**/*',
'renderers/**/*',
'ui/**/*',
],
excludedFiles: ['frameworks/angular/**/*', 'frameworks/ember/**/*', 'lib/core-server/**/*'],
rules: {
'import/no-extraneous-dependencies': [

View File

@ -25,5 +25,5 @@ plugins:
unsafeHttpWhitelist:
- localhost
yarnPath: ../.yarn/releases/yarn-3.4.1.cjs
yarnPath: ../.yarn/releases/yarn-3.5.1.cjs
installStatePath: '../.yarn/code-install-state.gz'

View File

@ -15,6 +15,7 @@ function __setMockFiles(newMockFiles) {
const readFile = async (filePath) => mockFiles[filePath];
const readFileSync = (filePath = '') => mockFiles[filePath];
const existsSync = (filePath) => !!mockFiles[filePath];
const readJson = (filePath = '') => JSON.parse(mockFiles[filePath]);
const readJsonSync = (filePath = '') => JSON.parse(mockFiles[filePath]);
const lstatSync = (filePath) => ({
isFile: () => !!mockFiles[filePath],
@ -24,6 +25,7 @@ const lstatSync = (filePath) => ({
fs.__setMockFiles = __setMockFiles;
fs.readFile = readFile;
fs.readFileSync = readFileSync;
fs.readJson = readJson;
fs.readJsonSync = readJsonSync;
fs.existsSync = existsSync;
fs.lstatSync = lstatSync;

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Test component compliance with web accessibility standards",
"keywords": [
"a11y",
@ -63,16 +63,16 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addon-highlight": "7.1.0-alpha.25",
"@storybook/channels": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/addon-highlight": "7.1.0-alpha.41",
"@storybook/channels": "7.1.0-alpha.41",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"axe-core": "^4.2.0",
"lodash": "^4.17.21",
"react-resize-detector": "^7.1.2"
@ -104,7 +104,7 @@
"./src/preview.tsx"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Accessibility",
"icon": "https://user-images.githubusercontent.com/263385/101991665-47042f80-3c7c-11eb-8f00-64b5a18f498a.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Get UI feedback when an action is performed on an interactive element",
"keywords": [
"storybook",
@ -80,14 +80,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"polished": "^4.2.2",
@ -125,7 +125,7 @@
"./src/preview.ts"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Actions",
"unsupportedFrameworks": [

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Switch backgrounds to view components in different settings",
"keywords": [
"addon",
@ -76,14 +76,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"memoizerific": "^1.11.3",
"ts-dedent": "^2.0.0"
},
@ -112,7 +112,7 @@
"./src/preview.tsx"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Backgrounds",
"icon": "https://user-images.githubusercontent.com/263385/101991667-479cc600-3c7c-11eb-96d3-410e936252e7.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-controls",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Interact with component inputs dynamically in the Storybook UI",
"keywords": [
"addon",
@ -68,15 +68,15 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/blocks": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/blocks": "7.1.0-alpha.41",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/node-logger": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"lodash": "^4.17.21",
"ts-dedent": "^2.0.0"
},
@ -102,7 +102,7 @@
],
"platform": "browser"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Controls",
"icon": "https://user-images.githubusercontent.com/263385/101991669-479cc600-3c7c-11eb-93d9-38b67e8371f2.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Document component usage and properties in Markdown",
"keywords": [
"addon",
@ -99,19 +99,19 @@
"dependencies": {
"@jest/transform": "^29.3.1",
"@mdx-js/react": "^2.1.5",
"@storybook/blocks": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/csf-plugin": "7.1.0-alpha.25",
"@storybook/csf-tools": "7.1.0-alpha.25",
"@storybook/blocks": "7.1.0-alpha.41",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/csf-plugin": "7.1.0-alpha.41",
"@storybook/csf-tools": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/mdx2-csf": "^1.0.0",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/postinstall": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/react-dom-shim": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.41",
"@storybook/postinstall": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/react-dom-shim": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"fs-extra": "^11.1.0",
"remark-external-links": "^8.0.0",
"remark-slug": "^6.0.0",
@ -141,7 +141,7 @@
"@storybook/mdx1-csf"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Docs",
"icon": "https://user-images.githubusercontent.com/263385/101991672-48355c80-3c7c-11eb-82d9-95fa12438f64.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-essentials",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Curated addons to bring out the best of Storybook",
"keywords": [
"addon",
@ -119,23 +119,23 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addon-actions": "7.1.0-alpha.25",
"@storybook/addon-backgrounds": "7.1.0-alpha.25",
"@storybook/addon-controls": "7.1.0-alpha.25",
"@storybook/addon-docs": "7.1.0-alpha.25",
"@storybook/addon-highlight": "7.1.0-alpha.25",
"@storybook/addon-measure": "7.1.0-alpha.25",
"@storybook/addon-outline": "7.1.0-alpha.25",
"@storybook/addon-toolbars": "7.1.0-alpha.25",
"@storybook/addon-viewport": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/addon-actions": "7.1.0-alpha.41",
"@storybook/addon-backgrounds": "7.1.0-alpha.41",
"@storybook/addon-controls": "7.1.0-alpha.41",
"@storybook/addon-docs": "7.1.0-alpha.41",
"@storybook/addon-highlight": "7.1.0-alpha.41",
"@storybook/addon-measure": "7.1.0-alpha.41",
"@storybook/addon-outline": "7.1.0-alpha.41",
"@storybook/addon-toolbars": "7.1.0-alpha.41",
"@storybook/addon-viewport": "7.1.0-alpha.41",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/node-logger": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/vue": "7.1.0-alpha.25",
"@storybook/vue": "7.1.0-alpha.41",
"typescript": "^4.9.3"
},
"peerDependencies": {
@ -166,5 +166,5 @@
],
"platform": "node"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920"
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-mdx-gfm",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "GitHub Flavored Markdown in Storybook",
"keywords": [
"addon",
@ -51,7 +51,7 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.41",
"remark-gfm": "^3.0.1",
"ts-dedent": "^2.0.0"
},
@ -69,5 +69,5 @@
"cjs"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920"
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
}

View File

@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true,
"strict": false
"strict": true
},
"include": ["src/**/*"]
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-highlight",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Highlight DOM nodes within your stories",
"keywords": [
"storybook-addons",
@ -61,9 +61,9 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.1.0-alpha.25"
"@storybook/preview-api": "7.1.0-alpha.41"
},
"devDependencies": {
"@types/webpack-env": "^1.16.0",
@ -78,7 +78,7 @@
"./src/preview.ts"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"sbmodern": "dist/modern/index.js",
"storybook": {
"displayName": "Highlight",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-interactions",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Automate, test and debug user interactions",
"keywords": [
"storybook-addons",
@ -72,24 +72,24 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/instrumenter": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"jest-mock": "^27.0.6",
"@storybook/instrumenter": "7.1.0-alpha.41",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"jest-mock": "^29.5.0",
"polished": "^4.2.2",
"ts-dedent": "^2.2.0"
},
"devDependencies": {
"@devtools-ds/object-inspector": "^1.1.2",
"@storybook/jest": "future",
"@storybook/testing-library": "future",
"@storybook/jest": "next",
"@storybook/testing-library": "next",
"@types/node": "^16.0.0",
"formik": "^2.2.9",
"typescript": "~4.9.3"
@ -114,11 +114,10 @@
"./src/index.ts",
"./src/manager.tsx",
"./src/preview.ts",
"./src/preset/checkActionsLoaded.ts"
],
"platform": "node"
"./src/preset.ts"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Interactions",
"unsupportedFrameworks": [

View File

@ -1,4 +1,4 @@
const { checkActionsLoaded } = require('./dist/preset/checkActionsLoaded');
const { checkActionsLoaded } = require('./dist/preset');
function previewAnnotations(entry = [], options) {
checkActionsLoaded(options.configDir);

View File

@ -141,7 +141,14 @@ export const Node = ({
/* eslint-enable no-underscore-dangle */
case Object.prototype.toString.call(value) === '[object Object]':
return <ObjectNode value={value} showInspector={showObjectInspector} {...props} />;
return (
<ObjectNode
value={value}
showInspector={showObjectInspector}
callsById={callsById}
{...props}
/>
);
default:
return <OtherNode value={value} {...props} />;
}
@ -222,11 +229,13 @@ export const ArrayNode = ({
export const ObjectNode = ({
showInspector,
value,
callsById,
nested = false,
}: {
showInspector?: boolean;
value: object;
nested?: boolean;
callsById?: Map<Call['id'], Call>;
}) => {
const isDarkMode = useTheme().base === 'dark';
const colors = useThemeColors();
@ -253,7 +262,7 @@ export const ObjectNode = ({
.map(([k, v]) => (
<Fragment key={k}>
<span style={{ color: colors.objectkey }}>{k}: </span>
<Node value={v} nested />
<Node value={v} callsById={callsById} nested />
</Fragment>
)),
<span>, </span>

View File

@ -31,10 +31,9 @@ export const Step = {
export const TypeAndClear = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
// TODO: seems like userEvent.type + userEvent.clear + userEvent.type is not working for Svelte and Vue2/3. We should probably investigate, might be a bug in userEvent or in our implementation.
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'initial value' } });
await fireEvent.input(canvas.getByTestId('value'), { target: { value: '' } });
await fireEvent.input(canvas.getByTestId('value'), { target: { value: 'final value' } });
await userEvent.type(canvas.getByTestId('value'), 'initial value');
await userEvent.clear(canvas.getByTestId('value'));
await userEvent.type(canvas.getByTestId('value'), 'final value');
},
};
@ -96,3 +95,28 @@ export const Validation = {
await expect(args.onSuccess).not.toHaveBeenCalled();
},
};
export const UserEventSetup = {
play: async (context) => {
const { args, canvasElement, step } = context;
const user = userEvent.setup();
const canvas = within(canvasElement);
await step('Select, type and paste on input using user-event v14 setup', async () => {
const input = await canvas.getByRole('textbox');
await user.click(input);
await user.type(input, 'Pasting: ');
await user.paste('foobar');
});
await step('Tab and press enter on submit button', async () => {
await user.pointer([
{ keys: '[TouchA>]', target: await canvas.getByRole('textbox') },
{ keys: '[/TouchA]' },
]);
await user.tab();
await user.keyboard('{enter}');
const submitButton = await canvas.findByRole('button');
await expect(submitButton).toHaveFocus();
await expect(args.onSuccess).toHaveBeenCalled();
});
},
};

View File

@ -253,12 +253,12 @@ Default.parameters = {
## TODO
- [ ] Add coverage
- [ ] Display nested test better (describe)
- [ ] Display the date of the test
- [ ] Add unit tests
- [ ] Add linting
- [ ] Split <TestPanel />
- Add coverage
- Display nested test better (describe)
- Display the date of the test
- Add unit tests
- Add linting
- Split <TestPanel />
## Contributing

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",
@ -70,15 +70,16 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"react-resize-detector": "^7.1.2",
"upath": "^1.2.0"
"tiny-invariant": "^1.3.1",
"upath": "^2.0.1"
},
"devDependencies": {
"typescript": "~4.9.3"
@ -105,7 +106,7 @@
],
"platform": "browser"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Jest",
"icon": "https://pbs.twimg.com/profile_images/821713465245102080/mMtKIMax_400x400.jpg",

View File

@ -15,11 +15,11 @@ const titleEndToken = ':';
type MsgElement = string | JSX.Element;
class TestDetail {
description: MsgElement[];
description!: MsgElement[];
result: MsgElement[];
result!: MsgElement[];
stackTrace: string;
stackTrace!: string;
}
const StackTrace = styled.pre(({ theme }) => ({
background: theme.color.lighter,

View File

@ -75,7 +75,7 @@ const SuiteTotals = styled(UnstyledSuiteTotals)(({ theme }) => ({
},
}));
const SuiteProgressPortion = styled.div<{ color: any; progressPercent: number }>(
const SuiteProgressPortion = styled.div<{ color?: string; progressPercent: number }>(
({ color, progressPercent }) => ({
height: 6,
top: 3,
@ -114,7 +114,7 @@ const getColorByType = (type: string) => {
case StatusTypes.TODO_TYPE:
return convert(themes.light).color.purple;
default:
return null;
return undefined;
}
};
@ -132,8 +132,8 @@ const TestPanel: FC<{ test: Test }> = ({ test }) => {
return (
<section ref={ref}>
<SuiteHead>
<SuiteTotals {...{ result, width }} />
{width > 240 ? (
<SuiteTotals {...{ result, width: width ?? 0 }} />
{width != null && width > 240 ? (
<ProgressWrapper>
{sortedTestsByCount.map((entry: any) => {
return (
@ -261,7 +261,7 @@ const Content = styled(({ tests, className }: ContentProps) => (
});
interface PanelProps {
tests: null | Test[];
tests?: Test[];
}
const Panel = ({ tests }: PanelProps) => (
@ -287,7 +287,7 @@ const Panel = ({ tests }: PanelProps) => (
);
Panel.defaultProps = {
tests: null,
tests: undefined,
};
export default provideJestResult(Panel);

View File

@ -1,6 +1,7 @@
import React, { Fragment, useState } from 'react';
import { styled, themes, convert } from '@storybook/theming';
import { Icons } from '@storybook/components';
// eslint-disable-next-line import/no-named-as-default
import Message from './Message';
const Wrapper = styled.div<{ status: string }>(({ theme, status }) => ({
@ -8,7 +9,7 @@ const Wrapper = styled.div<{ status: string }>(({ theme, status }) => ({
width: '100%',
borderTop: `1px solid ${theme.appBorderColor}`,
'&:hover': {
background: status === `failed` ? theme.background.hoverable : null,
background: status === `failed` ? theme.background.hoverable : undefined,
},
}));
@ -18,7 +19,7 @@ const HeaderBar = styled.div<{ status: string }>(({ theme, status }) => ({
background: 'none',
color: 'inherit',
textAlign: 'left',
cursor: status === `failed` ? 'pointer' : null,
cursor: status === `failed` ? 'pointer' : undefined,
borderLeft: '3px solid transparent',
width: '100%',
display: 'flex',
@ -72,7 +73,7 @@ export function Result(props: ResultProps) {
}}
/>
) : null}
<div>{capitalizeFirstLetter(fullName) || capitalizeFirstLetter(title)}</div>
<div>{capitalizeFirstLetter(fullName ?? '') || capitalizeFirstLetter(title ?? '')}</div>
</HeaderBar>
</Wrapper>
{isOpen ? (

View File

@ -71,9 +71,9 @@ export const provideTests = (Component: ComponentType<InjectedProps>) =>
this.setState({ kind, storyName, tests });
};
mounted: boolean;
mounted!: boolean;
stopListeningOnStory: () => void;
stopListeningOnStory!: () => void;
render() {
const { active } = this.props;

View File

@ -1,3 +1,4 @@
import invariant from 'tiny-invariant';
import type { StorybookInternalParameters } from '@storybook/types';
// addons, panels and events get unique names using a prefix
@ -23,7 +24,9 @@ export function defineJestParameter(parameters: AddonParameters): string[] | nul
}
if (jest === undefined && typeof filePath === 'string') {
const fileName = filePath.split('/').pop().split('.')[0];
const lastPath = filePath.split('/').pop();
invariant(lastPath != null, 'split should always return at least one value');
const fileName = lastPath.split('.')[0];
return [fileName];
}

View File

@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"strict": false
"strict": true
},
"include": ["src/**/*"]
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-links",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Link stories together to build demos and prototypes with your UI components",
"keywords": [
"addon",
@ -80,14 +80,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/csf": "^0.1.0",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/router": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/router": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"prop-types": "^15.7.2",
"ts-dedent": "^2.0.0"
},
@ -119,7 +119,7 @@
],
"post": "./scripts/fix-preview-api-reference.ts"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Links",
"icon": "https://user-images.githubusercontent.com/263385/101991673-48355c80-3c7c-11eb-9b6e-b627c96a75f6.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-measure",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Inspect layouts by visualizing the box model",
"keywords": [
"storybook-addons",
@ -75,13 +75,14 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25"
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"tiny-invariant": "^1.3.1"
},
"devDependencies": {
"typescript": "~4.9.3"
@ -108,7 +109,7 @@
"./src/preview.tsx"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Measure",
"unsupportedFrameworks": [

View File

@ -1,5 +1,6 @@
/* eslint-disable no-param-reassign */
import { global } from '@storybook/global';
import invariant from 'tiny-invariant';
interface Size {
width: number;
@ -25,6 +26,7 @@ function createCanvas(): CanvasState {
const canvas = global.document.createElement('canvas');
canvas.id = 'storybook-addon-measure';
const context = canvas.getContext('2d');
invariant(context != null);
// Set canvas width & height
const { width, height } = getDocumentWidthAndHeight();
setCanvasWidthAndHeight(canvas, context, { width, height });
@ -67,16 +69,18 @@ export function init() {
export function clear() {
if (state.context) {
state.context.clearRect(0, 0, state.width, state.height);
state.context.clearRect(0, 0, state.width ?? 0, state.height ?? 0);
}
}
export function draw(callback: (context: CanvasRenderingContext2D) => void) {
export function draw(callback: (context?: CanvasRenderingContext2D) => void) {
clear();
callback(state.context);
}
export function rescale() {
invariant(state.canvas, 'Canvas should exist in the state.');
invariant(state.context, 'Context should exist in the state.');
// First reset so that the canvas size doesn't impact the container size
setCanvasWidthAndHeight(state.canvas, state.context, { width: 0, height: 0 });
@ -91,7 +95,7 @@ export function rescale() {
export function destroy() {
if (state.canvas) {
clear();
state.canvas.parentNode.removeChild(state.canvas);
state.canvas.parentNode?.removeChild(state.canvas);
state = {};
}
}

View File

@ -285,7 +285,7 @@ export function labelStacks(
acc[l.position] = [];
}
acc[l.position].push(l);
acc[l.position]?.push(l);
return acc;
}, {});

View File

@ -282,7 +282,7 @@ function drawContent(
}
function drawBoxModel(element: HTMLElement) {
return (context: CanvasRenderingContext2D) => {
return (context?: CanvasRenderingContext2D) => {
if (element && context) {
const measurements = measureElement(element);

View File

@ -2,6 +2,6 @@
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"compilerOptions": {
"strict": false
"strict": true
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-outline",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Outline all elements with CSS to help with layout placement and alignment",
"keywords": [
"storybook-addons",
@ -78,13 +78,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
@ -112,7 +112,7 @@
"./src/preview.tsx"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Outline",
"unsupportedFrameworks": [

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Take a code snapshot of every story automatically with Jest",
"keywords": [
"addon",
@ -32,20 +32,21 @@
"*.d.ts"
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
"@jest/transform": "^29.3.1",
"@storybook/babel-plugin-require-context-hook": "1.0.1",
"@storybook/client-api": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/core-webpack": "7.1.0-alpha.25",
"@storybook/client-api": "7.1.0-alpha.41",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/core-webpack": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"@types/jest-specific-snapshot": "^0.5.6",
"glob": "^10.0.0",
"jest-specific-snapshot": "^7.0.0",
"jest-specific-snapshot": "^8.0.0",
"preact-render-to-string": "^5.1.19",
"pretty-format": "^29.0.0",
"react-test-renderer": "^16.8.0 || ^17.0.0 || ^18.0.0",
@ -53,22 +54,21 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@angular/core": "^13.3.6",
"@angular/platform-browser-dynamic": "^13.3.6",
"@angular/core": "^16.0.0-rc.4",
"@angular/platform-browser-dynamic": "^16.0.0-rc.4",
"@emotion/jest": "^11.8.0",
"@storybook/addon-docs": "7.1.0-alpha.25",
"@storybook/angular": "7.1.0-alpha.25",
"@storybook/react": "7.1.0-alpha.25",
"@storybook/vue": "7.1.0-alpha.25",
"@storybook/vue3": "7.1.0-alpha.25",
"@storybook/addon-docs": "7.1.0-alpha.41",
"@storybook/angular": "7.1.0-alpha.41",
"@storybook/react": "7.1.0-alpha.41",
"@storybook/vue": "7.1.0-alpha.41",
"@storybook/vue3": "7.1.0-alpha.41",
"babel-loader": "^9.1.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.6.1",
"jest-preset-angular": "^12.2.3",
"jest-preset-angular": "^13.0.1",
"jest-vue-preprocessor": "^1.7.1",
"react-test-renderer": "^16",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"vue-jest": "^5.0.0-alpha.8"
},
@ -141,7 +141,7 @@
"access": "public"
},
"bundler": {},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Storyshots",
"icon": "https://user-images.githubusercontent.com/263385/101991676-48cdf300-3c7c-11eb-8aa1-944dab6ab29b.png",

View File

@ -7,7 +7,7 @@ describe('getSnapshotFileName', () => {
const context = { fileName: 'foo.js', kind: 'kind' };
const result = target.getSnapshotFileName(context);
const platformAgnosticResult = result.replace(/\\|\//g, '/');
const platformAgnosticResult = result?.replace(/\\|\//g, '/');
// This is an absolute path, so we need to use `toContain()`
expect(platformAgnosticResult).toContain('__snapshots__/foo.storyshot');
@ -17,7 +17,7 @@ describe('getSnapshotFileName', () => {
const context = { fileName: 'foo.web.stories.js', kind: 'kind' };
const result = target.getSnapshotFileName(context);
const platformAgnosticResult = result.replace(/\\|\//g, '/');
const platformAgnosticResult = result?.replace(/\\|\//g, '/');
// This is an absolute path, so we need to use `toContain()`
expect(platformAgnosticResult).toContain('__snapshots__/foo.web.stories.storyshot');
@ -27,7 +27,7 @@ describe('getSnapshotFileName', () => {
const context = { fileName: 'test/foo.js', kind: 'kind' };
const result = target.getSnapshotFileName(context);
const platformAgnosticResult = result.replace(/\\|\//g, '/');
const platformAgnosticResult = result?.replace(/\\|\//g, '/');
// This is an absolute path, so we need to use `toContain()`
expect(platformAgnosticResult).toContain('test/__snapshots__/foo.storyshot');

View File

@ -55,7 +55,7 @@ export class Stories2SnapsConverter {
}
`
);
return null;
return undefined;
}
return this.getStoryshotFile(fileName);

View File

@ -9,7 +9,7 @@ export interface TestMethodOptions {
renderTree: RenderTree;
renderShallowTree: RenderTree;
stories2snapsConverter: Stories2SnapsConverter;
snapshotFileName: string;
snapshotFileName?: string;
options: any;
done?: () => void;
}

View File

@ -54,7 +54,7 @@ function testStorySnapshots(options: StoryshotsOptions = {}) {
// subsequent calls to `it()` etc will all happen within this tick, which is required
// by Jest (cannot add tests asynchronously)
globalWindow.__STORYBOOK_STORY_STORE__.initializationPromise.then(() => {
const data = storybook.raw().reduce(
const data = storybook.raw()?.reduce(
(acc, item) => {
if (storyNameRegex && !item.name.match(storyNameRegex)) {
return acc;
@ -86,7 +86,7 @@ function testStorySnapshots(options: StoryshotsOptions = {}) {
}[]
);
if (data.length) {
if (data && data.length) {
callTestMethodGlobals(testMethod);
snapshotsTests({

View File

@ -74,7 +74,7 @@ function getConfigPathParts(input: string): Output {
return specifier;
});
output.requireContexts = output.stories.map((specifier) => {
output.requireContexts = output.stories?.map((specifier) => {
const { path: basePath, recursive, match } = toRequireContext(specifier);
// eslint-disable-next-line no-underscore-dangle
@ -108,13 +108,14 @@ function configure<TRenderer extends Renderer>(
} = getConfigPathParts(configPath);
global.FEATURES = features;
global.CONFIG_TYPE = 'DEVELOPMENT';
global.STORIES = stories.map((specifier) => ({
...specifier,
importPathMatcher: specifier.importPathMatcher.source,
}));
if (preview) {
// This is essentially the same code as lib/builder-webpack5/templates/virtualModuleEntry.template
// This is essentially the same code as builders/builder-webpack5/templates/virtualModuleEntry.template
const {
parameters,
decorators,

View File

@ -28,7 +28,7 @@ function getLoaders(): Loader[] {
return null;
})
.filter(Boolean)
.map((loader) => require(loader).default);
.map((loader) => loader && require(loader).default);
}
function loadFramework(options: StoryshotsOptions) {

View File

@ -1,4 +1,7 @@
import { global } from '@storybook/global';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - types are removed in Svelte 4 but it still works. ts-ignore is safer than ts-expect-error because it's not an error in Svelte 3
// eslint-disable-next-line import/no-unresolved
import { set_current_component } from 'svelte/internal';
const { document } = global;

View File

@ -9,6 +9,7 @@ declare module '@storybook/babel-plugin-require-context-hook/register';
declare var STORYBOOK_ENV: any;
declare var STORIES: any;
declare var CONFIG_TYPE: 'DEVELOPMENT' | 'PRODUCTION';
declare var FEATURES:
| {
storyStoreV7?: boolean;

View File

@ -5,7 +5,7 @@
"jsx": "preserve",
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"strict": false
"strict": true
},
"include": ["src/**/*.ts"]
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots-puppeteer",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Image snapshots addition to StoryShots based on puppeteer",
"keywords": [
"addon",
@ -31,25 +31,25 @@
"*.d.ts"
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "../../../scripts/prepare/tsc.ts"
},
"dependencies": {
"@axe-core/puppeteer": "^4.2.0",
"@storybook/csf": "^0.1.0",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@types/jest-image-snapshot": "^5.1.0",
"@storybook/node-logger": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"@types/jest-image-snapshot": "^6.0.0",
"jest-image-snapshot": "^6.0.0"
},
"devDependencies": {
"@types/puppeteer": "^5.4.0",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.1",
"puppeteer": "^2.0.0 || ^3.0.0",
"rimraf": "^3.0.2"
"puppeteer": "^2.0.0 || ^3.0.0"
},
"peerDependencies": {
"@storybook/addon-storyshots": "7.1.0-alpha.25",
"@storybook/addon-storyshots": "7.1.0-alpha.41",
"puppeteer": ">=2.0.0"
},
"peerDependenciesMeta": {
@ -61,5 +61,5 @@
"access": "public"
},
"bundler": {},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920"
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
}

View File

@ -28,10 +28,10 @@ interface DirectNavigationOptions {
export interface CommonConfig {
storybookUrl: string;
chromeExecutablePath: string;
getGotoOptions: (options: Options) => DirectNavigationOptions;
chromeExecutablePath?: string;
getGotoOptions: (options: Options) => DirectNavigationOptions | undefined;
customizePage: (page: Page) => Promise<void>;
getCustomBrowser: () => Promise<Browser>;
getCustomBrowser?: () => Promise<Browser>;
/**
* Puppeteer browser launch options:
* {@link https://pptr.dev/api/puppeteer.puppeteernode.launch/ puppeteer.launch()}
@ -48,7 +48,7 @@ export interface PuppeteerTestConfig extends CommonConfig {
}
export interface ImageSnapshotConfig extends CommonConfig {
getMatchOptions: (options: Options) => MatchImageSnapshotOptions;
getMatchOptions: (options: Options) => MatchImageSnapshotOptions | undefined;
getScreenshotOptions: (options: Options) => Base64ScreenShotOptions;
beforeScreenshot: (page: Page, options: Options) => Promise<void | ElementHandle>;
afterScreenshot: (options: { image: string | void | Buffer; context: Context }) => Promise<void>;
@ -95,11 +95,11 @@ export const defaultImageSnapshotConfig: ImageSnapshotConfig = {
...defaultCommonConfig,
getMatchOptions: noop,
getScreenshotOptions: defaultScreenshotOptions,
beforeScreenshot: noop,
afterScreenshot: noop,
beforeScreenshot: asyncNoop,
afterScreenshot: asyncNoop,
};
export const defaultAxeConfig: AxeConfig = {
...defaultCommonConfig,
beforeAxeTest: noop,
beforeAxeTest: asyncNoop,
};

View File

@ -4,7 +4,7 @@
"skipLibCheck": true,
"types": ["node"],
"declaration": true,
"strict": false
"strict": true
},
"include": ["src/**/*"]
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storysource",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "View a storys source code to see how it works and paste into your app",
"keywords": [
"addon",
@ -53,13 +53,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/router": "7.1.0-alpha.25",
"@storybook/source-loader": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/router": "7.1.0-alpha.41",
"@storybook/source-loader": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"estraverse": "^5.2.0",
"prop-types": "^15.7.2",
"react-syntax-highlighter": "^15.5.0",
@ -92,7 +92,7 @@
"./src/preset.ts"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Storysource",
"icon": "https://user-images.githubusercontent.com/263385/101991675-48cdf300-3c7c-11eb-9400-58de5ac6daa7.png",

View File

@ -176,6 +176,8 @@ export const StoryPanel: React.FC<StoryPanelProps> = ({ api }) => {
format={false}
copyable={false}
padded
wrapLongLines
lineProps={{ style: { whiteSpace: 'pre' } }}
>
{source}
</StyledSyntaxHighlighter>

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-toolbars",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Create your own toolbar items that control story rendering",
"keywords": [
"addon",
@ -68,11 +68,11 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25"
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41"
},
"devDependencies": {
"typescript": "~4.9.3"
@ -99,7 +99,7 @@
],
"platform": "browser"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Toolbars",
"icon": "https://user-images.githubusercontent.com/263385/101991677-48cdf300-3c7c-11eb-93b4-19b0e3366959.png",

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-viewport",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Build responsive components by adjusting Storybooks viewport size and orientation",
"keywords": [
"addon",
@ -73,13 +73,13 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/components": "7.1.0-alpha.25",
"@storybook/core-events": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/components": "7.1.0-alpha.41",
"@storybook/core-events": "7.1.0-alpha.41",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/theming": "7.1.0-alpha.25",
"@storybook/manager-api": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/theming": "7.1.0-alpha.41",
"memoizerific": "^1.11.3",
"prop-types": "^15.7.2"
},
@ -109,7 +109,7 @@
"./src/preview.ts"
]
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920",
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17",
"storybook": {
"displayName": "Viewport",
"icon": "https://user-images.githubusercontent.com/263385/101991678-48cdf300-3c7c-11eb-9764-f8af293c1b28.png",

View File

@ -106,9 +106,10 @@ const getStyles = (
styles: Styles,
isRotated: boolean
): ViewportStyles | undefined => {
if (!styles || !prevStyles) {
if (styles === null) {
return undefined;
}
const result = typeof styles === 'function' ? styles(prevStyles) : styles;
return isRotated ? flip(result) : result;
};

View File

@ -1,4 +1,4 @@
export type Styles = ViewportStyles | ((s: ViewportStyles) => ViewportStyles) | null;
export type Styles = ViewportStyles | ((s: ViewportStyles | undefined) => ViewportStyles) | null;
export interface Viewport {
name: string;

View File

@ -1,18 +1,18 @@
{
"name": "@storybook/builder-manager",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "Storybook manager builder",
"keywords": [
"storybook"
],
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/builder-manager",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-manager",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "code/lib/builder-manager"
"directory": "code/builders/builder-manager"
},
"funding": {
"type": "opencollective",
@ -44,15 +44,15 @@
},
"dependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/manager": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/manager": "7.1.0-alpha.41",
"@storybook/node-logger": "7.1.0-alpha.41",
"@types/ejs": "^3.1.1",
"@types/find-cache-dir": "^3.2.1",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
"browser-assert": "^1.2.1",
"ejs": "^3.1.8",
"esbuild": "^0.17.0",
"esbuild": "^0.18.0",
"esbuild-plugin-alias": "^0.2.1",
"express": "^4.17.3",
"find-cache-dir": "^3.0.0",
@ -73,5 +73,5 @@
],
"platform": "node"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920"
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
}

View File

@ -189,6 +189,10 @@ const starter: StarterFunction = async function* starterGeneratorFn({
next();
}
});
router.use(`/index.html`, ({ path }, res) => {
console.log({ path });
res.status(200).send(html);
});
return {
bail,

View File

@ -4,7 +4,12 @@ import { join, parse, relative, sep } from 'node:path';
import slash from 'slash';
const sanitizeBase = (path: string) => {
return path.replaceAll('.', '').replaceAll('@', '').replaceAll(sep, '-').replaceAll('/', '-');
return path
.replaceAll('.', '')
.replaceAll('@', '')
.replaceAll(sep, '-')
.replaceAll('/', '-')
.replaceAll(new RegExp(/^(-)+/g), '');
};
const sanitizeFinal = (path: string) => {

View File

@ -1,15 +1,15 @@
{
"name": "@storybook/builder-vite",
"version": "7.1.0-alpha.25",
"version": "7.1.0-alpha.41",
"description": "A plugin to run and build Storybooks with Vite",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/builder-vite/#readme",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite/#readme",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "code/lib/builder-vite"
"directory": "code/builders/builder-vite"
},
"funding": {
"type": "opencollective",
@ -42,21 +42,22 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/channel-postmessage": "7.1.0-alpha.25",
"@storybook/channel-websocket": "7.1.0-alpha.25",
"@storybook/client-logger": "7.1.0-alpha.25",
"@storybook/core-common": "7.1.0-alpha.25",
"@storybook/csf-plugin": "7.1.0-alpha.25",
"@storybook/channels": "7.1.0-alpha.41",
"@storybook/client-logger": "7.1.0-alpha.41",
"@storybook/core-common": "7.1.0-alpha.41",
"@storybook/csf-plugin": "7.1.0-alpha.41",
"@storybook/mdx2-csf": "^1.0.0",
"@storybook/node-logger": "7.1.0-alpha.25",
"@storybook/preview": "7.1.0-alpha.25",
"@storybook/preview-api": "7.1.0-alpha.25",
"@storybook/types": "7.1.0-alpha.25",
"@storybook/node-logger": "7.1.0-alpha.41",
"@storybook/preview": "7.1.0-alpha.41",
"@storybook/preview-api": "7.1.0-alpha.41",
"@storybook/types": "7.1.0-alpha.41",
"@types/find-cache-dir": "^3.2.1",
"browser-assert": "^1.2.1",
"es-module-lexer": "^0.9.3",
"express": "^4.17.3",
"find-cache-dir": "^3.0.0",
"fs-extra": "^11.1.0",
"magic-string": "^0.27.0",
"magic-string": "^0.30.0",
"remark-external-links": "^8.0.0",
"remark-slug": "^6.0.0",
"rollup": "^2.25.0 || ^3.3.0"
@ -99,5 +100,5 @@
],
"platform": "node"
},
"gitHead": "3f93a9032c93e77e34c3b39adea4b4a0f21e8920"
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
}

View File

@ -54,7 +54,7 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
};
/**
* This code is largely taken from https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/lib/builder-webpack4/src/preview/virtualModuleModernEntry.js.handlebars
* This code is largely taken from https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/builders/builder-webpack4/src/preview/virtualModuleModernEntry.js.handlebars
* Some small tweaks were made to `getProjectAnnotations` (since `import()` needs to be resolved asynchronously)
* and the HMR implementation has been tweaked to work with Vite.
* @todo Inline variable and remove `noinspection`

View File

@ -0,0 +1,14 @@
export async function generateAddonSetupCode() {
return `
import { createBrowserChannel } from '@storybook/channels';
import { addons } from '@storybook/preview-api';
const channel = createBrowserChannel({ page: 'preview' });
addons.setChannel(channel);
window.__STORYBOOK_ADDONS_CHANNEL__ = channel;
if (window.CONFIG_TYPE === 'DEVELOPMENT'){
window.__STORYBOOK_SERVER_CHANNEL__ = channel;
}
`.trim();
}

View File

@ -1,7 +1,7 @@
import * as path from 'path';
import slash from 'slash';
import { glob } from 'glob';
import { normalizeStories } from '@storybook/core-common';
import { normalizeStories, commonGlobOptions } from '@storybook/core-common';
import type { Options } from '@storybook/types';
import { normalizePath } from 'vite';
@ -18,7 +18,10 @@ export async function listStories(options: Options) {
? pattern
: path.join(options.configDir, pattern);
return glob(slash(absolutePattern), { follow: true });
return glob(slash(absolutePattern), {
...commonGlobOptions(absolutePattern),
follow: true,
});
})
)
).reduce((carry, stories) => carry.concat(stories.map(normalizePath)), []);

View File

@ -13,6 +13,7 @@ const INCLUDE_CANDIDATES = [
'@storybook/addon-docs > acorn-jsx',
'@storybook/addon-docs',
'@storybook/addon-essentials/docs/mdx-react-shim',
'@storybook/channels',
'@storybook/channel-postmessage',
'@storybook/channel-websocket',
'@storybook/client-api',

View File

@ -10,5 +10,6 @@ export async function csfPlugin(config: Options): Promise<Plugin> {
// @ts-expect-error - not sure what type to use here
addons.find((a) => [a, a.name].includes('@storybook/addon-docs'))?.options ?? {};
return vite(docsOptions?.csfPluginOptions);
// TODO: looks like unplugin can return an array of plugins
return vite(docsOptions?.csfPluginOptions) as Plugin;
}

Some files were not shown because too many files have changed in this diff Show More