diff --git a/.github/workflows/cron-weekly.yml b/.github/workflows/cron-weekly.yml index 07026c97fb8a..60d9ba29824e 100644 --- a/.github/workflows/cron-weekly.yml +++ b/.github/workflows/cron-weekly.yml @@ -6,6 +6,7 @@ on: jobs: check-links: + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/fork-checks.yml b/.github/workflows/fork-checks.yml new file mode 100644 index 000000000000..a8a33580f1f1 --- /dev/null +++ b/.github/workflows/fork-checks.yml @@ -0,0 +1,69 @@ +name: Fork checks + +# This workflow is only for forks, so they can get basic checks in without a CircleCI API key +on: + push: + +env: + NODE_OPTIONS: '--max_old_space_size=4096' + +jobs: + check: + name: Core Type Checking + if: github.repository_owner != 'storybookjs' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup Node.js and Install Dependencies + uses: ./.github/actions/setup-node-and-install + with: + install-code-deps: true + + - name: check + run: yarn task --task check + + prettier: + name: Core Formatting + if: github.repository_owner != 'storybookjs' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup Node.js and Install Dependencies + uses: ./.github/actions/setup-node-and-install + with: + install-code-deps: true + + - name: prettier + run: cd code && yarn lint:prettier --check . + + test: + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + name: Core Unit Tests, ${{ matrix.os }} + if: github.repository_owner != 'storybookjs' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup Node.js and Install Dependencies + uses: ./.github/actions/setup-node-and-install + with: + install-code-deps: true + + - name: compile + run: yarn task --task compile --start-from=compile + + - name: Install Playwright Dependencies + run: cd code && yarn exec playwright install chromium --with-deps + + - name: test + run: yarn test diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes.yml index b30b4a7b7f2f..3e86e63c2547 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes.yml @@ -24,6 +24,7 @@ defaults: jobs: generate-next: name: Generate to next + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -76,6 +77,7 @@ jobs: generate-main: name: Generate to main + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/handle-release-branches.yml b/.github/workflows/handle-release-branches.yml index 84cebf0aee54..021ed04934ff 100644 --- a/.github/workflows/handle-release-branches.yml +++ b/.github/workflows/handle-release-branches.yml @@ -5,6 +5,7 @@ on: jobs: branch-checks: + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - id: get-branch @@ -68,7 +69,7 @@ jobs: branch: ${{ needs.get-next-release-branch.outputs.branch }} next-release-branch-check: - if: ${{ always() }} + if: ${{ always() && github.repository_owner == 'storybookjs' }} needs: [branch-checks, get-next-release-branch] runs-on: ubuntu-latest steps: @@ -87,7 +88,7 @@ jobs: check: ${{ env.is-next-release-branch }} request-create-frontpage-branch: - if: ${{ always() }} + if: ${{ always() && github.repository_owner == 'storybookjs' }} needs: [branch-checks, next-release-branch-check, create-next-release-branch] runs-on: ubuntu-latest diff --git a/.github/workflows/prepare-non-patch-release.yml b/.github/workflows/prepare-non-patch-release.yml index 7443d0d4df42..d57d6bfc8fc5 100644 --- a/.github/workflows/prepare-non-patch-release.yml +++ b/.github/workflows/prepare-non-patch-release.yml @@ -36,6 +36,7 @@ concurrency: jobs: prepare-non-patch-pull-request: name: Prepare non-patch pull request + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest environment: Release defaults: diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml index f8012dcb7e69..e8c7d2250154 100644 --- a/.github/workflows/prepare-patch-release.yml +++ b/.github/workflows/prepare-patch-release.yml @@ -18,6 +18,7 @@ concurrency: jobs: prepare-patch-pull-request: name: Prepare patch pull request + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest environment: Release defaults: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 691a9e9c31fe..800056ca139a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,6 +39,7 @@ jobs: name: Publish normal version runs-on: ubuntu-latest if: | + github.repository_owner == 'storybookjs' && github.event_name == 'push' && (github.ref_name == 'latest-release' || github.ref_name == 'next-release') && contains(github.event.head_commit.message, '[skip ci]') != true @@ -221,6 +222,7 @@ jobs: name: Publish canary version runs-on: ubuntu-latest if: | + github.repository_owner == 'storybookjs' && ( github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && endsWith(github.head_ref, 'with-canary-release')) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index dfedf4d4ca4c..d70dbdd80059 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,6 +6,7 @@ on: jobs: stale: runs-on: ubuntu-latest + if: github.repository_owner == 'storybookjs' steps: - uses: actions/stale@v9 with: diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index d3b64ec3b796..cf48ebae5015 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -8,11 +8,12 @@ on: types: [opened, synchronize, reopened] env: - NODE_OPTIONS: "--max_old_space_size=4096" + NODE_OPTIONS: '--max_old_space_size=4096' jobs: build: name: Core Unit Tests, windows-latest + if: github.repository_owner == 'storybookjs' runs-on: windows-11-arm steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index adf6ad3b9bfc..af45b109da06 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -15,6 +15,7 @@ permissions: jobs: triage: name: Nissuer + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - uses: balazsorban44/nissuer@1.10.0 diff --git a/.github/workflows/trigger-circle-ci-workflow.yml b/.github/workflows/trigger-circle-ci-workflow.yml index a35a74868f10..7b1cedda19f1 100644 --- a/.github/workflows/trigger-circle-ci-workflow.yml +++ b/.github/workflows/trigger-circle-ci-workflow.yml @@ -16,6 +16,7 @@ concurrency: jobs: get-branch: + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - id: get-branch @@ -37,6 +38,7 @@ jobs: branch: ${{ env.branch }} get-parameters: + if: github.repository_owner == 'storybookjs' runs-on: ubuntu-latest steps: - if: github.event_name == 'pull_request_target' && (contains(github.event.pull_request.labels.*.name, 'ci:normal')) @@ -55,7 +57,7 @@ jobs: trigger-circle-ci-workflow: runs-on: ubuntu-latest needs: [get-branch, get-parameters] - if: needs.get-parameters.outputs.workflow != '' + if: github.repository_owner == 'storybookjs' && needs.get-parameters.outputs.workflow != '' steps: - name: Trigger Normal tests uses: fjogeleit/http-request-action@v1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f0f32191b85..034296f85bf4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,7 +131,9 @@ Here's a highlight of notable directories and files: ### Fork the repository -If you plan to contribute to Storybook's codebase, you should fork the repository to your GitHub account. This will allow you to make changes to the codebase and submit a pull request to the main repository when you're ready to contribute your changes. Once you've forked the repository, you should [disable Github Actions for your forked repository](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository) as most of them (e.g., pushing to sandbox) will fail without proper authorization. In your forked repository, go to Settings > Actions > General > set the Actions Permissions to **Disable actions**. Additionally, adding our codebase as upstream ensures you can rebase against the latest changes in the main repository. To do this, run the following commands: +If you plan to contribute to Storybook's codebase, you should fork the repository to your GitHub account. This will allow you to make changes to the codebase and submit a pull request to the main repository when you're ready to contribute your changes. + +Additionally, adding our codebase as upstream ensures you can rebase against the latest changes in the main repository. To do this, run the following commands: ```shell git remote add upstream https://github.com/storybookjs/storybook.git diff --git a/code/.prettierignore b/code/.prettierignore index a66b6e6cf489..6f24e6a798d8 100644 --- a/code/.prettierignore +++ b/code/.prettierignore @@ -7,4 +7,10 @@ bench /.nx/cache core/report -/.nx/workspace-data \ No newline at end of file +/.nx/workspace-data + +# This file contains imports with an order that must be preserved. +core/src/core-server/presets/common-manager.ts + +# This file is modified by build/check, causing errors when changed in CI jobs. +lib/eslint-plugin/docs/rules/no-stories-of.md \ No newline at end of file diff --git a/code/core/src/core-server/presets/common-manager.ts b/code/core/src/core-server/presets/common-manager.ts index 66b87c66277d..563443222ac3 100644 --- a/code/core/src/core-server/presets/common-manager.ts +++ b/code/core/src/core-server/presets/common-manager.ts @@ -3,7 +3,6 @@ import { global } from '@storybook/global'; import { addons } from 'storybook/manager-api'; -/* eslint-disable prettier/prettier */ // THE ORDER OF THESE IMPORTS MATTERS! IT DEFINES THE ORDER OF PANELS AND TOOLS! import controlsManager from '../../controls/manager'; import actionsManager from '../../actions/manager'; @@ -12,7 +11,6 @@ import backgroundsManager from '../../backgrounds/manager'; import measureManager from '../../measure/manager'; import outlineManager from '../../outline/manager'; import viewportManager from '../../viewport/manager'; -/* eslint-enable prettier/prettier */ const TAG_FILTERS = 'tag-filters'; const STATIC_FILTER = 'static-filter'; diff --git a/code/frameworks/angular/build-schema.json b/code/frameworks/angular/build-schema.json index 12e9e2af7ebe..9753db540f2d 100644 --- a/code/frameworks/angular/build-schema.json +++ b/code/frameworks/angular/build-schema.json @@ -67,27 +67,18 @@ "compodocArgs": { "type": "array", "description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.", - "default": [ - "-e", - "json" - ], + "default": ["-e", "json"], "items": { "type": "string" } }, "webpackStatsJson": { - "type": [ - "boolean", - "string" - ], + "type": ["boolean", "string"], "description": "Write Webpack Stats JSON to disk", "default": false }, "statsJson": { - "type": [ - "boolean", - "string" - ], + "type": ["boolean", "string"], "description": "Write stats JSON to disk", "default": false }, @@ -125,10 +116,7 @@ } }, "sourceMap": { - "type": [ - "boolean", - "object" - ], + "type": ["boolean", "object"], "description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration", "default": false }, @@ -170,11 +158,7 @@ } }, "additionalProperties": false, - "required": [ - "glob", - "input", - "output" - ] + "required": ["glob", "input", "output"] }, { "type": "string" @@ -202,9 +186,7 @@ } }, "additionalProperties": false, - "required": [ - "input" - ] + "required": ["input"] }, { "type": "string", @@ -213,4 +195,4 @@ ] } } -} \ No newline at end of file +} diff --git a/code/frameworks/angular/start-schema.json b/code/frameworks/angular/start-schema.json index 7befb6f8b727..84d6bd80861b 100644 --- a/code/frameworks/angular/start-schema.json +++ b/code/frameworks/angular/start-schema.json @@ -93,10 +93,7 @@ "compodocArgs": { "type": "array", "description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.", - "default": [ - "-e", - "json" - ], + "default": ["-e", "json"], "items": { "type": "string" } @@ -135,18 +132,12 @@ "description": "URL path to be appended when visiting Storybook for the first time" }, "webpackStatsJson": { - "type": [ - "boolean", - "string" - ], + "type": ["boolean", "string"], "description": "Write Webpack Stats JSON to disk", "default": false }, "statsJson": { - "type": [ - "boolean", - "string" - ], + "type": ["boolean", "string"], "description": "Write stats JSON to disk", "default": false }, @@ -160,10 +151,7 @@ "pattern": "(silly|verbose|info|warn|silent)" }, "sourceMap": { - "type": [ - "boolean", - "object" - ], + "type": ["boolean", "object"], "description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration", "default": false }, @@ -205,11 +193,7 @@ } }, "additionalProperties": false, - "required": [ - "glob", - "input", - "output" - ] + "required": ["glob", "input", "output"] }, { "type": "string" @@ -237,9 +221,7 @@ } }, "additionalProperties": false, - "required": [ - "input" - ] + "required": ["input"] }, { "type": "string", @@ -248,4 +230,4 @@ ] } } -} \ No newline at end of file +} diff --git a/code/frameworks/server-webpack5/template/cli/page.stories.yaml b/code/frameworks/server-webpack5/template/cli/page.stories.yaml index 08915865c89d..6dcca1651d0a 100644 --- a/code/frameworks/server-webpack5/template/cli/page.stories.yaml +++ b/code/frameworks/server-webpack5/template/cli/page.stories.yaml @@ -1,10 +1,10 @@ -title: "Example/Page" +title: 'Example/Page' parameters: server: - url: "https://storybook-server-demo.netlify.app/api" - id: "page" + url: 'https://storybook-server-demo.netlify.app/api' + id: 'page' stories: - - name: "LoggedIn" + - name: 'LoggedIn' args: user: {} - - name: "LoggedOut" + - name: 'LoggedOut' diff --git a/code/frameworks/sveltekit/tsconfig.json b/code/frameworks/sveltekit/tsconfig.json index 39029c2ce294..f5ab5afaf6a4 100644 --- a/code/frameworks/sveltekit/tsconfig.json +++ b/code/frameworks/sveltekit/tsconfig.json @@ -3,7 +3,7 @@ "baseUrl": ".", "paths": { "storybook/internal/*": ["../../lib/cli/core/*"] - }, + } }, "extends": "../../tsconfig.json", "include": ["src/**/*"]