diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b79060d74be..a04959f52c81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ aliases: - image: circleci/node:10 jobs: - build: + install: <<: *defaults steps: - checkout @@ -21,9 +21,6 @@ jobs: - run: name: Check that yarn.lock is not corrupted command: yarn repo-dirty-check - - run: - name: Bootstrap - command: yarn bootstrap --core - save_cache: name: Cache core dependencies key: core-dependencies-v4-{{ checksum "yarn.lock" }} @@ -40,6 +37,23 @@ jobs: - dev-kits - app - lib + build: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: . + - run: + name: Bootstrap + command: yarn bootstrap --core + - persist_to_workspace: + root: . + paths: + - examples + - addons + - dev-kits + - app + - lib chromatic: <<: *defaults steps: @@ -111,7 +125,7 @@ jobs: yarn packtracker examples: <<: *defaults - parallelism: 4 + parallelism: 10 steps: - checkout - attach_workspace: @@ -292,7 +306,10 @@ jobs: workflows: test: jobs: - - build + - install + - build: + requires: + - install - lint: requires: - build diff --git a/.github/workflows/tests-cli.yml b/.github/workflows/tests-cli.yml index 6aa239bc15fc..4e277be1e350 100644 --- a/.github/workflows/tests-cli.yml +++ b/.github/workflows/tests-cli.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '10.x' - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Cache node modules uses: actions/cache@v1 with: @@ -40,7 +40,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '10.x' - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Cache node modules uses: actions/cache@v1 with: @@ -64,7 +64,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '10.x' - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: install, bootstrap run: | yarn bootstrap --core diff --git a/.github/workflows/tests-puppeteer.yml b/.github/workflows/tests-puppeteer.yml deleted file mode 100644 index e7590c6e644d..000000000000 --- a/.github/workflows/tests-puppeteer.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Puppeteer & A11y tests - -on: [push] - -jobs: - build: - - name: Puppeteer & A11y tests - runs-on: ubuntu-latest - steps: - - uses: actions/setup-node@v1 - with: - node-version: '10.x' - - uses: actions/checkout@v1 - - name: Cache node modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.OS }}-build-${{ env.cache-name }}- - ${{ runner.OS }}-build- - ${{ runner.OS }}- - - name: install, bootstrap - run: | - yarn bootstrap --core - - name: build storybook - run: | - yarn --cwd examples/official-storybook build-storybook - - name: test - run: | - yarn test --puppeteer diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml index f3eb332e5d51..d0e9e668d098 100644 --- a/.github/workflows/tests-unit.yml +++ b/.github/workflows/tests-unit.yml @@ -5,13 +5,13 @@ on: [push] jobs: build: - name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Core Unit Tests + runs-on: ubuntu-latest steps: - uses: actions/setup-node@v1 with: node-version: '10.x' - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Cache node modules uses: actions/cache@v1 with: diff --git a/.teamcity/OpenSourceProjects_Storybook/buildTypes/OpenSourceProjects_Storybook_Bootstrap.kt b/.teamcity/OpenSourceProjects_Storybook/buildTypes/OpenSourceProjects_Storybook_Bootstrap.kt deleted file mode 100644 index bd6ad004d7b4..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/buildTypes/OpenSourceProjects_Storybook_Bootstrap.kt +++ /dev/null @@ -1,81 +0,0 @@ -package OpenSourceProjects_Storybook.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.buildFeatures.commitStatusPublisher -import jetbrains.buildServer.configs.kotlin.v2017_2.buildSteps.script -import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.vcs -import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.retryBuild -import jetbrains.buildServer.configs.kotlin.v2017_2.triggers.VcsTrigger - -object OpenSourceProjects_Storybook_Bootstrap : BuildType({ - uuid = "9f9177e7-9ec9-4e2e-aabb-d304fd667712" - id = "OpenSourceProjects_Storybook_Bootstrap" - name = "Bootstrap" - - artifactRules = """ - addons/*/dist/** => dist.zip/addons - addons/storyshots/*/dist/** => dist.zip/addons/storyshots - app/*/dist/** => dist.zip/app - dev-kits/*/dist/** => dist.zip/dev-kits - lib/*/dist/** => dist.zip/lib - lib/core/dll/** => dist.zip/lib/core/dll - """.trimIndent() - - vcs { - root(OpenSourceProjects_Storybook.vcsRoots.OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster) - } - - steps { - script { - name = "Bootstrap" - scriptContent = """ - #!/bin/sh - - set -e -x - - yarn - yarn bootstrap --core - """.trimIndent() - dockerImage = "node:%docker.node.version%" - } - } - - triggers { - vcs { - quietPeriodMode = VcsTrigger.QuietPeriodMode.USE_DEFAULT - triggerRules = "-:comment=^TeamCity change:**" - branchFilter = """ - +:pull/* - +:release/* - +:master - +:next - +:snyk-fix-* - """.trimIndent() - enabled = false - } - retryBuild { - delaySeconds = 60 - enabled = false - } - } - - features { - commitStatusPublisher { - publisher = github { - githubUrl = "https://api.github.com" - authType = personalToken { - token = "credentialsJSON:5ffe2d7e-531e-4f6f-b1fc-a41bfea26eaa" - } - } - param("github_oauth_user", "Hypnosphi") - } - } - - requirements { - doesNotContain("env.OS", "Windows") - } - - cleanup { - artifacts(days = 1) - } -}) diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1bda59b5-d08d-4fd8-b317-953e7d79d881.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1bda59b5-d08d-4fd8-b317-953e7d79d881.kts deleted file mode 100644 index 6d597e5164e2..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1bda59b5-d08d-4fd8-b317-953e7d79d881.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '1bda59b5-d08d-4fd8-b317-953e7d79d881' (id = 'OpenSourceProjects_Storybook_Docs') -accordingly, and delete the patch script. -*/ -changeBuildType("1bda59b5-d08d-4fd8-b317-953e7d79d881") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1ea2b5bd-28f6-44f5-8ab3-6c659ce8fbd6.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1ea2b5bd-28f6-44f5-8ab3-6c659ce8fbd6.kts deleted file mode 100644 index 4b5795b0d563..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/1ea2b5bd-28f6-44f5-8ab3-6c659ce8fbd6.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '1ea2b5bd-28f6-44f5-8ab3-6c659ce8fbd6' (id = 'OpenSourceProjects_Storybook_SmokeTests') -accordingly, and delete the patch script. -*/ -changeBuildType("1ea2b5bd-28f6-44f5-8ab3-6c659ce8fbd6") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/2b9c73e2-0a6e-47ca-95ae-729cac42be2b.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/2b9c73e2-0a6e-47ca-95ae-729cac42be2b.kts deleted file mode 100644 index aef79086061a..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/2b9c73e2-0a6e-47ca-95ae-729cac42be2b.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '2b9c73e2-0a6e-47ca-95ae-729cac42be2b' (id = 'OpenSourceProjects_Storybook_Build_2') -accordingly, and delete the patch script. -*/ -changeBuildType("2b9c73e2-0a6e-47ca-95ae-729cac42be2b") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a737.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a737.kts deleted file mode 100644 index 5b232f2b6803..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a737.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '42cfbb9a-f35b-4f96-afae-0b508927a737' (id = 'OpenSourceProjects_Storybook_Lint') -accordingly, and delete the patch script. -*/ -changeBuildType("42cfbb9a-f35b-4f96-afae-0b508927a737") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a738.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a738.kts deleted file mode 100644 index 927328468594..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/42cfbb9a-f35b-4f96-afae-0b508927a738.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '42cfbb9a-f35b-4f96-afae-0b508927a738' (id = 'OpenSourceProjects_Storybook_Lint_Warnings') -accordingly, and delete the patch script. -*/ -changeBuildType("42cfbb9a-f35b-4f96-afae-0b508927a738") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-angular.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-angular.kts deleted file mode 100644 index a9c7f3490508..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-angular.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-angular' (id = 'OpenSourceProjects_Storybook_Angular') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-angular") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-chromatic.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-chromatic.kts deleted file mode 100644 index 8d0deb7df109..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-chromatic.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-chromatic' (id = 'OpenSourceProjects_Storybook_Chromatic') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-chromatic") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra.kts deleted file mode 100644 index 4c072da0e310..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra' (id = 'OpenSourceProjects_Storybook_CRA') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_react15.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_react15.kts deleted file mode 100644 index 0ea4f527f639..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_react15.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_react15' (id = 'OpenSourceProjects_Storybook_CRA_REACT15') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_react15") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_ts.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_ts.kts deleted file mode 100644 index a508334eb457..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_ts.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_ts' (id = 'OpenSourceProjects_Storybook_CRA_TS') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-cra_ts") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-ember.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-ember.kts deleted file mode 100644 index ab0514e623c5..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-ember.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-ember' (id = 'OpenSourceProjects_Storybook_Ember') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-ember") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-html.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-html.kts deleted file mode 100644 index 039eed95efe6..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-html.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-html' (id = 'OpenSourceProjects_Storybook_HTML') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-html") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-marko.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-marko.kts deleted file mode 100644 index 754da521c8f3..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-marko.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-marko' (id = 'OpenSourceProjects_Storybook_Marko') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-marko") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-mithril.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-mithril.kts deleted file mode 100644 index bd0913a8a04d..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-mithril.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-mithril' (id = 'OpenSourceProjects_Storybook_Mithril') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-mithril") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-polymer.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-polymer.kts deleted file mode 100644 index 7ed9e87651fe..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-polymer.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-polymer' (id = 'OpenSourceProjects_Storybook_Polymer') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-polymer") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-preact.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-preact.kts deleted file mode 100644 index 7f169a3828fd..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-preact.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-preact' (id = 'OpenSourceProjects_Storybook_Preact') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-preact") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-riot.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-riot.kts deleted file mode 100644 index c484eca68e59..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-riot.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-riot' (id = 'OpenSourceProjects_Storybook_Riot') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-riot") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-svelte.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-svelte.kts deleted file mode 100644 index 221d31ccf7b1..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-svelte.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-svelte' (id = 'OpenSourceProjects_Storybook_Svelte') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-svelte") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-vue.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-vue.kts deleted file mode 100644 index 9c9fc3530876..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6-vue.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6-vue' (id = 'OpenSourceProjects_Storybook_Vue') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6-vue") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6.kts deleted file mode 100644 index 1fce2cf575d8..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/8cc5f747-4ca7-4f0d-940d-b0c422f501a6.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '8cc5f747-4ca7-4f0d-940d-b0c422f501a6' (id = 'OpenSourceProjects_Storybook_Examples') -accordingly, and delete the patch script. -*/ -changeBuildType("8cc5f747-4ca7-4f0d-940d-b0c422f501a6") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667711.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667711.kts deleted file mode 100644 index 7b41f2e260a0..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667711.kts +++ /dev/null @@ -1,22 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '9f9177e7-9ec9-4e2e-aabb-d304fd667711' (id = 'OpenSourceProjects_Storybook_Test') -accordingly, and delete the patch script. -*/ -changeBuildType("9f9177e7-9ec9-4e2e-aabb-d304fd667711") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true - - params { - add { - param("docker.node.version", "10.13") - } - } -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667712.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667712.kts deleted file mode 100644 index 6a63ab84d5c4..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/9f9177e7-9ec9-4e2e-aabb-d304fd667712.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = '9f9177e7-9ec9-4e2e-aabb-d304fd667712' (id = 'OpenSourceProjects_Storybook_Bootstrap') -accordingly, and delete the patch script. -*/ -changeBuildType("9f9177e7-9ec9-4e2e-aabb-d304fd667712") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/d4320bd8-6094-4dd6-9bed-e13d6f0d12e2.kts b/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/d4320bd8-6094-4dd6-9bed-e13d6f0d12e2.kts deleted file mode 100644 index 7e2fb0801929..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/buildTypes/d4320bd8-6094-4dd6-9bed-e13d6f0d12e2.kts +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.patches.buildTypes - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the buildType with uuid = 'd4320bd8-6094-4dd6-9bed-e13d6f0d12e2' (id = 'OpenSourceProjects_Storybook_CliTestLatestCra') -accordingly, and delete the patch script. -*/ -changeBuildType("d4320bd8-6094-4dd6-9bed-e13d6f0d12e2") { - check(paused == false) { - "Unexpected paused: '$paused'" - } - paused = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/patches/projects/69382d9b-7791-418a-9ff6-1c83b86ed6b5.kts b/.teamcity/OpenSourceProjects_Storybook/patches/projects/69382d9b-7791-418a-9ff6-1c83b86ed6b5.kts deleted file mode 100644 index a357d89ba726..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/patches/projects/69382d9b-7791-418a-9ff6-1c83b86ed6b5.kts +++ /dev/null @@ -1,17 +0,0 @@ -package OpenSourceProjects_Storybook.patches.projects - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.Project -import jetbrains.buildServer.configs.kotlin.v2017_2.ui.* - -/* -This patch script was generated by TeamCity on settings change in UI. -To apply the patch, change the project with uuid = '69382d9b-7791-418a-9ff6-1c83b86ed6b5' (id = 'OpenSourceProjects_Storybook') -accordingly, and delete the patch script. -*/ -changeProject("69382d9b-7791-418a-9ff6-1c83b86ed6b5") { - check(archived == false) { - "Unexpected archived: '$archived'" - } - archived = true -} diff --git a/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster.kt b/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster.kt deleted file mode 100644 index ee7951d8b573..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster.kt +++ /dev/null @@ -1,20 +0,0 @@ -package OpenSourceProjects_Storybook.vcsRoots - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.vcs.GitVcsRoot - -object OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster : GitVcsRoot({ - uuid = "cec03c4b-d52c-42a0-8e9e-53bde85d6b33" - id = "OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster" - name = "Main root" - url = "git@github.com:storybookjs/storybook.git" - branch = "refs/heads/next" - branchSpec = """ - +:refs/(pull/*)/head - +:refs/heads/* - """.trimIndent() - authMethod = uploadedKey { - userName = "git" - uploadedKey = "Storybook bot" - } -}) diff --git a/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1.kt b/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1.kt deleted file mode 100644 index 7daa8d93aa1f..000000000000 --- a/.teamcity/OpenSourceProjects_Storybook/vcsRoots/OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1.kt +++ /dev/null @@ -1,16 +0,0 @@ -package OpenSourceProjects_Storybook.vcsRoots - -import jetbrains.buildServer.configs.kotlin.v2017_2.* -import jetbrains.buildServer.configs.kotlin.v2017_2.vcs.GitVcsRoot - -object OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1 : GitVcsRoot({ - uuid = "5cacf90a-381a-4c73-9aa3-57f6439b545e" - id = "OpenSourceProjects_Storybook_HttpsGithubComStorybooksStorybookRefsHeadsMaster1" - name = "https://github.com/storybookjs/storybook#refs/heads/master (1)" - url = "git@github.com:storybookjs/storybook.git" - branch = "refs/heads/next" - authMethod = uploadedKey { - userName = "git" - uploadedKey = "Storybook bot" - } -}) diff --git a/.teamcity/patches/templates/Common.kts b/.teamcity/patches/templates/Common.kts new file mode 100644 index 000000000000..f5cdb3818118 --- /dev/null +++ b/.teamcity/patches/templates/Common.kts @@ -0,0 +1,17 @@ +package patches.templates + +import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* + +/* +This patch script was generated by TeamCity on settings change in UI. +To apply the patch, change the template with id = 'Common' +accordingly, and delete the patch script. +*/ +changeTemplate(RelativeId("Common")) { + requirements { + add { + doesNotContain("system.agent.name", "tiny", "RQ_1") + } + } +} diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 000000000000..b98e212b6d2d --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + Hosted_Root Config DSL Script + Hosted_Root + Hosted_Root_dsl + 1.0-SNAPSHOT + + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://storybook.beta.teamcity.com/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + ${basedir} + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + compile + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + + 2019.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 000000000000..f39f70bf02c9 --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,795 @@ +import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.PullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.ScriptBuildStep +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.buildReportTab +import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubConnection +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +/* +The settings script is an entry point for defining a TeamCity +project hierarchy. The script should contain a single call to the +project() function with a Project instance or an init function as +an argument. + +VcsRoots, BuildTypes, Templates, and subprojects can be +registered inside the project using the vcsRoot(), buildType(), +template(), and subProject() methods respectively. + +To debug settings scripts in command-line, run the + + mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate + +command and attach your debugger to the port 8000. + +To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View +-> Tool Windows -> Maven Projects), find the generate task node +(Plugins -> teamcity-configs -> teamcity-configs:generate), the +'Debug' option is available in the context menu for the task. +*/ + +version = "2019.2" + +project { + template(Common) + defaultTemplate = Common + + buildType(TestWorkflow) + + buildType(Build) + buildType(Chromatic) + buildType(Packtracker) + buildType(E2E) + buildType(SmokeTests) + buildType(Frontpage) + buildType(Docs) + buildType(Lint) + buildType(Test) + buildType(Coverage) + + subProject(ExamplesProject) + subProject(ChromaticProject) + + buildTypesOrderIds = arrayListOf( + RelativeId("TestWorkflow"), + RelativeId("Build"), + RelativeId("Packtracker"), + RelativeId("Chromatic"), + RelativeId("E2E"), + RelativeId("SmokeTests"), + RelativeId("Frontpage"), + RelativeId("Docs"), + RelativeId("Lint"), + RelativeId("Test"), + RelativeId("Coverage") + ) + + + features { + githubConnection { + id = "PROJECT_EXT_6" + displayName = "GitHub.com" + clientId = "800d730c725f771d6d2a" + clientSecret = "credentialsJSON:d1a5af15-1200-46c6-b0f1-f35bd466d909" + } + buildReportTab { + id = "PROJECT_EXT_8" + title = "Official" + startPage = "built-storybooks.tar.gz!official-storybook/index.html" + } + } +} + +object Common: Template({ + name = "Common" + + vcs { + root(DslContext.settingsRoot) + checkoutMode = CheckoutMode.ON_AGENT + checkoutDir = "storybook/%teamcity.build.branch%" + } + + features { + commitStatusPublisher { + id = "BUILD_EXT_1" + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "credentialsJSON:5273320e-14be-4317-951e-a54c4dcca35d" + } + } + param("github_oauth_user", "Hypnosphi") + } + swabra { + id = "swabra" + verbose = true + paths = """ + -:node_modules + -:**/node_modules + """.trimIndent() + } + pullRequests { + id = "BUILD_EXT_2" + provider = github { + authType = vcsRoot() + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } + } +}) + +object Build : BuildType({ + name = "Build" + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn repo-dirty-check + yarn bootstrap --core + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + artifactRules = """ + +:**/dist/** => dist.tar.gz + +:**/dll/** => dist.tar.gz + -:**/node_modules/** => dist.tar.gz + """.trimIndent() +}) + +object Packtracker : BuildType({ + name = "Packtracker" + description = "Report webpack stats for manager of official storybook" + + dependencies { + dependency(Build) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "dist.tar.gz!** => ." + } + } + } + + steps { + script { + workingDir = "examples/official-storybook" + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn packtracker + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + params { + param("env.PT_BRANCH", "%teamcity.build.branch%") + } +}) + +object ExamplesProject : Project({ + name = "Examples" + + template(ExamplesTemplate) + + buildType(Examples1) + buildType(Examples2) + buildType(Examples3) + buildType(Examples4) + buildType(Examples5) + buildType(AggregateExamples) +}) + +object ExamplesTemplate : Template({ + name = "Examples Template" + + dependencies { + dependency(Build) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "dist.tar.gz!** => ." + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + rm -rf built-storybooks + mkdir -p built-storybooks + + yarn build-storybooks + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + artifactRules = "built-storybooks => built-storybooks.tar.gz" + + params { + param("env.CIRCLE_NODE_TOTAL", "5") + } +}) + +object Examples1 : BuildType({ + name = "Examples 1" + templates = listOf(ExamplesTemplate) + + params { + param("env.CIRCLE_NODE_INDEX", "0") + } +}) + +object Examples2 : BuildType({ + name = "Examples 2" + templates = listOf(ExamplesTemplate) + + params { + param("env.CIRCLE_NODE_INDEX", "1") + } +}) + +object Examples3 : BuildType({ + name = "Examples 3" + templates = listOf(ExamplesTemplate) + + params { + param("env.CIRCLE_NODE_INDEX", "2") + } +}) + +object Examples4 : BuildType({ + name = "Examples 4" + templates = listOf(ExamplesTemplate) + + params { + param("env.CIRCLE_NODE_INDEX", "3") + } +}) + +object Examples5 : BuildType({ + name = "Examples 5" + templates = listOf(ExamplesTemplate) + + params { + param("env.CIRCLE_NODE_INDEX", "4") + } +}) + +object AggregateExamples : BuildType({ + name = "Aggregate Examples" + + dependencies { + dependency(Examples1) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + dependency(Examples2) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + dependency(Examples3) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + dependency(Examples4) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + dependency(Examples5) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + artifactRules = "built-storybooks => built-storybooks.tar.gz" +}) + +object ChromaticProject : Project({ + name = "Chromatic" + + buildType(Chromatic1) + buildType(Chromatic2) + buildType(Chromatic3) + buildType(Chromatic4) +}) + +object Chromatic1 : BuildType({ + name = "Chromatic 1" + + dependencies { + dependency(AggregateExamples) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn chromatic --storybook-build-dir="built-storybooks/official-storybook" --exit-zero-on-changes --app-code="ab7m45tp9p" + yarn chromatic --storybook-build-dir="built-storybooks/angular-cli" --app-code="tl92yzsj6w" + yarn chromatic --storybook-build-dir="built-storybooks/cra-kitchen-sink" --app-code="tg55gajmdt" + yarn chromatic --storybook-build-dir="built-storybooks/cra-react15" --app-code="gxk7iqej3wt" + yarn chromatic --storybook-build-dir="built-storybooks/cra-ts-essentials" --app-code="b311ypk6of" + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object Chromatic2 : BuildType({ + name = "Chromatic 2" + + dependencies { + dependency(AggregateExamples) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn chromatic --storybook-build-dir="built-storybooks/cra-ts-kitchen-sink" --app-code="19whyj1tlac" + yarn chromatic --storybook-build-dir="built-storybooks/dev-kits" --app-code="7yykp9ifdxx" + yarn chromatic --storybook-build-dir="built-storybooks/ember-cli" --app-code="19z23qxndju" + yarn chromatic --storybook-build-dir="built-storybooks/html-kitchen-sink" --app-code="e8zolxoyg8o" + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object Chromatic3 : BuildType({ + name = "Chromatic 3" + + dependencies { + dependency(AggregateExamples) { + snapshot { + onDependencyFailure = FailureAction.IGNORE + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn chromatic --storybook-build-dir="built-storybooks/marko-cli" --app-code="qaegx64axu" + yarn chromatic --storybook-build-dir="built-storybooks/mithril-kitchen-sink" --app-code="8adgm46jzk8" + yarn chromatic --storybook-build-dir="built-storybooks/preact-kitchen-sink" --app-code="ls0ikhnwqt" + yarn chromatic --storybook-build-dir="built-storybooks/rax-kitchen-sink" --app-code="4co6vptx8qo" + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object Chromatic4 : BuildType({ + name = "Chromatic 4" + + dependencies { + dependency(AggregateExamples) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn chromatic --storybook-build-dir="built-storybooks/riot-kitchen-sink" --app-code="g2dp3lnr34a" + yarn chromatic --storybook-build-dir="built-storybooks/svelte-kitchen-sink" --app-code="8ob73wgl995" + yarn chromatic --storybook-build-dir="built-storybooks/vue-kitchen-sink" --app-code="cyxj0e38bqj" + yarn chromatic --storybook-build-dir="built-storybooks/web-components-kitchen-sink" --app-code="npm5gsofwkf" + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object Chromatic : BuildType({ + name = "Chromatic" + type = Type.COMPOSITE + + dependencies { + snapshot(Chromatic1) {} + snapshot(Chromatic2) {} + snapshot(Chromatic3) {} + snapshot(Chromatic4) {} + } +}) + +object E2E : BuildType({ + name = "E2E" + + dependencies { + dependency(AggregateExamples) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "built-storybooks.tar.gz!** => built-storybooks" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn cypress install + yarn serve-storybooks & + yarn await-serve-storybooks + yarn cypress run --reporter teamcity || : + yarn ts-node --transpile-only cypress/report-teamcity-metadata.ts || : + """.trimIndent() + dockerImage = "cypress/base:10.18.1" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + artifactRules = """ + cypress/screenshots => screenshots.tar.gz + cypress/videos => videos.tar.gz + """.trimIndent() + + failureConditions { + failOnMetricChange { + metric = BuildFailureOnMetric.MetricType.TEST_COUNT + units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT + comparison = BuildFailureOnMetric.MetricComparison.LESS + compareTo = value() + } + } +}) + +object SmokeTests : BuildType({ + name = "Smoke Tests" + + dependencies { + dependency(Build) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "dist.tar.gz!** => ." + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + + cd examples/cra-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../cra-ts-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../vue-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../svelte-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../angular-cli + yarn storybook --smoke-test --quiet + + cd ../ember-cli + yarn storybook --smoke-test --quiet + + cd ../marko-cli + yarn storybook --smoke-test --quiet + + cd ../official-storybook + yarn storybook --smoke-test --quiet + + cd ../mithril-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../riot-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../preact-kitchen-sink + yarn storybook --smoke-test --quiet + + cd ../cra-react15 + yarn storybook --smoke-test --quiet + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object Frontpage : BuildType({ + name = "Frontpage" + type = Type.DEPLOYMENT + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn bootstrap --install + node ./scripts/build-frontpage.js + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + triggers { + vcs { + quietPeriodMode = VcsTrigger.QuietPeriodMode.USE_DEFAULT + triggerRules = "-:.teamcity/**" + branchFilter = "+:master" + } + } +}) + +object Docs : BuildType({ + name = "Docs" + type = Type.DEPLOYMENT + + steps { + script { + workingDir = "docs" + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn build + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + triggers { + vcs { + quietPeriodMode = VcsTrigger.QuietPeriodMode.USE_DEFAULT + triggerRules = "-:.teamcity/**" + branchFilter = """ + +: + +:next + +:master + +:pull/* + """.trimIndent() + } + } +}) + +object Lint : BuildType({ + name = "Lint" + + dependencies { + dependency(Build) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "dist.tar.gz!** => ." + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + + # TODO remove after merging + mkdir temp-eslint-teamcity + cd temp-eslint-teamcity + yarn init -y + yarn add -D eslint-teamcity + cd .. + + yarn lint:js --format ./temp-eslint-teamcity/node_modules/eslint-teamcity/index.js . + yarn lint:md . + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + failureConditions { + failOnMetricChange { + metric = BuildFailureOnMetric.MetricType.INSPECTION_ERROR_COUNT + threshold = 0 + units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT + comparison = BuildFailureOnMetric.MetricComparison.MORE + compareTo = value() + } + } +}) + +object Test : BuildType({ + name = "Test" + + dependencies { + dependency(Build) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "dist.tar.gz!** => ." + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + + # TODO remove after merging + mkdir temp-jest-teamcity + cd temp-jest-teamcity + yarn init -y + yarn add -D jest-teamcity + cd .. + + yarn jest --coverage -w 2 --reporters=${'$'}PWD/temp-jest-teamcity/node_modules/jest-teamcity + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + artifactRules = "coverage => coverage.tar.gz" +}) + +object Coverage : BuildType({ + name = "Coverage" + + dependencies { + dependency(Test) { + snapshot { + onDependencyFailure = FailureAction.CANCEL + } + artifacts { + artifactRules = "coverage.tar.gz!** => coverage" + } + } + } + + steps { + script { + scriptContent = """ + #!/bin/bash + set -e -x + + yarn install + yarn coverage + """.trimIndent() + dockerImage = "node:10" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } +}) + +object TestWorkflow : BuildType({ + name = "Test Workflow" + type = Type.COMPOSITE + maxRunningBuilds = 2 + + dependencies { + snapshot(Chromatic) {} + snapshot(Packtracker) {} + snapshot(E2E) {} + snapshot(SmokeTests) {} + snapshot(Lint) {} + snapshot(Coverage) {} + } + + triggers { + vcs { + quietPeriodMode = VcsTrigger.QuietPeriodMode.USE_DEFAULT + triggerRules = "-:.teamcity/**" + branchFilter = """ + +: + +:next + +:master + +:pull/* + """.trimIndent() + } + } +}) diff --git a/ADDONS_SUPPORT.md b/ADDONS_SUPPORT.md index 540732862587..3697fd2f688b 100644 --- a/ADDONS_SUPPORT.md +++ b/ADDONS_SUPPORT.md @@ -7,19 +7,28 @@ | [backgrounds](addons/backgrounds) | + | \* | + | + | + | + | + | + | + | + | + | + | | [centered](addons/centered) | + | | + | + | + | + | | + | | + | + | + | | [contexts](addons/contexts) | + | | + | | | | | | | | + | + | -| [events](addons/events) | + | | + | + | + | + | + | | | + | + | + | +| [cssresources](addons/cssresources) | + | | + | + | + | + | + | + | + | + | + | + | | [design assets](addons/design-assets) | + | | + | + | + | + | + | + | + | + | + | + | -| [graphql](addons/graphql) | + | | | | | | | | | | | | +| [docs](addons/docs) | + | | + | + | + | + | + | + | + | + | + | + | +| [events](addons/events) | + | | + | + | + | + | + | | | + | + | + | | [google-analytics](addons/google-analytics) | + | + | + | + | + | + | + | + | + | + | + | + | -| [info](addons/info) | + | | | | | | | | | | | | +| [graphql](addons/graphql) | + | | | | | | | | | | | | | [jest](addons/jest) | + | + | + | + | + | + | + | + | + | + | + | + | | [knobs](addons/knobs) | + | +\* | + | + | + | + | + | + | + | + | + | + | | [links](addons/links) | + | + | + | + | + | + | | + | + | + | + | + | -| [notes](addons/notes) | + | +\* | + | + | + | + | | + | + | + | + | + | | [options](addons/options) | + | + | + | + | + | + | | + | + | + | + | + | -| [cssresources](addons/cssresources) | + | | + | + | + | + | + | + | + | + | + | + | +| [query params](addons/queryparams) | + | | + | + | + | + | + | + | + | + | + | + | | [storyshots](addons/storyshots) | + | + | + | + | | + | | + | + | | + | + | | [storysource](addons/storysource) | + | | + | + | + | + | + | + | + | + | + | + | | [viewport](addons/viewport) | + | | + | + | + | + | + | + | + | + | + | + | -`*` - React Native on device addon (addons/onDevice-\) +`*` - React Native on device addon (addons/onDevice-\) + +## Deprecated Addons + +| | [React](app/react) | [React Native](app/react-native) | [Vue](app/vue) | [Angular](app/angular) | [Mithril](app/mithril) | [HTML](app/html) | [Marko](app/marko) | [Svelte](app/svelte) | [Riot](app/riot) | [Ember](app/ember) | [Preact](app/preact) | [Rax](app/rax) | +| ------------------------------------------- | :----------------: | :------------------------------: | :------------: | :--------------------: | :--------------------: | :--------------: | :----------------: | :------------------: | :--------------: | :----------------: | :------------------: | -------------- | +| [info](https://github.com/storybookjs/storybook/tree/master/addons/info) | + | | | | | | | | | | | | +| [notes](https://github.com/storybookjs/storybook/tree/master/addons/notes) | + | +\* | + | + | + | + | | + | + | + | + | + | + +`*` - React Native on device addon (addons/onDevice-\) diff --git a/CHANGELOG.md b/CHANGELOG.md index 036692c93b36..f78e03ecc18c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,99 @@ +## 6.0.0-alpha.25 (March 11, 2020) + +NOTE: `6.0.0-alpha.24` broken due to bad merge. Sorry! + +### Bug Fixes + +- Core: Fix initialization of global args ([#10106](https://github.com/storybookjs/storybook/pull/10106)) + +## 6.0.0-alpha.24 (March 11, 2020) + +### Features + +- Addon-docs: formatSource snippet customization function ([#10089](https://github.com/storybookjs/storybook/pull/10089)) +- Core: Add global args feature ([#10015](https://github.com/storybookjs/storybook/pull/10015)) +- UI: Migrate from simplebar to overlaybars ([#9375](https://github.com/storybookjs/storybook/pull/9375)) + +### Bug Fixes + +- Core: Fix StoryInput parameters typings ([#10013](https://github.com/storybookjs/storybook/pull/10013)) +- Changed import of react-syntax-highlighter from esm to cjs ([#9292](https://github.com/storybookjs/storybook/pull/9292)) + +### Maintenance + +- Buidld: Setup TeamCity Cloud ([#9875](https://github.com/storybookjs/storybook/pull/9875)) +- Tech/improvements ([#10096](https://github.com/storybookjs/storybook/pull/10096)) +- Core: Move event handlers into module init ([#10085](https://github.com/storybookjs/storybook/pull/10085)) + +### Dependency Upgrades + +- Bump axe-core from 3.5.1 to 3.5.2 ([#10090](https://github.com/storybookjs/storybook/pull/10090)) + +## 6.0.0-alpha.23 (March 11, 2020) + +Failed publish + +## 6.0.0-alpha.22 (March 10, 2020) + +### Breaking Changes + +- MDX: Compile to improved source-loader format ([#10084](https://github.com/storybookjs/storybook/pull/10084)) + +### Features + +- Core: Add args feature ([#10014](https://github.com/storybookjs/storybook/pull/10014)) + +### Maintenance + +- Tech/improvements ([#10083](https://github.com/storybookjs/storybook/pull/10083)) +- Few minor improvements extracted from the inception feature PR ([#10072](https://github.com/storybookjs/storybook/pull/10072)) +- Tech/improvements ([#10070](https://github.com/storybookjs/storybook/pull/10070)) + +### Dependency Upgrades + +- Yarn 2: Add missing dependencies ([#10012](https://github.com/storybookjs/storybook/pull/10012)) +- Security: Remove usage of a vulnerable version of serialize-javascript ([#10071](https://github.com/storybookjs/storybook/pull/10071)) + +## 6.0.0-alpha.21 (March 5, 2020) + +### Breaking Changes + +- Core: Overhaul start.js and event emitting/listening ([#9914](https://github.com/storybookjs/storybook/pull/9914)) + +### Features + +- CLI: Support js / jsx / ts / tsx stories in React CSF template ([#10003](https://github.com/storybookjs/storybook/pull/10003)) +- Cra-kitchen-sink : Add Named Color Palette Example(MDX) ([#9709](https://github.com/storybookjs/storybook/pull/9709)) +- Addon-Queryparams: Add addon preset ([#9949](https://github.com/storybookjs/storybook/pull/9949)) + +### Bug Fixes + +- Addon-actions: Style ActionLogger to preserve whitespace ([#10046](https://github.com/storybookjs/storybook/pull/10046)) +- Core: Disables html-webpack-plugin's option to remove script tag types ([#10042](https://github.com/storybookjs/storybook/pull/10042)) + +### Maintenance + +- Tech: Misc improvements ([#10052](https://github.com/storybookjs/storybook/pull/10052)) +- Tech: Misc improvements extracted from composition ([#10040](https://github.com/storybookjs/storybook/pull/10040)) +- CI: change parallelism ([#10041](https://github.com/storybookjs/storybook/pull/10041)) +- Storybook-official: try moving options to `manager.js` ([#9323](https://github.com/storybookjs/storybook/pull/9323)) +- Misc: Add missing dependencies ([#9965](https://github.com/storybookjs/storybook/pull/9965)) +- CI: Fix GitHub unit test workflow ([#9971](https://github.com/storybookjs/storybook/pull/9971)) + +### Dependency Upgrades + +- Upgrade reach router ([#10016](https://github.com/storybookjs/storybook/pull/10016)) + +## 6.0.0-alpha.20 (February 27, 2020) + +### Bug Fixes + +- Core: Fix `configFilename` containing backticks ([#9960](https://github.com/storybookjs/storybook/pull/9960)) + +### Maintenance + +- Core: Add stories to demonstrate `layout` ([#9940](https://github.com/storybookjs/storybook/pull/9940)) + ## 5.3.14 (February 25, 2020) ### Bug Fixes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d808e8c2502d..32f4ce22e934 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,11 +135,11 @@ First make sure the repo is bootstrapped. Then run `yarn build-storybooks`, this creates a static website from all examples. -Then run `yarn serve-storybooks`, this will run the static sit of the port cypress expects. +Then run `yarn serve-storybooks`, this will run the static site on the port cypress expects. -Then run `yarn add cyress -W --optional`. When this has completed cypress should be installed on your system. If it is already on your system, this step can be skipped. +Then run `yarn add cypress -W --optional`. When this has completed cypress should be installed on your system. If it is already on your system, this step can be skipped. -Then run `yarn cypress open` if you ant to see the tests run in the UI, or `yarn cypress run` to run the tests headless. +Then run `yarn cypress open` if you want to see the tests run in the UI, or `yarn cypress run` to run the tests headless. ### Reproductions diff --git a/MIGRATION.md b/MIGRATION.md index 55e8be429664..20ff3de61010 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,96 +1,174 @@ -# Migration - -- [Migration](#migration) - - [From version 5.3.x to 6.0.x](#from-version-53x-to-60x) - - [New addon presets](#new-addon-presets) - - [Removed Deprecated APIs](#Removed-deprecated-apis) - - [Client API changes](#client-api-changes) - - [Removed legacy story APIs](#removed-legacy-story-apis) - - [Can no longer add decorators/parameters after stories](#can-no-longer-add-decorators-parameters-after-stories) - - [Changed Parameter Handling](#changed-parameter-handling) - - [From version 5.2.x to 5.3.x](#from-version-52x-to-53x) - - [To main.js configuration](#to-mainjs-configuration) - - [Create React App preset](#create-react-app-preset) - - [Description doc block](#description-doc-block) - - [React Native Async Storage](#react-native-async-storage) - - [Deprecate displayName parameter](#deprecate-displayname-parameter) - - [Unified docs preset](#unified-docs-preset) - - [Simplified hierarchy separators](#simplified-hierarchy-separators) - - [Addon StoryShots Puppeteer uses external puppeteer](#addon-storyshots-puppeteer-uses-external-puppeteer) - - [From version 5.1.x to 5.2.x](#from-version-51x-to-52x) - - [Source-loader](#source-loader) - - [Default viewports](#default-viewports) - - [Grid toolbar-feature](#grid-toolbar-feature) - - [Docs mode docgen](#docs-mode-docgen) - - [storySort option](#storysort-option) - - [From version 5.1.x to 5.1.10](#from-version-51x-to-5110) - - [babel.config.js support](#babelconfigjs-support) - - [From version 5.0.x to 5.1.x](#from-version-50x-to-51x) - - [React native server](#react-native-server) - - [Angular 7](#angular-7) - - [CoreJS 3](#corejs-3) - - [From version 5.0.1 to 5.0.2](#from-version-501-to-502) - - [Deprecate webpack extend mode](#deprecate-webpack-extend-mode) - - [From version 4.1.x to 5.0.x](#from-version-41x-to-50x) - - [sortStoriesByKind](#sortstoriesbykind) - - [Webpack config simplification](#webpack-config-simplification) - - [Theming overhaul](#theming-overhaul) - - [Story hierarchy defaults](#story-hierarchy-defaults) - - [Options addon deprecated](#options-addon-deprecated) - - [Individual story decorators](#individual-story-decorators) - - [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) - - [Addon cssresources name attribute renamed](#addon-cssresources-name-attribute-renamed) - - [Addon viewport uses parameters](#addon-viewport-uses-parameters) - - [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) - - [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) - - [New keyboard shortcuts defaults](#new-keyboard-shortcuts-defaults) - - [New URL structure](#new-url-structure) - - [Rename of the `--secure` cli parameter to `--https`](#rename-of-the---secure-cli-parameter-to---https) - - [Vue integration](#vue-integration) - - [From version 4.0.x to 4.1.x](#from-version-40x-to-41x) - - [Private addon config](#private-addon-config) - - [React 15.x](#react-15x) - - [From version 3.4.x to 4.0.x](#from-version-34x-to-40x) - - [React 16.3+](#react-163) - - [Generic addons](#generic-addons) - - [Knobs select ordering](#knobs-select-ordering) - - [Knobs URL parameters](#knobs-url-parameters) - - [Keyboard shortcuts moved](#keyboard-shortcuts-moved) - - [Removed addWithInfo](#removed-addwithinfo) - - [Removed RN packager](#removed-rn-packager) - - [Removed RN addons](#removed-rn-addons) - - [Storyshots Changes](#storyshots-changes) - - [Webpack 4](#webpack-4) - - [Babel 7](#babel-7) - - [Create-react-app](#create-react-app) - - [Upgrade CRA1 to babel 7](#upgrade-cra1-to-babel-7) - - [Migrate CRA1 while keeping babel 6](#migrate-cra1-while-keeping-babel-6) - - [start-storybook opens browser](#start-storybook-opens-browser) - - [CLI Rename](#cli-rename) - - [Addon story parameters](#addon-story-parameters) - - [From version 3.3.x to 3.4.x](#from-version-33x-to-34x) - - [From version 3.2.x to 3.3.x](#from-version-32x-to-33x) - - [`babel-core` is now a peer dependency (#2494)](#babel-core-is-now-a-peer-dependency-2494) - - [Base webpack config now contains vital plugins (#1775)](#base-webpack-config-now-contains-vital-plugins-1775) - - [Refactored Knobs](#refactored-knobs) - - [From version 3.1.x to 3.2.x](#from-version-31x-to-32x) - - [Moved TypeScript addons definitions](#moved-typescript-addons-definitions) - - [Updated Addons API](#updated-addons-api) - - [From version 3.0.x to 3.1.x](#from-version-30x-to-31x) - - [Moved TypeScript definitions](#moved-typescript-definitions) - - [Deprecated head.html](#deprecated-headhtml) - - [From version 2.x.x to 3.x.x](#from-version-2xx-to-3xx) - - [Webpack upgrade](#webpack-upgrade) - - [Packages renaming](#packages-renaming) - - [Deprecated embedded addons](#deprecated-embedded-addons) +

Migration

+ +- [From version 5.3.x to 6.0.x](#from-version-53x-to-60x) + - [React prop tables with Typescript](#react-prop-tables-with-typescript) + - [React.FC interfaces](#reactfc-interfaces) + - [Imported types](#imported-types) + - [Rolling back](#rolling-back) + - [New addon presets](#new-addon-presets) + - [Removed Deprecated APIs](#removed-deprecated-apis) + - [Client API changes](#client-api-changes) + - [Removed Legacy Story APIs](#removed-legacy-story-apis) + - [Can no longer add decorators/parameters after stories](#can-no-longer-add-decoratorsparameters-after-stories) + - [Changed Parameter Handling](#changed-parameter-handling) + - [Simplified Render Context](#simplified-render-context) + - [Story Store immutable outside of configuration](#story-store-immutable-outside-of-configuration) + - [Improved story source handling](#improved-story-source-handling) +- [From version 5.2.x to 5.3.x](#from-version-52x-to-53x) + - [To main.js configuration](#to-mainjs-configuration) + - [Using main.js](#using-mainjs) + - [Using preview.js](#using-previewjs) + - [Using manager.js](#using-managerjs) + - [Create React App preset](#create-react-app-preset) + - [Description doc block](#description-doc-block) + - [React Native Async Storage](#react-native-async-storage) + - [Deprecate displayName parameter](#deprecate-displayname-parameter) + - [Unified docs preset](#unified-docs-preset) + - [Simplified hierarchy separators](#simplified-hierarchy-separators) + - [Addon StoryShots Puppeteer uses external puppeteer](#addon-storyshots-puppeteer-uses-external-puppeteer) +- [From version 5.1.x to 5.2.x](#from-version-51x-to-52x) + - [Source-loader](#source-loader) + - [Default viewports](#default-viewports) + - [Grid toolbar-feature](#grid-toolbar-feature) + - [Docs mode docgen](#docs-mode-docgen) + - [storySort option](#storysort-option) +- [From version 5.1.x to 5.1.10](#from-version-51x-to-5110) + - [babel.config.js support](#babelconfigjs-support) +- [From version 5.0.x to 5.1.x](#from-version-50x-to-51x) + - [React native server](#react-native-server) + - [Angular 7](#angular-7) + - [CoreJS 3](#corejs-3) +- [From version 5.0.1 to 5.0.2](#from-version-501-to-502) + - [Deprecate webpack extend mode](#deprecate-webpack-extend-mode) +- [From version 4.1.x to 5.0.x](#from-version-41x-to-50x) + - [sortStoriesByKind](#sortstoriesbykind) + - [Webpack config simplification](#webpack-config-simplification) + - [Theming overhaul](#theming-overhaul) + - [Story hierarchy defaults](#story-hierarchy-defaults) + - [Options addon deprecated](#options-addon-deprecated) + - [Individual story decorators](#individual-story-decorators) + - [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) + - [Addon cssresources name attribute renamed](#addon-cssresources-name-attribute-renamed) + - [Addon viewport uses parameters](#addon-viewport-uses-parameters) + - [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) + - [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) + - [New keyboard shortcuts defaults](#new-keyboard-shortcuts-defaults) + - [New URL structure](#new-url-structure) + - [Rename of the `--secure` cli parameter to `--https`](#rename-of-the---secure-cli-parameter-to---https) + - [Vue integration](#vue-integration) +- [From version 4.0.x to 4.1.x](#from-version-40x-to-41x) + - [Private addon config](#private-addon-config) + - [React 15.x](#react-15x) +- [From version 3.4.x to 4.0.x](#from-version-34x-to-40x) + - [React 16.3+](#react-163) + - [Generic addons](#generic-addons) + - [Knobs select ordering](#knobs-select-ordering) + - [Knobs URL parameters](#knobs-url-parameters) + - [Keyboard shortcuts moved](#keyboard-shortcuts-moved) + - [Removed addWithInfo](#removed-addwithinfo) + - [Removed RN packager](#removed-rn-packager) + - [Removed RN addons](#removed-rn-addons) + - [Storyshots Changes](#storyshots-changes) + - [Webpack 4](#webpack-4) + - [Babel 7](#babel-7) + - [Create-react-app](#create-react-app) + - [Upgrade CRA1 to babel 7](#upgrade-cra1-to-babel-7) + - [Migrate CRA1 while keeping babel 6](#migrate-cra1-while-keeping-babel-6) + - [start-storybook opens browser](#start-storybook-opens-browser) + - [CLI Rename](#cli-rename) + - [Addon story parameters](#addon-story-parameters) +- [From version 3.3.x to 3.4.x](#from-version-33x-to-34x) +- [From version 3.2.x to 3.3.x](#from-version-32x-to-33x) + - [`babel-core` is now a peer dependency (#2494)](#babel-core-is-now-a-peer-dependency-2494) + - [Base webpack config now contains vital plugins (#1775)](#base-webpack-config-now-contains-vital-plugins-1775) + - [Refactored Knobs](#refactored-knobs) +- [From version 3.1.x to 3.2.x](#from-version-31x-to-32x) + - [Moved TypeScript addons definitions](#moved-typescript-addons-definitions) + - [Updated Addons API](#updated-addons-api) +- [From version 3.0.x to 3.1.x](#from-version-30x-to-31x) + - [Moved TypeScript definitions](#moved-typescript-definitions) + - [Deprecated head.html](#deprecated-headhtml) +- [From version 2.x.x to 3.x.x](#from-version-2xx-to-3xx) + - [Webpack upgrade](#webpack-upgrade) + - [Packages renaming](#packages-renaming) + - [Deprecated embedded addons](#deprecated-embedded-addons) ## From version 5.3.x to 6.0.x +### React prop tables with Typescript + +Starting in 6.0 we are changing our recommended setup for extracting prop tables in `addon-docs` for React projects using TypeScript. + +In earlier versions, we recommended `react-docgen-typescript-loader` (`RDTL`) and bundled it with `@storybook/preset-create-react-app` and `@storybook/preset-typescript` for this reason. We now recommend `babel-plugin-react-docgen`, which is already bundled as part of `@storybook/react`. + +As a consequence we've removed `RDTL` from the presets, which is a breaking change. We made this change because `react-docgen` now supports TypeScript natively, and fewer dependencies simplifies things for everybody. + +We will be updating this section with migration information as we collect information from our users, and fixing issues as they come up throughout the 6.0 prerelease process. We are cataloging known issues [here](https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/props-tables.md#known-limitations). + +#### React.FC interfaces + +The biggest known issue is https://github.com/reactjs/react-docgen/issues/387, which means that the following common pattern **DOESN'T WORK**: + +```tsx +import React, { FC } from 'react'; +interface IProps { ... }; +const MyComponent: FC = ({ ... }) => ... +``` + +The following workaround is needed: + +```tsx +const MyComponent: FC = ({ ... }: IProps) => ... +``` + +Please upvote https://github.com/reactjs/react-docgen/issues/387 if this is affecting your productivity, or better yet, submit a fix! + +#### Imported types + +Another major issue is support for imported types. + +```tsx +import React, { FC } from 'react'; +import SomeType from './someFile'; + +type NewType = SomeType & { foo: string }; +const MyComponent: FC = ... +``` + +This was also an issue in `RDTL` so it doesn't get worse with `react-docgen`. There's an open PR for this https://github.com/reactjs/react-docgen/pull/352 which you can upvote if it affects you. + +#### Rolling back + +In the meantime, if you're not ready to make the move you have two options: + +1. Pin your to a specific preset version: `preset-create-react-app@1.5.2` or `preset-typescript@1.2.2` + +2. OR: Manually configure your setup to add back `react-docgen-typescript-loader`, add the following to your `.storybook/main.js`: + +```js +module.exports = { + webpack: async (config, { configType }) => ({ + ...config, + module: { + ...config.module, + rules: [ + ...config.module.rules, + { + test: /\.tsx?$/, + loader: require.resolve('react-docgen-typescript-loader'), + options: {}, // your options here + }, + ], + }, + }), +}; +``` + ### New addon presets In Storybook 5.3 we introduced a declarative [main.js configuration](#to-mainjs-configuration), which is now the recommended way to configure Storybook. Part of the change is a simplified syntax for registering addons, which in 6.0 automatically registers many addons _using a preset_, which is a slightly different behavior than in earlier versions. -This breaking change currently applies to: `addon-a11y`, `addon-knobs`, `addon-links`. +This breaking change currently applies to: `addon-a11y`, `addon-knobs`, `addon-links`, `addon-queryparams`. Consider the following `main.js` config for the accessibility addon, `addon-a11y`: @@ -104,12 +182,12 @@ module.exports = { In earlier versions of Storybook, this would automatically call `@storybook/addon-a11y/register`, which adds the the a11y panel to the Storybook UI. As a user you would also add a decorator: ```js -import { withA11Y } from '../index'; +import { withA11y } from '../index'; -addDecorator(withA11Y); +addDecorator(withA11y); ``` -Now in 6.0, `addon-a11y` comes with a preset, `@storybook/addon-a11y/preset`, that does this automatically for you. This change simplifies configuration, since now you don't need to add that decorator. However, if you are upgrading +Now in 6.0, `addon-a11y` comes with a preset, `@storybook/addon-a11y/preset`, that does this automatically for you. This change simplifies configuration, since now you don't need to add that decorator. If you wish to disable this new behavior, you can modify your `main.js` to force it to use the `register` logic rather than the `preset`: @@ -133,14 +211,15 @@ MyNonCheckedStory.story = { ### Removed Deprecated APIs -In 6.0 we removed a number of APIs that were previously deprecated. +In 6.0 we removed a number of APIs that were previously deprecated. See the migration guides for further details: -* [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) -* [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) -* [Source-loader](#source-loader) -* [Unified docs preset](#unified-docs-preset) -* [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) + +- [Addon a11y uses parameters, decorator renamed](#addon-a11y-uses-parameters-decorator-renamed) +- [Addon backgrounds uses parameters](#addon-backgrounds-uses-parameters) +- [Source-loader](#source-loader) +- [Unified docs preset](#unified-docs-preset) +- [Addon centered decorator deprecated](#addon-centered-decorator-deprecated) ### Client API changes @@ -156,7 +235,7 @@ Although these were private APIs, if you were using them, you could probably use You can no longer add decorators and parameters globally after you added your first story, and you can no longer add decorators and parameters to a kind after you've added your first story to it. -It unclear and confusing what happened if you did. If you want to disable a decorator for certain stories, use a parameter to do so: +It's unclear and confusing what would happened if you did. If you want to disable a decorator for certain stories, use a parameter to do so: ```js export StoryOne = ...; @@ -194,6 +273,47 @@ _You cannot set parameters from decorators_ Parameters are intended to be statically set at story load time. So setting them via a decorator doesn't quite make sense. If you were using this to control the rendering of a story, chances are using the new `args` feature is a more idiomatic way to do this. +### Simplified Render Context + +The `RenderContext` that is passed to framework rendering layers in order to render a story has been simplified, dropping a few members that were not used by frameworks to render stories. In particular, the following have been removed: + +- `selectedKind`/`selectedStory` -- replaced by `kind`/`name` +- `configApi` +- `storyStore` +- `channel` +- `clientApi` + +### Story Store immutable outside of configuration + +You can no longer change the contents of the StoryStore outside of a `configure()` call. This is to ensure that any changes are properly published to the manager. If you want to add stories "out of band" you can call `store.startConfiguring()` and `store.finishConfiguring()` to ensure that your changes are published. + +### Improved story source handling + +The story source code handling has been improved in both `addon-storysource` and `addon-docs`. + +In 5.x some users used an undocumented _internal_ API, `mdxSource` to customize source snippetization in `addon-docs`. This has been removed in 6.0. + +The preferred way to customize source snippets for stories is now: + +```js +export const Example = () => ; @@ -41,13 +36,14 @@ export const inaccessible = () => ( ); ``` -## Using the preset - -Add the decorator to all stories: +If you wish to selectively disable `a11y` checks for a subset of stories, you can control this with story parameters: ```js -module.exports = { - addons: ['@storybook/addon-a11y'], +export const MyNonCheckedStory = () => ; +MyNonCheckedStory.story = { + parameters: { + a11y: { disable: true }, + }, }; ``` diff --git a/addons/a11y/package.json b/addons/a11y/package.json index 32cfa13598da..7c53fa68d717 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-a11y", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "a11y addon for storybook", "keywords": [ "a11y", @@ -33,13 +33,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "axe-core": "^3.3.2", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/addons/a11y/src/components/A11YPanel.tsx b/addons/a11y/src/components/A11YPanel.tsx index de8215a1b6ab..2befa30cc5a0 100644 --- a/addons/a11y/src/components/A11YPanel.tsx +++ b/addons/a11y/src/components/A11YPanel.tsx @@ -26,7 +26,7 @@ const Icon = styled(Icons)({ marginRight: 4, }); -const RotatingIcon = styled(Icon)(({ theme }) => ({ +const RotatingIcon = styled(Icon)<{}>(({ theme }) => ({ animation: `${theme.animation.rotate360} 1s linear infinite;`, })); diff --git a/addons/actions/README.md b/addons/actions/README.md index d7cf0be887c3..fa6c1c615694 100644 --- a/addons/actions/README.md +++ b/addons/actions/README.md @@ -18,7 +18,7 @@ Then, add following content to `.storybook/main.js` ```js module.exports = { - addons: ['@storybook/addon-actions/register'] + addons: ['@storybook/addon-actions'] } ``` diff --git a/addons/actions/package.json b/addons/actions/package.json index d1393c179176..c534bc568abe 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-actions", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Action Logger addon for storybook", "keywords": [ "storybook" @@ -28,12 +28,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "fast-deep-equal": "^3.1.1", "global": "^4.3.2", diff --git a/addons/actions/src/components/ActionLogger/style.tsx b/addons/actions/src/components/ActionLogger/style.tsx index 450e407a697c..4ffe870286c8 100644 --- a/addons/actions/src/components/ActionLogger/style.tsx +++ b/addons/actions/src/components/ActionLogger/style.tsx @@ -8,6 +8,7 @@ export const Action = styled.div({ borderBottom: '1px solid transparent', transition: 'all 0.1s', alignItems: 'flex-start', + whiteSpace: 'pre', }); export const Counter = styled.div<{}>(({ theme }) => ({ diff --git a/addons/backgrounds/README.md b/addons/backgrounds/README.md index fe8554429f64..51d9d5a2335f 100644 --- a/addons/backgrounds/README.md +++ b/addons/backgrounds/README.md @@ -20,7 +20,7 @@ Add following content to it: ```js module.exports = { - addons: ['@storybook/addon-backgrounds/register'] + addons: ['@storybook/addon-backgrounds'] } ``` diff --git a/addons/backgrounds/package.json b/addons/backgrounds/package.json index 29c57516fe8a..f4372022e77b 100644 --- a/addons/backgrounds/package.json +++ b/addons/backgrounds/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-backgrounds", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "A storybook addon to show different backgrounds for your preview", "keywords": [ "addon", @@ -32,12 +32,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "memoizerific": "^1.11.3", "react": "^16.8.3", diff --git a/addons/backgrounds/src/containers/BackgroundSelector.tsx b/addons/backgrounds/src/containers/BackgroundSelector.tsx index f2876d89cef1..589aa857d838 100644 --- a/addons/backgrounds/src/containers/BackgroundSelector.tsx +++ b/addons/backgrounds/src/containers/BackgroundSelector.tsx @@ -64,7 +64,7 @@ const getSelectedBackgroundColor = (list: Input[], currentSelectedValue: string) }; const mapper = ({ api, state }: Combo): { items: Input[]; selected: string | null } => { - const story = state.storiesHash[state.storyId]; + const story = api.getData(state.storyId); const list = story ? api.getParameters(story.id, PARAM_KEY) : []; const selected = state.addons[PARAM_KEY] || null; diff --git a/addons/centered/package.json b/addons/centered/package.json index 8b6350210a10..585c7824912e 100644 --- a/addons/centered/package.json +++ b/addons/centered/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-centered", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook decorator to center components", "keywords": [ "addon", @@ -30,7 +30,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3" diff --git a/addons/contexts/README.md b/addons/contexts/README.md index 7a3f55afb418..a1345de3e90e 100644 --- a/addons/contexts/README.md +++ b/addons/contexts/README.md @@ -51,7 +51,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-contexts/register'] + addons: ['@storybook/addon-contexts'] } ``` @@ -84,7 +84,7 @@ Finally, you may want to modify the default setups at per story level. Here is h export const defaultView = () =>
; defaultView.story = { parameters: { - context: [{}] + contexts: [{}] } }; ``` diff --git a/addons/contexts/package.json b/addons/contexts/package.json index a6a677a3a73d..8f6ca7d61a5e 100644 --- a/addons/contexts/package.json +++ b/addons/contexts/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-contexts", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook Addon Contexts", "keywords": [ "preact", @@ -28,10 +28,10 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "qs": "^6.6.0", diff --git a/addons/cssresources/README.md b/addons/cssresources/README.md index bf15532f593e..fad0c977444b 100644 --- a/addons/cssresources/README.md +++ b/addons/cssresources/README.md @@ -20,7 +20,7 @@ Add following content to it: ```js module.exports = { - addons: ['@storybook/addon-cssresources/register'], + addons: ['@storybook/addon-cssresources'], }; ``` diff --git a/addons/cssresources/package.json b/addons/cssresources/package.json index 7864d029d6f4..607c1351e98a 100644 --- a/addons/cssresources/package.json +++ b/addons/cssresources/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-cssresources", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "A storybook addon to switch between css resources at runtime for your story", "keywords": [ "addon", @@ -32,11 +32,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react": "^16.8.3", diff --git a/addons/design-assets/README.md b/addons/design-assets/README.md index 06f7b69545b1..9f33edf6063b 100644 --- a/addons/design-assets/README.md +++ b/addons/design-assets/README.md @@ -15,7 +15,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-design-assets/register'] + addons: ['@storybook/addon-design-assets'] } ``` diff --git a/addons/design-assets/package.json b/addons/design-assets/package.json index 2a4395949cf4..35fc91b31fff 100644 --- a/addons/design-assets/package.json +++ b/addons/design-assets/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-design-assets", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Design asset preview for storybook", "keywords": [ "addon", @@ -34,12 +34,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react": "^16.8.3", diff --git a/addons/docs/docs/docspage.md b/addons/docs/docs/docspage.md index bda2721f61a9..8330d8408d75 100644 --- a/addons/docs/docs/docspage.md +++ b/addons/docs/docs/docspage.md @@ -207,8 +207,8 @@ Here is the `SlotContext` type definition: ```ts export interface SlotContext { id?: string; - selectedKind?: string; - selectedStory?: string; + kind?: string; + name?: string; parameters?: any; storyStore?: any; } diff --git a/addons/docs/docs/props-tables.md b/addons/docs/docs/props-tables.md index 00ca8ca88e0e..6d72e1342e13 100644 --- a/addons/docs/docs/props-tables.md +++ b/addons/docs/docs/props-tables.md @@ -10,6 +10,7 @@ Storybook Docs automatically generates props tables for components in supported - [Reporting a bug](#reporting-a-bug) - [Known limitations](#known-limitations) - [React](#react) + - [Fully support React.FC](#fully-support-reactfc) - [Vue](#vue) - [Angular](#angular) - [Web components](#web-components) @@ -73,6 +74,24 @@ This package relies on a variety of sub-packages to extract property information SB Docs for React uses `babel-plugin-react-docgen`/`react-docgen` for both JS PropTypes prop tables and, as of 6.0, TypeScript-driven props tables. +#### Fully support React.FC + +The biggest known issue is https://github.com/reactjs/react-docgen/issues/387, which means that the following common pattern **DOESN'T WORK**: + +```tsx +import React, { FC } from 'react'; +interface IProps { ... }; +const MyComponent: FC = ({ ... }) => ... +``` + +The following workaround is needed: + +```tsx +const MyComponent: FC = ({ ... }: IProps) => ... +``` + +Please upvote https://github.com/reactjs/react-docgen/issues/387 if this is affecting your productivity, or better yet, submit a fix! + ### Vue SB Docs for Vue uses `vue-docgen-loader`/`vue-docgen-api` for SFC and JSX components. diff --git a/addons/docs/docs/recipes.md b/addons/docs/docs/recipes.md index ab1fdc1d4619..d76e006b066e 100644 --- a/addons/docs/docs/recipes.md +++ b/addons/docs/docs/recipes.md @@ -14,6 +14,7 @@ - [DocsPage](#docspage) - [MDX Stories](#mdx-stories) - [Controlling a story's view mode](#controlling-a-storys-view-mode) +- [Customizing source snippets](#customizing-source-snippets) - [More resources](#more-resources) ## Component Story Format (CSF) with DocsPage @@ -58,7 +59,7 @@ basic.story = { ```md import { Meta, Story } from '@storybook/addon-docs/blocks'; -import \* as stories from './Button.stories.js'; +import * as stories from './Button.stories.js'; import { SomeComponent } from 'path/to/SomeComponent'; @@ -205,7 +206,7 @@ foo.story = { parameters: { docs: { disable: true } } }; User writes documentation & stories side-by-side in a single MDX file, and wants those stories to show up in the canvas but not in the docs themselves. They want something similar to the recipe "CSF stories with MDX docs" but want to do everything in MDX: ```js - + ``` @@ -235,6 +236,37 @@ addParameters({ }); ``` +## Customizing source snippets + +As of SB 6.0, there are two ways to customize how Docs renders source code, via story parameter or via a formatting function. + +If you override the `docs.source.code` parameter, the `Source` block will render whatever string is added: + +```js +const Example = () => ; componentNotes.story = {}; componentNotes.story.name = 'component notes'; -componentNotes.story.parameters = { mdxSource: '' }; +componentNotes.story.parameters = { storySource: { source: '' } }; const componentMeta = { title: 'Button', id: 'button-id', includeStories: ['componentNotes'] }; diff --git a/addons/docs/src/mdx/__testfixtures__/decorators.output.snapshot b/addons/docs/src/mdx/__testfixtures__/decorators.output.snapshot index efa5da26dcff..40ef429be95b 100644 --- a/addons/docs/src/mdx/__testfixtures__/decorators.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/decorators.output.snapshot @@ -54,7 +54,7 @@ MDXContent.isMDXComponent = true; export const one = () => ; one.story = {}; one.story.name = 'one'; -one.story.parameters = { mdxSource: '' }; +one.story.parameters = { storySource: { source: '' } }; one.story.decorators = [storyFn =>
{storyFn()}
]; const componentMeta = { diff --git a/addons/docs/src/mdx/__testfixtures__/non-story-exports.output.snapshot b/addons/docs/src/mdx/__testfixtures__/non-story-exports.output.snapshot index 73e2e57b8264..22a60f4b746b 100644 --- a/addons/docs/src/mdx/__testfixtures__/non-story-exports.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/non-story-exports.output.snapshot @@ -42,12 +42,12 @@ MDXContent.isMDXComponent = true; export const one = () => ; one.story = {}; one.story.name = 'one'; -one.story.parameters = { mdxSource: '' }; +one.story.parameters = { storySource: { source: '' } }; export const helloStory = () => ; helloStory.story = {}; helloStory.story.name = 'hello story'; -helloStory.story.parameters = { mdxSource: '' }; +helloStory.story.parameters = { storySource: { source: '' } }; const componentMeta = { title: 'Button', includeStories: ['one', 'helloStory'] }; diff --git a/addons/docs/src/mdx/__testfixtures__/parameters.output.snapshot b/addons/docs/src/mdx/__testfixtures__/parameters.output.snapshot index 653874a33800..3ed110aadad4 100644 --- a/addons/docs/src/mdx/__testfixtures__/parameters.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/parameters.output.snapshot @@ -51,13 +51,13 @@ MDXContent.isMDXComponent = true; export const componentNotes = () => ; componentNotes.story = {}; componentNotes.story.name = 'component notes'; -componentNotes.story.parameters = { mdxSource: '' }; +componentNotes.story.parameters = { storySource: { source: '' } }; export const storyNotes = () => ; storyNotes.story = {}; storyNotes.story.name = 'story notes'; storyNotes.story.parameters = { - mdxSource: '', + storySource: { source: '' }, ...{ notes: 'story notes', }, diff --git a/addons/docs/src/mdx/__testfixtures__/previews.output.snapshot b/addons/docs/src/mdx/__testfixtures__/previews.output.snapshot index 84c62354f846..08f6961acb33 100644 --- a/addons/docs/src/mdx/__testfixtures__/previews.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/previews.output.snapshot @@ -55,12 +55,12 @@ MDXContent.isMDXComponent = true; export const helloButton = () => ; helloButton.story = {}; helloButton.story.name = 'hello button'; -helloButton.story.parameters = { mdxSource: '' }; +helloButton.story.parameters = { storySource: { source: '' } }; export const two = () => ; two.story = {}; two.story.name = 'two'; -two.story.parameters = { mdxSource: '' }; +two.story.parameters = { storySource: { source: '' } }; const componentMeta = { title: 'Button', diff --git a/addons/docs/src/mdx/__testfixtures__/story-def-text-only.output.snapshot b/addons/docs/src/mdx/__testfixtures__/story-def-text-only.output.snapshot index bf3119af433e..aea65a426d92 100644 --- a/addons/docs/src/mdx/__testfixtures__/story-def-text-only.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/story-def-text-only.output.snapshot @@ -35,7 +35,7 @@ MDXContent.isMDXComponent = true; export const text = () => 'Plain text'; text.story = {}; text.story.name = 'text'; -text.story.parameters = { mdxSource: \\"'Plain text'\\" }; +text.story.parameters = { storySource: { source: \\"'Plain text'\\" } }; const componentMeta = { title: 'Text', includeStories: ['text'] }; diff --git a/addons/docs/src/mdx/__testfixtures__/story-definitions.output.snapshot b/addons/docs/src/mdx/__testfixtures__/story-definitions.output.snapshot index fe961c6a0b78..5f8f3d422c62 100644 --- a/addons/docs/src/mdx/__testfixtures__/story-definitions.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/story-definitions.output.snapshot @@ -45,22 +45,22 @@ MDXContent.isMDXComponent = true; export const one = () => ; one.story = {}; one.story.name = 'one'; -one.story.parameters = { mdxSource: '' }; +one.story.parameters = { storySource: { source: '' } }; export const helloStory = () => ; helloStory.story = {}; helloStory.story.name = 'hello story'; -helloStory.story.parameters = { mdxSource: '' }; +helloStory.story.parameters = { storySource: { source: '' } }; export const wPunctuation = () => ; wPunctuation.story = {}; wPunctuation.story.name = 'w/punctuation'; -wPunctuation.story.parameters = { mdxSource: '' }; +wPunctuation.story.parameters = { storySource: { source: '' } }; export const _1FineDay = () => ; _1FineDay.story = {}; _1FineDay.story.name = '1 fine day'; -_1FineDay.story.parameters = { mdxSource: '' }; +_1FineDay.story.parameters = { storySource: { source: '' } }; const componentMeta = { title: 'Button', diff --git a/addons/docs/src/mdx/__testfixtures__/story-function-var.output.snapshot b/addons/docs/src/mdx/__testfixtures__/story-function-var.output.snapshot index e8f34c252fba..f063e31dba85 100644 --- a/addons/docs/src/mdx/__testfixtures__/story-function-var.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/story-function-var.output.snapshot @@ -39,7 +39,7 @@ MDXContent.isMDXComponent = true; export const basic = assertIsFn(basicFn); basic.story = {}; basic.story.name = 'basic'; -basic.story.parameters = { mdxSource: 'basicFn' }; +basic.story.parameters = { storySource: { source: 'basicFn' } }; const componentMeta = { title: 'story-function-var', includeStories: ['basic'] }; diff --git a/addons/docs/src/mdx/__testfixtures__/story-function.output.snapshot b/addons/docs/src/mdx/__testfixtures__/story-function.output.snapshot index b07cfe9ba90e..b2052dbd71d5 100644 --- a/addons/docs/src/mdx/__testfixtures__/story-function.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/story-function.output.snapshot @@ -42,8 +42,10 @@ export const functionStory = () => { functionStory.story = {}; functionStory.story.name = 'function'; functionStory.story.parameters = { - mdxSource: - \\"() => {\\\\n const btn = document.createElement('button');\\\\n btn.innerHTML = 'Hello Button';\\\\n btn.addEventListener('click', action('Click'));\\\\n return btn;\\\\n}\\", + storySource: { + source: + \\"() => {\\\\n const btn = document.createElement('button');\\\\n btn.innerHTML = 'Hello Button';\\\\n btn.addEventListener('click', action('Click'));\\\\n return btn;\\\\n}\\", + }, }; const componentMeta = { includeStories: ['functionStory'] }; diff --git a/addons/docs/src/mdx/__testfixtures__/story-object.output.snapshot b/addons/docs/src/mdx/__testfixtures__/story-object.output.snapshot index 052034b5ef65..05b97a151ac3 100644 --- a/addons/docs/src/mdx/__testfixtures__/story-object.output.snapshot +++ b/addons/docs/src/mdx/__testfixtures__/story-object.output.snapshot @@ -54,8 +54,10 @@ export const toStorybook = () => ({ toStorybook.story = {}; toStorybook.story.name = 'to storybook'; toStorybook.story.parameters = { - mdxSource: - '{\\\\n template: \`\`,\\\\n props: {\\\\n showApp: linkTo(\\\\'Button\\\\')\\\\n },\\\\n moduleMetadata: {\\\\n declarations: [Welcome]\\\\n }\\\\n}', + storySource: { + source: + '{\\\\n template: \`\`,\\\\n props: {\\\\n showApp: linkTo(\\\\'Button\\\\')\\\\n },\\\\n moduleMetadata: {\\\\n declarations: [Welcome]\\\\n }\\\\n}', + }, }; const componentMeta = { title: 'MDX|Welcome', includeStories: ['toStorybook'] }; diff --git a/addons/docs/src/mdx/mdx-compiler-plugin.js b/addons/docs/src/mdx/mdx-compiler-plugin.js index 2e66b82446f3..ab237746a7c5 100644 --- a/addons/docs/src/mdx/mdx-compiler-plugin.js +++ b/addons/docs/src/mdx/mdx-compiler-plugin.js @@ -94,12 +94,12 @@ function genStoryExport(ast, context) { let parameters = getAttr(ast.openingElement, 'parameters'); parameters = parameters && parameters.expression; const source = jsStringEscape(storyCode); + const sourceParam = `storySource: { source: '${source}' }`; if (parameters) { const { code: params } = generate(parameters, {}); - // FIXME: hack in the story's source as a parameter - statements.push(`${storyKey}.story.parameters = { mdxSource: '${source}', ...${params} };`); + statements.push(`${storyKey}.story.parameters = { ${sourceParam}, ...${params} };`); } else { - statements.push(`${storyKey}.story.parameters = { mdxSource: '${source}' };`); + statements.push(`${storyKey}.story.parameters = { ${sourceParam} };`); } let decorators = getAttr(ast.openingElement, 'decorators'); diff --git a/addons/essentials/package.json b/addons/essentials/package.json index 8dba37f87321..839ba49bf7d6 100644 --- a/addons/essentials/package.json +++ b/addons/essentials/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-essentials", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Curated addons to bring out the best of Storybook", "keywords": [ "addon", @@ -28,11 +28,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addon-backgrounds": "6.0.0-alpha.19", - "@storybook/addon-viewport": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/node-logger": "6.0.0-alpha.19", + "@storybook/addon-backgrounds": "6.0.0-alpha.25", + "@storybook/addon-viewport": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/node-logger": "6.0.0-alpha.25", "core-js": "^3.0.1", "regenerator-runtime": "^0.13.3", "ts-dedent": "^1.1.1" diff --git a/addons/events/README.md b/addons/events/README.md index bf2db1622938..28a8dad389f6 100644 --- a/addons/events/README.md +++ b/addons/events/README.md @@ -16,7 +16,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-events/register'] + addons: ['@storybook/addon-events'] } ``` diff --git a/addons/events/package.json b/addons/events/package.json index 918a540a1f6b..d86e6dd25dac 100644 --- a/addons/events/package.json +++ b/addons/events/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-events", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Add events to your Storybook stories.", "keywords": [ "addon", @@ -31,11 +31,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "format-json": "^1.0.3", "lodash": "^4.17.15", diff --git a/addons/events/src/components/Event.tsx b/addons/events/src/components/Event.tsx index 43759c0c3180..a1732a1b7846 100644 --- a/addons/events/src/components/Event.tsx +++ b/addons/events/src/components/Event.tsx @@ -1,5 +1,4 @@ import React, { ChangeEvent, Component } from 'react'; -import PropTypes from 'prop-types'; import { polyfill } from 'react-lifecycles-compat'; import isEqual from 'lodash/isEqual'; @@ -109,19 +108,7 @@ interface ItemState { } class Item extends Component { - static propTypes = { - name: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - onEmit: PropTypes.func.isRequired, - // eslint-disable-next-line react/forbid-prop-types - payload: PropTypes.any, - }; - - static defaultProps = { - payload: {}, - }; - - static getDerivedStateFromProps = ({ payload }: ItemProps, { prevPayload }: ItemState) => { + static getDerivedStateFromProps = ({ payload = {} }: ItemProps, { prevPayload }: ItemState) => { if (!isEqual(payload, prevPayload)) { const payloadString = json.plain(payload); const refinedPayload = getJSONFromString(payloadString); diff --git a/addons/events/src/components/Panel.tsx b/addons/events/src/components/Panel.tsx index ed1ff169fde5..a42d5ae455e2 100644 --- a/addons/events/src/components/Panel.tsx +++ b/addons/events/src/components/Panel.tsx @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import PropTypes from 'prop-types'; import { styled } from '@storybook/theming'; import { API } from '@storybook/api'; @@ -24,15 +23,6 @@ interface EventsPanelState { } export default class EventsPanel extends Component { - static propTypes = { - active: PropTypes.bool.isRequired, - api: PropTypes.shape({ - emit: PropTypes.func, - off: PropTypes.func, - on: PropTypes.func, - }).isRequired, - }; - state: EventsPanelState = { events: [], }; diff --git a/addons/google-analytics/README.md b/addons/google-analytics/README.md index 3026e4c6b69f..841bab0872ba 100644 --- a/addons/google-analytics/README.md +++ b/addons/google-analytics/README.md @@ -16,7 +16,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-google-analytics/register'] + addons: ['@storybook/addon-google-analytics'] } ``` diff --git a/addons/google-analytics/package.json b/addons/google-analytics/package.json index 9ad79ba02046..bb012f0cfaa3 100644 --- a/addons/google-analytics/package.json +++ b/addons/google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-google-analytics", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook addon for google analytics", "keywords": [ "addon", @@ -20,8 +20,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react-ga": "^2.5.7", diff --git a/addons/graphql/package.json b/addons/graphql/package.json index 2db2f7a84cb3..dcd088a88afd 100644 --- a/addons/graphql/package.json +++ b/addons/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-graphql", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook addon to display the GraphiQL IDE", "keywords": [ "addon", @@ -29,8 +29,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "graphiql": "^0.17.5", diff --git a/addons/graphql/src/components/FullScreen/index.tsx b/addons/graphql/src/components/FullScreen/index.tsx index abec3ffcfe00..692b699be613 100644 --- a/addons/graphql/src/components/FullScreen/index.tsx +++ b/addons/graphql/src/components/FullScreen/index.tsx @@ -1,10 +1,6 @@ import React, { FunctionComponent } from 'react'; -import PropTypes from 'prop-types'; import { style } from './style'; export const FullScreen: FunctionComponent = ({ children }) => { return
{children}
; }; - -FullScreen.defaultProps = { children: null }; -FullScreen.propTypes = { children: PropTypes.node }; diff --git a/addons/graphql/src/manager.tsx b/addons/graphql/src/manager.tsx index 255fc79d2037..083bba0e626e 100644 --- a/addons/graphql/src/manager.tsx +++ b/addons/graphql/src/manager.tsx @@ -1,5 +1,4 @@ import React, { FunctionComponent } from 'react'; -import PropTypes from 'prop-types'; import GraphiQL from 'graphiql'; import 'graphiql/graphiql.css'; @@ -16,7 +15,7 @@ const GQL: FunctionComponent = ({ active }) => { return active ? ( {({ api, state }: Combo) => { - const story = state.storiesHash[state.storyId]; + const story = api.getData(state.storyId); const parameters = story ? api.getParameters(story.id, PARAM_KEY) : null; if (parameters) { @@ -32,8 +31,5 @@ const GQL: FunctionComponent = ({ active }) => { ) : null; }; -GQL.propTypes = { - active: PropTypes.bool.isRequired, -}; export default GQL; diff --git a/addons/jest/README.md b/addons/jest/README.md index fa3b1f2433b8..c78ad31d6203 100644 --- a/addons/jest/README.md +++ b/addons/jest/README.md @@ -73,7 +73,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-jest/register'] + addons: ['@storybook/addon-jest'] } ``` diff --git a/addons/jest/package.json b/addons/jest/package.json index 6ee87a866a15..bdb2f4a51e02 100644 --- a/addons/jest/package.json +++ b/addons/jest/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-jest", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "React storybook addon that show component jest report", "keywords": [ "addon", @@ -35,11 +35,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react": "^16.8.3", diff --git a/addons/knobs/README.md b/addons/knobs/README.md index 14e5e033b323..df3dc65c2bc6 100644 --- a/addons/knobs/README.md +++ b/addons/knobs/README.md @@ -23,7 +23,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-knobs/register'] + addons: ['@storybook/addon-knobs'] } ``` diff --git a/addons/knobs/package.json b/addons/knobs/package.json index 99e5f72003ce..c9febd253ad2 100644 --- a/addons/knobs/package.json +++ b/addons/knobs/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-knobs", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook Addon Prop Editor Component", "keywords": [ "addon", @@ -29,13 +29,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/channels": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/channels": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "@types/react-color": "^3.0.1", "copy-to-clipboard": "^3.0.8", "core-js": "^3.0.1", diff --git a/addons/links/README.md b/addons/links/README.md index 22a7c0cf2a65..23c5d534797b 100644 --- a/addons/links/README.md +++ b/addons/links/README.md @@ -16,7 +16,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-links/register'] + addons: ['@storybook/addon-links'] } ``` diff --git a/addons/links/package.json b/addons/links/package.json index acc5b9d0b935..05a2d770d72e 100644 --- a/addons/links/package.json +++ b/addons/links/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-links", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Story Links addon for storybook", "keywords": [ "addon", @@ -29,11 +29,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", "@storybook/csf": "0.0.1", - "@storybook/router": "6.0.0-alpha.19", + "@storybook/router": "6.0.0-alpha.25", "@types/qs": "^6.9.0", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/addons/options/package.json b/addons/options/package.json index c5e320e6860b..bdfc546a7a3b 100644 --- a/addons/options/package.json +++ b/addons/options/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-options", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Options addon for storybook", "keywords": [ "addon", @@ -29,7 +29,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", "core-js": "^3.0.1", "regenerator-runtime": "^0.13.3", "util-deprecate": "^1.0.2" diff --git a/addons/queryparams/README.md b/addons/queryparams/README.md index 8f3402004371..d8f935da80b2 100644 --- a/addons/queryparams/README.md +++ b/addons/queryparams/README.md @@ -10,15 +10,19 @@ First, install the addon. $ yarn add @storybook/addon-queryparams --dev ``` -import the `withQuery` decorator so the url will be changed before rendering stories. +Add this line to your `main.js` file (create this file inside your storybook config directory if needed). + +```js +module.exports = { + addons: ['@storybook/addon-queryparams'], +}; +``` ```js import React from 'react'; -import { storiesOf, addDecorator } from '@storybook/react'; -import { withQuery } from '@storybook/addon-queryparams'; +import { storiesOf } from '@storybook/react'; storiesOf('button', module) - .addDecorator(withQuery) .addParameters({ query: { mock: true, diff --git a/addons/queryparams/package.json b/addons/queryparams/package.json index 1b990c43db7b..dad078dda110 100644 --- a/addons/queryparams/package.json +++ b/addons/queryparams/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-queryparams", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "parameter addon for storybook", "keywords": [ "addon", @@ -30,12 +30,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "qs": "^6.6.0", diff --git a/addons/queryparams/preset.js b/addons/queryparams/preset.js new file mode 100644 index 000000000000..a83f95279e7f --- /dev/null +++ b/addons/queryparams/preset.js @@ -0,0 +1 @@ +module.exports = require('./dist/preset'); diff --git a/addons/queryparams/src/index.ts b/addons/queryparams/src/index.ts index a84100160ad0..62138a138ba8 100644 --- a/addons/queryparams/src/index.ts +++ b/addons/queryparams/src/index.ts @@ -8,6 +8,7 @@ import { PARAM_KEY } from './constants'; export const withQuery = makeDecorator({ name: 'withQuery', parameterName: PARAM_KEY, + skipIfNoParametersOrOptions: true, wrapper: (getStory: StoryGetter, context: StoryContext, { parameters }) => { const { location } = document; const currentQuery = qs.parse(location.search, { ignoreQueryPrefix: true }); diff --git a/addons/queryparams/src/preset/addDecorator.ts b/addons/queryparams/src/preset/addDecorator.ts new file mode 100644 index 000000000000..f04053309f79 --- /dev/null +++ b/addons/queryparams/src/preset/addDecorator.ts @@ -0,0 +1,3 @@ +import { withQuery } from '../index'; + +export const decorators = [withQuery]; diff --git a/addons/queryparams/src/preset/index.ts b/addons/queryparams/src/preset/index.ts new file mode 100644 index 000000000000..07aae5c51990 --- /dev/null +++ b/addons/queryparams/src/preset/index.ts @@ -0,0 +1,11 @@ +type QueryParamsOptions = { + addDecorator?: boolean; +}; + +export function config(entry: any[] = [], { addDecorator = true }: QueryParamsOptions = {}) { + const queryParamsConfig = []; + if (addDecorator) { + queryParamsConfig.push(require.resolve('./addDecorator')); + } + return [...entry, ...queryParamsConfig]; +} diff --git a/addons/storyshots/storyshots-core/package.json b/addons/storyshots/storyshots-core/package.json index 53b25d27c54f..e17f32dbe68f 100644 --- a/addons/storyshots/storyshots-core/package.json +++ b/addons/storyshots/storyshots-core/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storyshots", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "StoryShots is a Jest Snapshot Testing Addon for Storybook.", "keywords": [ "addon", @@ -33,9 +33,9 @@ }, "dependencies": { "@jest/transform": "^25.1.0", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/glob": "^7.1.1", "@types/jest": "^25.1.1", "@types/jest-specific-snapshot": "^0.5.3", @@ -50,8 +50,8 @@ "ts-dedent": "^1.1.1" }, "devDependencies": { - "@storybook/addon-docs": "6.0.0-alpha.19", - "@storybook/react": "6.0.0-alpha.19", + "@storybook/addon-docs": "6.0.0-alpha.25", + "@storybook/react": "6.0.0-alpha.25", "babel-loader": "^8.0.6", "enzyme": "^3.11.0", "enzyme-to-json": "^3.4.1", diff --git a/addons/storyshots/storyshots-core/src/frameworks/riot/renderTree.ts b/addons/storyshots/storyshots-core/src/frameworks/riot/renderTree.ts index ea866224600c..5982f47967c1 100644 --- a/addons/storyshots/storyshots-core/src/frameworks/riot/renderTree.ts +++ b/addons/storyshots/storyshots-core/src/frameworks/riot/renderTree.ts @@ -12,10 +12,11 @@ function bootstrapADocumentAndReturnANode() { function makeSureThatResultIsRenderedSomehow({ context, result, rootElement }: any) { if (!rootElement.firstChild) { + const { kind, name } = context; riotForStorybook.render({ storyFn: () => result, - selectedKind: context.kind, - selectedStory: context.name, + kind, + name, }); } } diff --git a/addons/storyshots/storyshots-puppeteer/package.json b/addons/storyshots/storyshots-puppeteer/package.json index 73ae770a273d..5ed22ad8b8c5 100644 --- a/addons/storyshots/storyshots-puppeteer/package.json +++ b/addons/storyshots/storyshots-puppeteer/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storyshots-puppeteer", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Image snapshots addition to StoryShots based on puppeteer", "keywords": [ "addon", @@ -30,7 +30,7 @@ }, "dependencies": { "@storybook/csf": "0.0.1", - "@storybook/node-logger": "6.0.0-alpha.19", + "@storybook/node-logger": "6.0.0-alpha.25", "@types/jest-image-snapshot": "^2.8.0", "@wordpress/jest-puppeteer-axe": "^1.5.0", "core-js": "^3.0.1", @@ -42,7 +42,7 @@ "@types/puppeteer": "^2.0.0" }, "peerDependencies": { - "@storybook/addon-storyshots": "6.0.0-alpha.19", + "@storybook/addon-storyshots": "6.0.0-alpha.25", "puppeteer": "^1.12.2 || ^2.0.0" }, "peerDependenciesMeta": { diff --git a/addons/storysource/package.json b/addons/storysource/package.json index c41d659e2552..1557223153cd 100644 --- a/addons/storysource/package.json +++ b/addons/storysource/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storysource", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Stories addon for storybook", "keywords": [ "addon", @@ -29,13 +29,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/router": "6.0.0-alpha.19", - "@storybook/source-loader": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/router": "6.0.0-alpha.25", + "@storybook/source-loader": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "estraverse": "^4.2.0", "loader-utils": "^1.2.3", diff --git a/addons/storysource/src/StoryPanel.tsx b/addons/storysource/src/StoryPanel.tsx index 8417ddfa060f..640a3504fb21 100644 --- a/addons/storysource/src/StoryPanel.tsx +++ b/addons/storysource/src/StoryPanel.tsx @@ -58,7 +58,7 @@ export const StoryPanel: React.FC = ({ api }) => { if (story) { const { parameters: { - mdxSource = '', + // @ts-ignore storySource: { source, locationsMap } = { source: '', locationsMap: {} }, } = {}, } = story; @@ -70,7 +70,7 @@ export const StoryPanel: React.FC = ({ api }) => { }) ] : undefined; - setState({ source: source || mdxSource, locationsMap, currentLocation }); + setState({ source, locationsMap, currentLocation }); } }, [story ? story.id : null]); React.useEffect(() => { diff --git a/addons/viewport/README.md b/addons/viewport/README.md index 853c64491b53..a38d49f37d63 100644 --- a/addons/viewport/README.md +++ b/addons/viewport/README.md @@ -24,7 +24,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['@storybook/addon-viewport/register'], + addons: ['@storybook/addon-viewport'], }; ``` diff --git a/addons/viewport/package.json b/addons/viewport/package.json index b4d845bf853a..feaaceae9412 100644 --- a/addons/viewport/package.json +++ b/addons/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-viewport", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook addon to change the viewport size to mobile", "keywords": [ "addon", @@ -29,12 +29,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "memoizerific": "^1.11.3", diff --git a/app/angular/package.json b/app/angular/package.json index 4d412102a9c9..e7629b254454 100644 --- a/app/angular/package.json +++ b/app/angular/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/angular", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,9 +34,9 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", - "@storybook/node-logger": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", + "@storybook/node-logger": "6.0.0-alpha.25", "@types/webpack-env": "^1.15.1", "core-js": "^3.0.1", "fork-ts-checker-webpack-plugin": "^4.0.3", diff --git a/app/ember/package.json b/app/ember/package.json index 74ee8b521491..937dfb988677 100644 --- a/app/ember/package.json +++ b/app/ember/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/ember", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.", "homepage": "https://github.com/storybookjs/storybook/tree/master/app/ember", "bugs": { @@ -32,7 +32,7 @@ }, "dependencies": { "@ember/test-helpers": "^1.7.0", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/core": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/ember/src/client/preview/render.ts b/app/ember/src/client/preview/render.ts index fa8dddd19995..a41145cd4c92 100644 --- a/app/ember/src/client/preview/render.ts +++ b/app/ember/src/client/preview/render.ts @@ -1,6 +1,6 @@ import { window, document } from 'global'; import dedent from 'ts-dedent'; -import { RenderMainArgs, ElementArgs, OptionsArgs } from './types'; +import { RenderContext, ElementArgs, OptionsArgs } from './types'; declare let Ember: any; @@ -52,18 +52,12 @@ function render(options: OptionsArgs, el: ElementArgs) { }); } -export default function renderMain({ - storyFn, - selectedKind, - selectedStory, - showMain, - showError, -}: RenderMainArgs) { +export default function renderMain({ storyFn, kind, name, showMain, showError }: RenderContext) { const element = storyFn(); if (!element) { showError({ - title: `Expecting a Ember element from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Ember element from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Ember element from the story? Use "() => hbs('{{component}}')" or "() => { return { diff --git a/app/ember/src/client/preview/types.ts b/app/ember/src/client/preview/types.ts index 1f12b509bb8d..b8d96b2b7d55 100644 --- a/app/ember/src/client/preview/types.ts +++ b/app/ember/src/client/preview/types.ts @@ -1,12 +1,4 @@ -import { StoryFn } from '@storybook/addons'; // eslint-disable-line - -export interface RenderMainArgs { - storyFn: StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; -} +export { RenderContext } from '@storybook/core'; export interface ShowErrorArgs { title: string; diff --git a/app/html/package.json b/app/html/package.json index e1cee4576677..f31c51c61ec3 100644 --- a/app/html/package.json +++ b/app/html/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/html", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,8 +34,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/webpack-env": "^1.15.1", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/app/html/src/client/preview/render.ts b/app/html/src/client/preview/render.ts index 103ecf65bf5b..a885d4d9ad96 100644 --- a/app/html/src/client/preview/render.ts +++ b/app/html/src/client/preview/render.ts @@ -1,17 +1,17 @@ import { document, Node } from 'global'; import dedent from 'ts-dedent'; -import { RenderMainArgs } from './types'; +import { RenderContext } from './types'; const rootElement = document.getElementById('root'); export default function renderMain({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain, showError, forceRender, -}: RenderMainArgs) { +}: RenderContext) { const element = storyFn(); showMain(); @@ -27,7 +27,7 @@ export default function renderMain({ rootElement.appendChild(element); } else { showError({ - title: `Expecting an HTML snippet or DOM node from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting an HTML snippet or DOM node from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the HTML snippet from the story? Use "() => " or when defining the story. diff --git a/app/html/src/client/preview/types.ts b/app/html/src/client/preview/types.ts index 36432e1a4558..d12d2266fbaf 100644 --- a/app/html/src/client/preview/types.ts +++ b/app/html/src/client/preview/types.ts @@ -1,4 +1,4 @@ -import { StoryFn } from '@storybook/addons'; +export { RenderContext } from '@storybook/core'; export type StoryFnHtmlReturnType = string | Node; @@ -16,12 +16,3 @@ export interface ShowErrorArgs { title: string; description: string; } - -export interface RenderMainArgs { - storyFn: () => StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - forceRender: boolean; -} diff --git a/app/marionette/package.json b/app/marionette/package.json index faf315677405..feb408c6273b 100644 --- a/app/marionette/package.json +++ b/app/marionette/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/marionette", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Marionette: Develop Marionette.js component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -25,7 +25,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/core": "6.0.0-alpha.19", + "@storybook/core": "6.0.0-alpha.25", "common-tags": "^1.8.0", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/app/marionette/src/client/preview/render.js b/app/marionette/src/client/preview/render.js index cab2762d2034..c236aa3b4cfc 100644 --- a/app/marionette/src/client/preview/render.js +++ b/app/marionette/src/client/preview/render.js @@ -10,12 +10,12 @@ function render(view) { rootRegion.show(view); } -export default function renderMain({ storyFn, selectedKind, selectedStory, showMain, showError }) { +export default function renderMain({ storyFn, kind, name, showMain, showError }) { const element = storyFn(); if (!element) { showError({ - title: `Expecting a Marionette View from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Marionette View from the story: "${name}" of "${kind}".`, description: stripIndents` Did you forget to return the React element from the story? Use "() => ()" or "() => { return ; }" when defining the story. @@ -26,7 +26,7 @@ export default function renderMain({ storyFn, selectedKind, selectedStory, showM if (!isMarionetteRenderable(element)) { showError({ - title: `Expecting a valid Marionette View from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a valid Marionette View from the story: "${name}" of "${kind}".`, description: stripIndents` Seems like you are not returning a correct Marionette View from the story. Could you double check that? diff --git a/app/marko/package.json b/app/marko/package.json index 2250f720fee8..44802277396f 100644 --- a/app/marko/package.json +++ b/app/marko/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/marko", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Marko: Develop Marko Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,8 +34,8 @@ }, "dependencies": { "@marko/webpack": "^2.1.0", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/marko/src/client/preview/render.js b/app/marko/src/client/preview/render.js index 688359beaacb..b5b57cfeba43 100644 --- a/app/marko/src/client/preview/render.js +++ b/app/marko/src/client/preview/render.js @@ -9,8 +9,8 @@ let activeTemplate = null; // template for the currently loaded component. export default function renderMain({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain, showError, parameters, @@ -20,7 +20,7 @@ export default function renderMain({ if (!config || !(config.appendTo || config.component || parameters.component)) { showError({ - title: `Expecting an object with a component property to be returned from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting an object with a component property to be returned from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the component from the story? Use "() => ({ component: MyComponent, input: { hello: 'world' } })" when defining the story. diff --git a/app/mithril/package.json b/app/mithril/package.json index 1527a494c383..121bf8f553eb 100644 --- a/app/mithril/package.json +++ b/app/mithril/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/mithril", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Mithril: Develop Mithril Component in isolation.", "keywords": [ "storybook" @@ -36,8 +36,8 @@ "dependencies": { "@babel/core": "^7.8.4", "@babel/plugin-transform-react-jsx": "^7.3.0", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/mithril": "^2.0.0", "@types/webpack-env": "^1.15.1", "core-js": "^3.0.1", diff --git a/app/mithril/src/client/preview/render.ts b/app/mithril/src/client/preview/render.ts index a368489d5055..285e68a387b9 100644 --- a/app/mithril/src/client/preview/render.ts +++ b/app/mithril/src/client/preview/render.ts @@ -4,22 +4,16 @@ import { document } from 'global'; import m from 'mithril'; import dedent from 'ts-dedent'; -import { RenderMainArgs } from './types'; +import { RenderContext } from './types'; const rootEl = document.getElementById('root'); -export default function renderMain({ - storyFn, - selectedKind, - selectedStory, - showMain, - showError, -}: RenderMainArgs) { +export default function renderMain({ storyFn, kind, name, showMain, showError }: RenderContext) { const element = storyFn(); if (!element) { const error = { - title: `Expecting a Mithril element from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Mithril element from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Mithril element from the story? Use "() => MyComp" or "() => { return MyComp; }" when defining the story. diff --git a/app/mithril/src/client/preview/types.ts b/app/mithril/src/client/preview/types.ts index c9755ab82eb0..2e49c6bb73af 100644 --- a/app/mithril/src/client/preview/types.ts +++ b/app/mithril/src/client/preview/types.ts @@ -1,5 +1,7 @@ import m from 'mithril'; +export { RenderContext } from '@storybook/core'; + export interface IStorybookStory { name: string; render: () => any; @@ -16,13 +18,3 @@ export interface ShowErrorArgs { title: string; description: string; } - -export interface RenderMainArgs { - storyFn: () => StoryFnMithrilReturnType; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - showException: (err: Error) => void; - forceRender: boolean; -} diff --git a/app/preact/package.json b/app/preact/package.json index e71c437d25f9..e4adfb5a5aac 100644 --- a/app/preact/package.json +++ b/app/preact/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/preact", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Preact: Develop Preact Component in isolation.", "keywords": [ "storybook" @@ -35,8 +35,8 @@ }, "dependencies": { "@babel/plugin-transform-react-jsx": "^7.3.0", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/webpack-env": "^1.15.1", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/app/preact/src/client/preview/render.tsx b/app/preact/src/client/preview/render.tsx index c9ff924f4ef6..7626371b3241 100644 --- a/app/preact/src/client/preview/render.tsx +++ b/app/preact/src/client/preview/render.tsx @@ -1,23 +1,17 @@ import { h, render } from 'preact'; import { document } from 'global'; import dedent from 'ts-dedent'; -import { RenderMainArgs } from './types'; +import { RenderContext } from './types'; let renderedStory: Element; const rootElement = document ? document.getElementById('root') : null; -export default function renderMain({ - storyFn, - selectedKind, - selectedStory, - showMain, - showError, -}: RenderMainArgs) { +export default function renderMain({ storyFn, kind, name, showMain, showError }: RenderContext) { const element = storyFn(); if (!element) { showError({ - title: `Expecting a Preact element from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Preact element from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Preact element from the story? Use "() => ()" or "() => { return ; }" when defining the story. diff --git a/app/preact/src/client/preview/types.ts b/app/preact/src/client/preview/types.ts index d961b76f5c5b..4ba69cc4e252 100644 --- a/app/preact/src/client/preview/types.ts +++ b/app/preact/src/client/preview/types.ts @@ -1,4 +1,6 @@ -import { StoryFn, ClientStoryApi, Loadable } from '@storybook/addons'; +import { ClientStoryApi, Loadable } from '@storybook/addons'; + +export { RenderContext } from '@storybook/core'; export type StoryFnPreactReturnType = string | Node | preact.JSX.Element; @@ -7,15 +9,6 @@ export interface ShowErrorArgs { description: string; } -export interface RenderMainArgs { - storyFn: () => StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - forceRender: boolean; -} - export interface IStorybookStory { name: string; render: () => any; diff --git a/app/rax/package.json b/app/rax/package.json index c8fbc0a00aa8..183cbd1c53a5 100644 --- a/app/rax/package.json +++ b/app/rax/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/rax", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Rax: Develop Rax Component in isolation.", "keywords": [ "rax", @@ -34,7 +34,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/core": "6.0.0-alpha.19", + "@storybook/core": "6.0.0-alpha.25", "babel-preset-rax": "^1.0.0-beta.0", "core-js": "^3.0.1", "driver-dom": "^2.0.0", diff --git a/app/rax/src/client/preview/render.js b/app/rax/src/client/preview/render.js index 2652c257aed9..fc1b4c93f8f7 100644 --- a/app/rax/src/client/preview/render.js +++ b/app/rax/src/client/preview/render.js @@ -8,8 +8,8 @@ const rootElement = document ? document.getElementById('root') : null; export default function renderMain({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain, showError, // forceRender, @@ -18,7 +18,7 @@ export default function renderMain({ if (!Element) { showError({ - title: `Expecting a Rax element from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Rax element from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Rax element from the story? Use "() => ()" or "() => { return ; }" when defining the story. diff --git a/app/react/package.json b/app/react/package.json index 30c72c0f03dd..3785b04c47ae 100644 --- a/app/react/package.json +++ b/app/react/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/react", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -37,9 +37,9 @@ "@babel/plugin-transform-react-constant-elements": "^7.6.3", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", - "@storybook/node-logger": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", + "@storybook/node-logger": "6.0.0-alpha.25", "@svgr/webpack": "^5.1.0", "@types/webpack-env": "^1.15.1", "babel-plugin-add-react-displayname": "^0.0.5", @@ -57,6 +57,7 @@ "webpack": "^4.33.0" }, "devDependencies": { + "@storybook/client-api": "6.0.0-alpha.25", "@types/mini-css-extract-plugin": "^0.9.0", "@types/node": "^13.5.3", "@types/webpack": "^4.41.0" diff --git a/app/react/src/client/preview/render.tsx b/app/react/src/client/preview/render.tsx index 8f4d897f9d4a..e50f5a6b3393 100644 --- a/app/react/src/client/preview/render.tsx +++ b/app/react/src/client/preview/render.tsx @@ -1,7 +1,8 @@ import { document } from 'global'; -import React, { Component, ReactElement, StrictMode } from 'react'; +import React, { Component, FunctionComponent, ReactElement, StrictMode } from 'react'; import ReactDOM from 'react-dom'; -import { RenderMainArgs } from './types'; + +import { RenderContext } from './types'; const rootEl = document ? document.getElementById('root') : null; @@ -47,11 +48,14 @@ class ErrorBoundary extends Component<{ } export default async function renderMain({ - storyFn: StoryFn, + storyFn, showMain, showException, forceRender, -}: RenderMainArgs) { +}: RenderContext) { + // storyFn has context bound in by now so can be treated as a function component with no args + const StoryFn = storyFn as FunctionComponent; + const element = ( diff --git a/app/react/src/client/preview/types.ts b/app/react/src/client/preview/types.ts index 1b85b49c44ec..77efa5ee92e5 100644 --- a/app/react/src/client/preview/types.ts +++ b/app/react/src/client/preview/types.ts @@ -1,20 +1,13 @@ -import { FunctionComponent, ReactElement } from 'react'; +import { ReactElement } from 'react'; + +// eslint-disable-next-line import/no-extraneous-dependencies +export { RenderContext } from '@storybook/client-api'; export interface ShowErrorArgs { title: string; description: string; } -export interface RenderMainArgs { - storyFn: FunctionComponent; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - showException: (err: Error) => void; - forceRender: boolean; -} - export type StoryFnReactReturnType = ReactElement; export interface IStorybookStory { diff --git a/app/react/src/demo/Welcome.tsx b/app/react/src/demo/Welcome.tsx index 67ba2904f23e..c97702954ca8 100644 --- a/app/react/src/demo/Welcome.tsx +++ b/app/react/src/demo/Welcome.tsx @@ -5,7 +5,6 @@ import React, { FunctionComponent, HTMLAttributes, } from 'react'; -import PropTypes from 'prop-types'; type MainProps = Omit, HTMLElement>, 'style'>; const Main: FunctionComponent = props => ( @@ -25,12 +24,6 @@ type TitleProps = DetailedHTMLProps, HTMLHead const Title: FunctionComponent = ({ children, ...props }) => (

{children}

); -Title.propTypes = { - children: PropTypes.node, -}; -Title.defaultProps = { - children: undefined, -}; type NoteProps = Omit< DetailedHTMLProps, HTMLParagraphElement>, @@ -85,14 +78,6 @@ const Link: FunctionComponent = ({ children, href, target, rel, ...pr {children} ); -Link.propTypes = { - href: PropTypes.string, - children: PropTypes.node, -}; -Link.defaultProps = { - href: undefined, - children: undefined, -}; type NavButtonProps = Omit< DetailedHTMLProps, HTMLButtonElement>, @@ -120,12 +105,6 @@ const NavButton: FunctionComponent = ({ children, onClick, ...pr {children} ); -NavButton.propTypes = { - children: PropTypes.node, -}; -NavButton.defaultProps = { - children: undefined, -}; type WelcomeProps = { showApp: () => void; @@ -176,8 +155,5 @@ const Welcome: FunctionComponent = ({ showApp }) => ( ); Welcome.displayName = 'Welcome'; -Welcome.defaultProps = { - showApp: null, -}; export { Welcome as default }; diff --git a/app/riot/package.json b/app/riot/package.json index a6892ea2acb4..4f9967d087a5 100644 --- a/app/riot/package.json +++ b/app/riot/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/riot", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for riot.js: View riot snippets in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,7 +34,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/core": "6.0.0-alpha.19", + "@storybook/core": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "raw-loader": "^4.0.0", diff --git a/app/riot/src/client/preview/__snapshots__/render-riot.test.js.snap b/app/riot/src/client/preview/__snapshots__/render-riot.test.js.snap index 6e5c63342819..b67db362d53c 100644 --- a/app/riot/src/client/preview/__snapshots__/render-riot.test.js.snap +++ b/app/riot/src/client/preview/__snapshots__/render-riot.test.js.snap @@ -1,7 +1,72 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`render a riot element can accept a constructor 1`] = `"
HACKED : true ; simple test (with a parameter). Oh, by the way (value is mapped to riotValue)
"`; +exports[`render a riot element can accept a constructor 1`] = ` + +
+ HACKED : true ; simple test (with a parameter). Oh, by the way (value is mapped to riotValue) +
+
+`; -exports[`render a riot element can nest several tags 1`] = `"
Inside tag1:
  • Inside tag2:
    • Inside tag3:
      • Inside tag4:
        • Inside tag5:
          • Content
"`; +exports[`render a riot element can nest several tags 1`] = ` + +
+ +
+ Inside tag1: +
    +
  • + +
    + Inside tag2: +
      +
    • + +
      + Inside tag3: +
        +
      • + +
        + Inside tag4: +
          +
        • + +
          + Inside tag5: +
            +
          • + Content +
          • +
          +
          +
          +
        • +
        +
        +
        +
      • +
      +
      +
      +
    • +
    +
    +
    +
  • +
+
+
+
+
+`; -exports[`render a riot element can template some vars 1`] = `"
simple test (with a parameter). Oh, by the way (value is mapped to riotValue)
"`; +exports[`render a riot element can template some vars 1`] = ` + +
+ simple test (with a parameter). Oh, by the way (value is mapped to riotValue) +
+
+`; diff --git a/app/riot/src/client/preview/render.js b/app/riot/src/client/preview/render.js index 3138feb94063..f17ee2596383 100644 --- a/app/riot/src/client/preview/render.js +++ b/app/riot/src/client/preview/render.js @@ -5,8 +5,8 @@ import { render as renderRiot } from './rendering'; export default function renderMain({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain = () => {}, showError = () => {}, }) { @@ -19,7 +19,7 @@ export default function renderMain({ const rendered = renderRiot(element); if (!rendered) { showError({ - title: `Expecting a riot snippet or a riot component from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a riot snippet or a riot component from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the component snippet from the story? Use "() => " or when defining the story. diff --git a/app/server/package.json b/app/server/package.json index d7ac5b149b91..67b784b7a230 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,8 +34,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@storybook/node-logger": "^5.2.8", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index 9bb8a94dfe9a..904ac552a39b 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -1,6 +1,6 @@ import { document, fetch, Node } from 'global'; import dedent from 'ts-dedent'; -import { RenderMainArgs, FetchStoryHtmlType } from './types'; +import { RenderContext, FetchStoryHtmlType } from './types'; const rootElement = document.getElementById('root'); @@ -15,13 +15,13 @@ let fetchStoryHtml: FetchStoryHtmlType = async (url, path, params) => { export async function renderMain({ storyFn, id, - selectedKind, - selectedStory, + kind, + name, showMain, showError, forceRender, parameters, -}: RenderMainArgs) { +}: RenderContext) { const storyParams = storyFn(); const { @@ -45,7 +45,7 @@ export async function renderMain({ rootElement.appendChild(element); } else { showError({ - title: `Expecting an HTML snippet or DOM node from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting an HTML snippet or DOM node from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the HTML snippet from the story? Use "() => " or when defining the story. diff --git a/app/server/src/client/preview/types.ts b/app/server/src/client/preview/types.ts index c05f54ca5f47..23bdf5b3a12c 100644 --- a/app/server/src/client/preview/types.ts +++ b/app/server/src/client/preview/types.ts @@ -1,4 +1,4 @@ -import { StoryFn } from '@storybook/addons'; +export { RenderContext } from '@storybook/core'; export type StoryFnServerReturnType = any; @@ -22,14 +22,3 @@ export interface ShowErrorArgs { export interface ConfigureOptionsArgs { fetchStoryHtml: FetchStoryHtmlType; } - -export interface RenderMainArgs { - storyFn: () => StoryFn; - id: string; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - forceRender: boolean; - parameters: any; -} diff --git a/app/svelte/package.json b/app/svelte/package.json index 1a48d55f6404..82cd5054992a 100644 --- a/app/svelte/package.json +++ b/app/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/svelte", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,8 +34,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", diff --git a/app/svelte/src/client/preview/render.ts b/app/svelte/src/client/preview/render.ts index 08698d43d07c..eed0d0d87430 100644 --- a/app/svelte/src/client/preview/render.ts +++ b/app/svelte/src/client/preview/render.ts @@ -1,7 +1,7 @@ import { detach, insert, noop } from 'svelte/internal'; import { document } from 'global'; import dedent from 'ts-dedent'; -import { MountViewArgs, RenderMainArgs } from './types'; +import { MountViewArgs, RenderContext } from './types'; type Component = any; @@ -73,13 +73,7 @@ function mountView({ Component, target, props, on, Wrapper, WrapperData }: Mount previousComponent = component; } -export default function render({ - storyFn, - selectedKind, - selectedStory, - showMain, - showError, -}: RenderMainArgs) { +export default function render({ storyFn, kind, name, showMain, showError }: RenderContext) { const { /** @type {SvelteComponent} */ Component, @@ -97,7 +91,7 @@ export default function render({ if (!DefaultCompatComponent) { showError({ - title: `Expecting a Svelte component from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Svelte component from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Svelte component configuration from the story? Use "() => ({ Component: YourComponent, data: {} })" diff --git a/app/svelte/src/client/preview/types.ts b/app/svelte/src/client/preview/types.ts index 31bf80ea6267..4382e18ca0ff 100644 --- a/app/svelte/src/client/preview/types.ts +++ b/app/svelte/src/client/preview/types.ts @@ -1,18 +1,10 @@ -import { StoryFn } from '@storybook/addons'; +export { RenderContext } from '@storybook/core'; export interface ShowErrorArgs { title: string; description: string; } -export interface RenderMainArgs { - storyFn: StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; -} - export interface MountViewArgs { Component: any; target: any; diff --git a/app/vue/package.json b/app/vue/package.json index fff659c1fdbb..f14c2d088fb9 100644 --- a/app/vue/package.json +++ b/app/vue/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/vue", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -34,8 +34,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/webpack-env": "^1.15.1", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/app/vue/src/client/preview/index.ts b/app/vue/src/client/preview/index.ts index b3188e051a28..09b69690dbcd 100644 --- a/app/vue/src/client/preview/index.ts +++ b/app/vue/src/client/preview/index.ts @@ -68,6 +68,8 @@ const defaultContext: StoryContext = { name: 'unspecified', kind: 'unspecified', parameters: {}, + args: {}, + globalArgs: {}, }; function decorateStory( diff --git a/app/vue/src/client/preview/render.ts b/app/vue/src/client/preview/render.ts index 03967e7fa4f7..a5cdd49fa5b5 100644 --- a/app/vue/src/client/preview/render.ts +++ b/app/vue/src/client/preview/render.ts @@ -1,6 +1,6 @@ import dedent from 'ts-dedent'; import Vue from 'vue'; -import { RenderMainArgs } from './types'; +import { RenderContext } from './types'; export const COMPONENT = 'STORYBOOK_COMPONENT'; export const VALUES = 'STORYBOOK_VALUES'; @@ -20,20 +20,20 @@ const root = new Vue({ export default function render({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain, showError, showException, forceRender, -}: RenderMainArgs) { +}: RenderContext) { Vue.config.errorHandler = showException; const element = storyFn(); if (!element) { showError({ - title: `Expecting a Vue component from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting a Vue component from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the Vue component from the story? Use "() => ({ template: '' })" or "() => ({ components: MyComp, template: '' })" when defining the story. diff --git a/app/vue/src/client/preview/types.ts b/app/vue/src/client/preview/types.ts index 7f89facb4e23..94442a01779c 100644 --- a/app/vue/src/client/preview/types.ts +++ b/app/vue/src/client/preview/types.ts @@ -1,22 +1,12 @@ -import { Component, VueConstructor } from 'vue'; -import { StoryFn } from '@storybook/addons'; -// TODO, 'any' should be what is actually expected from a storyFn +import { Component } from 'vue'; + +export { RenderContext } from '@storybook/core'; export interface ShowErrorArgs { title: string; description: string; } -export interface RenderMainArgs { - storyFn: StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - showException: (...args: any[]) => void; - forceRender: boolean; -} - // TODO: some vue expert needs to look at this export type StoryFnVueReturnType = string | Component; diff --git a/app/web-components/package.json b/app/web-components/package.json index 008cd5aaf520..4f45ffcaac52 100644 --- a/app/web-components/package.json +++ b/app/web-components/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/web-components", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.", "keywords": [ "lit-html", @@ -38,8 +38,8 @@ "dependencies": { "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-syntax-import-meta": "^7.2.0", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/core": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/core": "6.0.0-alpha.25", "@types/webpack-env": "^1.15.1", "babel-plugin-bundled-import-meta": "^0.3.1", "core-js": "^3.0.1", diff --git a/app/web-components/src/client/preview/render.ts b/app/web-components/src/client/preview/render.ts index 9f87fa36e607..77c5b87e36ba 100644 --- a/app/web-components/src/client/preview/render.ts +++ b/app/web-components/src/client/preview/render.ts @@ -1,18 +1,18 @@ import { document, Node } from 'global'; import dedent from 'ts-dedent'; import { render, TemplateResult } from 'lit-html'; -import { RenderMainArgs } from './types'; +import { RenderContext } from './types'; const rootElement = document.getElementById('root'); export default function renderMain({ storyFn, - selectedKind, - selectedStory, + kind, + name, showMain, showError, forceRender, -}: RenderMainArgs) { +}: RenderContext) { const element = storyFn(); showMain(); @@ -38,7 +38,7 @@ export default function renderMain({ rootElement.appendChild(element); } else { showError({ - title: `Expecting an HTML snippet or DOM node from the story: "${selectedStory}" of "${selectedKind}".`, + title: `Expecting an HTML snippet or DOM node from the story: "${name}" of "${kind}".`, description: dedent` Did you forget to return the HTML snippet from the story? Use "() => " or when defining the story. diff --git a/app/web-components/src/client/preview/types.ts b/app/web-components/src/client/preview/types.ts index f1fff195fe44..59574c428128 100644 --- a/app/web-components/src/client/preview/types.ts +++ b/app/web-components/src/client/preview/types.ts @@ -1,7 +1,8 @@ -import { StoryFn } from '@storybook/addons'; // eslint-disable-next-line import/no-extraneous-dependencies import { TemplateResult, SVGTemplateResult } from 'lit-element'; +export { RenderContext } from '@storybook/core'; + export type StoryFnHtmlReturnType = string | Node | TemplateResult | SVGTemplateResult; export interface IStorybookStory { @@ -18,12 +19,3 @@ export interface ShowErrorArgs { title: string; description: string; } - -export interface RenderMainArgs { - storyFn: () => StoryFn; - selectedKind: string; - selectedStory: string; - showMain: () => void; - showError: (args: ShowErrorArgs) => void; - forceRender: boolean; -} diff --git a/cypress/.eslintrc.json b/cypress/.eslintrc.json index 373914272e56..6b79ec1c5c1e 100644 --- a/cypress/.eslintrc.json +++ b/cypress/.eslintrc.json @@ -1,5 +1,8 @@ { "extends": [ "plugin:cypress/recommended" - ] + ], + "rules": { + "import/no-extraneous-dependencies": ["error", {"devDependencies": true}] + } } diff --git a/cypress/helper.ts b/cypress/helper.ts index 61c9920125e4..a88beb996204 100644 --- a/cypress/helper.ts +++ b/cypress/helper.ts @@ -12,7 +12,7 @@ export const visitExample = (app: StorybookApps, route = '') => { .visit(`${baseUrl}/${app}/${route}`) .get(`#storybook-preview-iframe`) .then({ timeout: 10000 }, iframe => { - return cy.wrap(iframe).should(() => { + return cy.wrap(iframe, { timeout: 10000 }).should(() => { const content: Document | null = (iframe[0] as HTMLIFrameElement).contentDocument; const element: HTMLElement | null = content !== null ? content.documentElement : null; diff --git a/cypress/integration/navigation.spec.ts b/cypress/integration/navigation.spec.ts index 942cf47cc643..f9878318bc21 100644 --- a/cypress/integration/navigation.spec.ts +++ b/cypress/integration/navigation.spec.ts @@ -1,13 +1,15 @@ +/* eslint-disable jest/expect-expect */ import { visitExample } from '../helper'; describe('Navigation', () => { - beforeEach(() => { + before(() => { visitExample('official-storybook'); }); it('should search navigation item', () => { cy.get('#storybook-explorer-searchfield') .click() + .clear() .type('persisting the action logger'); cy.get('.sidebar-container a') @@ -18,6 +20,7 @@ describe('Navigation', () => { it('should display no results after searching a non-existing navigation item', () => { cy.get('#storybook-explorer-searchfield') .click() + .clear() .type('zzzzzzzzzz'); cy.get('.sidebar-container').should('contain', 'This filter resulted in 0 results'); @@ -25,9 +28,12 @@ describe('Navigation', () => { }); describe('Routing', () => { - it('should navigate to story addons-a11y-basebutton--default', () => { + before(() => { visitExample('official-storybook'); - cy.get('#exploreraddons-a11y-basebutton--label').click(); + }); + + it('should navigate to story addons-a11y-basebutton--default', () => { + cy.get('#addons-a11y-basebutton--label').click(); cy.url().should('include', 'path=/story/addons-a11y-basebutton--label'); }); diff --git a/cypress/report-teamcity-metadata.ts b/cypress/report-teamcity-metadata.ts new file mode 100644 index 000000000000..8775b9adfc33 --- /dev/null +++ b/cypress/report-teamcity-metadata.ts @@ -0,0 +1,73 @@ +import path from 'path'; +import fs from 'fs-extra'; + +import { testMetadata } from 'teamcity-service-messages'; +import { findSuitesAndTests } from 'mocha-list-tests'; + +const testsDir = path.join(__dirname, 'integration'); +const videosDir = path.join(__dirname, 'videos'); +const screensDir = path.join(__dirname, 'screenshots'); + +let prevFoundTests: string[] = []; +function getTests(fileName: string) { + const { tests } = findSuitesAndTests(path.join(testsDir, fileName)); + const newTests = tests.filter((test: string) => !prevFoundTests.includes(test)); + prevFoundTests = tests; + return newTests.map((test: string) => test.split(/\./)); +} + +const fullTestName = (suite: string, testName: string) => `${suite}: ${testName}`; + +async function report() { + const hookFailures: { [file: string]: Array<[string, string]> } = {}; + const reports: any[] = []; + try { + const testFiles = await fs.readdir(screensDir); + await Promise.all( + testFiles.map(async testFile => { + const files = await fs.readdir(path.join(screensDir, testFile)); + files.forEach(file => { + const match = file.match(/^(.*) \(failed\).png$/); + if (match == null) { + return; + } + + const [suite, test, hookPart] = match[1].split(' -- '); + let testName = test; + const hook = hookPart?.match(/^(.*) hook$/)?.[1]; + if (hook != null) { + testName = `"${hook}" hook for "${test}"`; + hookFailures[testFile] = hookFailures[testFile] || []; + hookFailures[testFile].push([suite, testName]); + } + reports.push({ + name: 'Screenshot', + testName: fullTestName(suite, testName), + type: 'image', + value: `screenshots.tar.gz!${testFile}/${file}`, + }); + }); + }) + ); + } catch (e) { + // ignore + } + + const videoFiles = await fs.readdir(videosDir); + videoFiles.forEach(videoFile => { + const testFile = videoFile.replace(/\.mp4$/, ''); + const tests = [...getTests(testFile), ...(hookFailures[testFile] || [])]; + tests.forEach(([suite, testName]) => + reports.unshift({ + name: 'Video', + testName: fullTestName(suite, testName), + type: 'video', + value: `videos.tar.gz!${videoFile}`, + }) + ); + }); + + reports.forEach(testMetadata); +} + +report(); diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 6375e4c73dfa..cae4f81611a5 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -4,7 +4,8 @@ "baseUrl": "../node_modules", "target": "es5", "lib": ["es2017", "dom"], - "types": ["cypress"] + "types": ["cypress", "node"], + "esModuleInterop": true }, "include": ["**/*.ts"] } diff --git a/cypress/typings.d.ts b/cypress/typings.d.ts new file mode 100644 index 000000000000..9c9be08dc12b --- /dev/null +++ b/cypress/typings.d.ts @@ -0,0 +1,2 @@ +declare module 'mocha-list-tests'; +declare module 'teamcity-service-messages'; diff --git a/dev-kits/addon-decorator/package.json b/dev-kits/addon-decorator/package.json index d74c5ee5db67..39bc0732b31e 100644 --- a/dev-kits/addon-decorator/package.json +++ b/dev-kits/addon-decorator/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-decorator", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "decorator addon for storybook", "keywords": [ "addon", @@ -24,8 +24,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.4.0" }, diff --git a/dev-kits/addon-parameter/package.json b/dev-kits/addon-parameter/package.json index 88deb260b3a6..6b430833666f 100644 --- a/dev-kits/addon-parameter/package.json +++ b/dev-kits/addon-parameter/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-parameter", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "parameter addon for storybook", "keywords": [ "addon", @@ -24,12 +24,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react": "^16.8.3", diff --git a/dev-kits/addon-preview-wrapper/package.json b/dev-kits/addon-preview-wrapper/package.json index 16a531a1a71c..5926eaf21d9e 100644 --- a/dev-kits/addon-preview-wrapper/package.json +++ b/dev-kits/addon-preview-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-preview-wrapper", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "preview wrapper addon for storybook", "keywords": [ "addon", @@ -24,7 +24,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", "react": "^16.8.3" }, "publishConfig": { diff --git a/dev-kits/addon-roundtrip/package.json b/dev-kits/addon-roundtrip/package.json index a272672a15a9..c0814f55be91 100644 --- a/dev-kits/addon-roundtrip/package.json +++ b/dev-kits/addon-roundtrip/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-roundtrip", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "description": "roundtrip addon for storybook", "keywords": [ "addon", @@ -24,13 +24,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/api": "6.0.0-alpha.19", - "@storybook/client-api": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/components": "6.0.0-alpha.19", - "@storybook/core-events": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/api": "6.0.0-alpha.25", + "@storybook/client-api": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/components": "6.0.0-alpha.25", + "@storybook/core-events": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "core-js": "^3.0.1", "global": "^4.3.2", "react": "^16.8.3", diff --git a/docs/src/pages/addons/using-addons/index.md b/docs/src/pages/addons/using-addons/index.md index a53d502936be..90fe7e6e5a7d 100644 --- a/docs/src/pages/addons/using-addons/index.md +++ b/docs/src/pages/addons/using-addons/index.md @@ -22,8 +22,8 @@ within `.storybook/main.js`: ```js module.exports = { addons: [ - '@storybook/addon-actions/register', - '@storybook/addon-knobs/register', + '@storybook/addon-actions', + '@storybook/addon-knobs', ], }; ``` diff --git a/docs/src/pages/addons/writing-addons/index.md b/docs/src/pages/addons/writing-addons/index.md index 0920acefff3c..f675ea18b40d 100644 --- a/docs/src/pages/addons/writing-addons/index.md +++ b/docs/src/pages/addons/writing-addons/index.md @@ -74,8 +74,8 @@ const PANEL_ID = `${ADDON_ID}/panel`; const MyPanel = () => { const value = useParameter(PARAM_KEY, null); - - return
{value}
; + const item = value ? value.data : ""; + return
{item}
; } addons.register(ADDON_ID, api => { @@ -101,7 +101,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['path/to/register.js'] + addons: ['path/to/addon'] } ``` @@ -132,7 +132,7 @@ Now we need to create two files, `register.js` and `index.js,`. `register.js` wi ## Creating a decorator -Let's add the following content to the `index.js`. It will expose a decorator called `withFoo` which we use the `.addDecorator()` API to decorate all our stories. +Let's add the following content to the `index.js`. It will expose a decorator called `withMyAddon` which we use the `.addDecorator()` API to decorate all our stories. The `@storybook/addons` package contains a `makeDecorator` function which we can use to create such a decorator: @@ -235,7 +235,7 @@ within `.storybook/main.js`: ```js module.exports = { - addons: ['path/to/register.js'] + addons: ['path/to/addon'] } ``` diff --git a/docs/src/pages/guides/guide-angular/index.md b/docs/src/pages/guides/guide-angular/index.md index 699967947daa..3978290a764d 100644 --- a/docs/src/pages/guides/guide-angular/index.md +++ b/docs/src/pages/guides/guide-angular/index.md @@ -31,17 +31,18 @@ npm install @storybook/angular --save-dev Make sure that you have `@babel/core`, and `babel-loader` in your dependencies as well because we list these as a peer dependencies: ```sh -npm install babel-loader @babel/core --save-dev +npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-ember/index.md b/docs/src/pages/guides/guide-ember/index.md index 101f59727d86..2a4dfa8b5815 100644 --- a/docs/src/pages/guides/guide-ember/index.md +++ b/docs/src/pages/guides/guide-ember/index.md @@ -35,15 +35,15 @@ If you don't have `package.json` in your project, you'll need to init it first: npm init ``` -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following npm scripts to your `package.json` in order to start the storybook later in this guide: > In order for your storybook to run properly be sure to be either run `ember serve` or `ember build` before running any storybook commands. Running `ember serve` before storybook will enable live reloading. ```json { "scripts": { - "build-storybook": "ember build && build-storybook -s dist", - "storybook": "ember serve & start-storybook -p 9001 -s dist" + "storybook": "ember serve & start-storybook -p 9001 -s dist", + "build-storybook": "ember build && build-storybook -s dist" } } ``` diff --git a/docs/src/pages/guides/guide-html/index.md b/docs/src/pages/guides/guide-html/index.md index 10915ad3ee34..ebbd68739c2f 100644 --- a/docs/src/pages/guides/guide-html/index.md +++ b/docs/src/pages/guides/guide-html/index.md @@ -39,17 +39,18 @@ npm install @storybook/html --save-dev Make sure that you have `@babel/core`, and `babel-loader` in your dependencies as well because we list these as a peer dependencies: ```sh -npm install babel-loader @babel/core --save-dev +npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-marko/index.md b/docs/src/pages/guides/guide-marko/index.md index 59dc9e4c7850..e434bfdea79e 100644 --- a/docs/src/pages/guides/guide-marko/index.md +++ b/docs/src/pages/guides/guide-marko/index.md @@ -31,17 +31,18 @@ npm install @storybook/marko --save-dev Make sure that you have `marko`, `@babel/core`, and `babel-loader` in your dependencies as well because we list these as a peer dependencies: ```sh -npm install babel-loader @babel/core --save-dev +npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-mithril/index.md b/docs/src/pages/guides/guide-mithril/index.md index bf23ad142e3d..86e1c911cd53 100644 --- a/docs/src/pages/guides/guide-mithril/index.md +++ b/docs/src/pages/guides/guide-mithril/index.md @@ -32,17 +32,18 @@ Make sure that you have `mithril`, `@babel/core`, and `babel-loader` in your dep ```sh npm install mithril --save -npm install babel-loader @babel/core --save-dev +npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-preact/index.md b/docs/src/pages/guides/guide-preact/index.md index 151a6d59773d..febf4981a976 100644 --- a/docs/src/pages/guides/guide-preact/index.md +++ b/docs/src/pages/guides/guide-preact/index.md @@ -32,17 +32,18 @@ Make sure that you have `preact`, `@babel/core`, and `babel-loader` in your depe ```sh npm install preact --save -npm install babel-loader @babel/core --save-dev +npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-rax/index.md b/docs/src/pages/guides/guide-rax/index.md index 6a0f2afb7eb2..11f92cec4eba 100644 --- a/docs/src/pages/guides/guide-rax/index.md +++ b/docs/src/pages/guides/guide-rax/index.md @@ -35,14 +35,15 @@ npm install rax --save npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-react/index.md b/docs/src/pages/guides/guide-react/index.md index 0b1ed604f45b..d6c817621b5a 100644 --- a/docs/src/pages/guides/guide-react/index.md +++ b/docs/src/pages/guides/guide-react/index.md @@ -53,14 +53,15 @@ npm install react react-dom --save npm install babel-loader @babel/core --save-dev ``` -## Step 2: Add an npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-riot/index.md b/docs/src/pages/guides/guide-riot/index.md index af459b3eb52f..e4940d1c0fbe 100644 --- a/docs/src/pages/guides/guide-riot/index.md +++ b/docs/src/pages/guides/guide-riot/index.md @@ -34,14 +34,15 @@ Make sure that you have `riot`, `@babel/core`, and `babel-loader` in your depend npm install riot babel-loader @babel/core --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-svelte/index.md b/docs/src/pages/guides/guide-svelte/index.md index bc877a8bf6f7..3e19e4918f34 100644 --- a/docs/src/pages/guides/guide-svelte/index.md +++ b/docs/src/pages/guides/guide-svelte/index.md @@ -45,14 +45,15 @@ You'll also need to install `svelte-loader` if you haven't already. npm install svelte-loader --save-dev ``` -## Step 2: Add a npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/guide-vue/index.md b/docs/src/pages/guides/guide-vue/index.md index 5b79cd0b22b7..8e031a1ff6fa 100644 --- a/docs/src/pages/guides/guide-vue/index.md +++ b/docs/src/pages/guides/guide-vue/index.md @@ -35,14 +35,15 @@ npm install vue --save npm install vue-loader vue-template-compiler @babel/core babel-loader babel-preset-vue --save-dev ``` -## Step 2: Add an npm script +## Step 2: Add npm scripts -Then add the following NPM script to your `package.json` in order to start the storybook later in this guide: +Then add the following scripts to your `package.json` in order to start the storybook later in this guide: ```json { "scripts": { - "storybook": "start-storybook" + "storybook": "start-storybook", + "build-storybook": "build-storybook" } } ``` diff --git a/docs/src/pages/guides/quick-start-guide/index.md b/docs/src/pages/guides/quick-start-guide/index.md index 535d31fd7481..01dd41ba15cd 100644 --- a/docs/src/pages/guides/quick-start-guide/index.md +++ b/docs/src/pages/guides/quick-start-guide/index.md @@ -13,7 +13,7 @@ cd my-project-directory npx -p @storybook/cli sb init ``` -The tool inspects your `package.json` to determine which view layer you're using. If you want to develop HTML snippets in storybook, we can't determine that automatically. So to install storybook for HTML, use the `--type` flag to force that the HTML project type: +The tool inspects your `package.json` to determine which view layer you're using. If you want to develop HTML snippets in storybook, we can't determine that automatically. So to install storybook for HTML, use the `--type` flag to force that the HTML project type is set: ```sh npx -p @storybook/cli sb init --type html diff --git a/docs/src/pages/presets/writing-presets/index.md b/docs/src/pages/presets/writing-presets/index.md index 2005391c667a..dee4caa6d378 100644 --- a/docs/src/pages/presets/writing-presets/index.md +++ b/docs/src/pages/presets/writing-presets/index.md @@ -107,7 +107,7 @@ For users, the name `managerEntries` might be a bit too technical, so instead bo ```js module.exports = { - addons: ['@storybook/addon-storysource/register'], + addons: ['@storybook/addon-storysource'], }; ``` diff --git a/docs/src/versions/next.json b/docs/src/versions/next.json index 84c100ffd676..357ae6ed280b 100644 --- a/docs/src/versions/next.json +++ b/docs/src/versions/next.json @@ -1 +1 @@ -{"version":"6.0.0-alpha.19","info":{"plain":"### Features\n\n* Addon-links: Add preset ([#9932](https://github.com/storybookjs/storybook/pull/9932))\n\n### Bug Fixes\n\n* Addon-docs: Restore IE11 compat on Windows by transpiling acorn-jsx ([#9790](https://github.com/storybookjs/storybook/pull/9790))"}} \ No newline at end of file +{"version":"6.0.0-alpha.25","info":{"plain":"NOTE: `6.0.0-alpha.24` broken due to bad merge. Sorry!\n\n### Bug Fixes\n\n- Core: Fix initialization of global args ([#10106](https://github.com/storybookjs/storybook/pull/10106))"}} \ No newline at end of file diff --git a/examples/angular-cli/package.json b/examples/angular-cli/package.json index b93cd0ec82b2..afa33008db85 100644 --- a/examples/angular-cli/package.json +++ b/examples/angular-cli/package.json @@ -1,6 +1,6 @@ { "name": "angular-cli", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "private": true, "license": "MIT", "scripts": { @@ -37,20 +37,20 @@ "@angular/cli": "^8.3.6", "@angular/compiler-cli": "^8.2.8", "@compodoc/compodoc": "^1.1.11", - "@storybook/addon-a11y": "6.0.0-alpha.19", - "@storybook/addon-actions": "6.0.0-alpha.19", - "@storybook/addon-backgrounds": "6.0.0-alpha.19", - "@storybook/addon-centered": "6.0.0-alpha.19", - "@storybook/addon-docs": "6.0.0-alpha.19", - "@storybook/addon-jest": "6.0.0-alpha.19", - "@storybook/addon-knobs": "6.0.0-alpha.19", - "@storybook/addon-links": "6.0.0-alpha.19", - "@storybook/addon-options": "6.0.0-alpha.19", - "@storybook/addon-storyshots": "6.0.0-alpha.19", - "@storybook/addon-storysource": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/angular": "6.0.0-alpha.19", - "@storybook/source-loader": "6.0.0-alpha.19", + "@storybook/addon-a11y": "6.0.0-alpha.25", + "@storybook/addon-actions": "6.0.0-alpha.25", + "@storybook/addon-backgrounds": "6.0.0-alpha.25", + "@storybook/addon-centered": "6.0.0-alpha.25", + "@storybook/addon-docs": "6.0.0-alpha.25", + "@storybook/addon-jest": "6.0.0-alpha.25", + "@storybook/addon-knobs": "6.0.0-alpha.25", + "@storybook/addon-links": "6.0.0-alpha.25", + "@storybook/addon-options": "6.0.0-alpha.25", + "@storybook/addon-storyshots": "6.0.0-alpha.25", + "@storybook/addon-storysource": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/angular": "6.0.0-alpha.25", + "@storybook/source-loader": "6.0.0-alpha.25", "@types/core-js": "^2.5.0", "@types/jest": "^25.1.1", "@types/node": "^13.5.3", diff --git a/examples/cra-kitchen-sink/package.json b/examples/cra-kitchen-sink/package.json index 9016f0a10aa0..214eb82aea06 100644 --- a/examples/cra-kitchen-sink/package.json +++ b/examples/cra-kitchen-sink/package.json @@ -1,6 +1,6 @@ { "name": "cra-kitchen-sink", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "private": true, "scripts": { "build": "react-scripts build", @@ -18,21 +18,21 @@ "react-lifecycles-compat": "^3.0.4" }, "devDependencies": { - "@storybook/addon-a11y": "6.0.0-alpha.19", - "@storybook/addon-actions": "6.0.0-alpha.19", - "@storybook/addon-backgrounds": "6.0.0-alpha.19", - "@storybook/addon-centered": "6.0.0-alpha.19", - "@storybook/addon-docs": "6.0.0-alpha.19", - "@storybook/addon-events": "6.0.0-alpha.19", - "@storybook/addon-jest": "6.0.0-alpha.19", - "@storybook/addon-knobs": "6.0.0-alpha.19", - "@storybook/addon-links": "6.0.0-alpha.19", - "@storybook/addon-options": "6.0.0-alpha.19", - "@storybook/addon-storyshots": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/client-logger": "6.0.0-alpha.19", - "@storybook/react": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addon-a11y": "6.0.0-alpha.25", + "@storybook/addon-actions": "6.0.0-alpha.25", + "@storybook/addon-backgrounds": "6.0.0-alpha.25", + "@storybook/addon-centered": "6.0.0-alpha.25", + "@storybook/addon-docs": "6.0.0-alpha.25", + "@storybook/addon-events": "6.0.0-alpha.25", + "@storybook/addon-jest": "6.0.0-alpha.25", + "@storybook/addon-knobs": "6.0.0-alpha.25", + "@storybook/addon-links": "6.0.0-alpha.25", + "@storybook/addon-options": "6.0.0-alpha.25", + "@storybook/addon-storyshots": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/client-logger": "6.0.0-alpha.25", + "@storybook/react": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "react-scripts": "^3.0.1" } } diff --git a/examples/cra-react15/package.json b/examples/cra-react15/package.json index b0e6b33681c7..25320b7cc427 100644 --- a/examples/cra-react15/package.json +++ b/examples/cra-react15/package.json @@ -1,6 +1,6 @@ { "name": "cra-react15", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "private": true, "scripts": { "build": "react-scripts build", @@ -18,11 +18,11 @@ "react-scripts": "3.0.1" }, "devDependencies": { - "@storybook/addon-actions": "6.0.0-alpha.19", - "@storybook/addon-links": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", - "@storybook/react": "6.0.0-alpha.19", - "@storybook/theming": "6.0.0-alpha.19", + "@storybook/addon-actions": "6.0.0-alpha.25", + "@storybook/addon-links": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", + "@storybook/react": "6.0.0-alpha.25", + "@storybook/theming": "6.0.0-alpha.25", "babel-core": "6", "babel-runtime": "6" } diff --git a/examples/cra-ts-essentials/package.json b/examples/cra-ts-essentials/package.json index 5db60909bde3..beec8576cce1 100644 --- a/examples/cra-ts-essentials/package.json +++ b/examples/cra-ts-essentials/package.json @@ -1,6 +1,6 @@ { "name": "cra-ts-essentials", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "private": true, "scripts": { "build": "react-scripts build", @@ -36,9 +36,9 @@ "typescript": "3.7.5" }, "devDependencies": { - "@storybook/addon-essentials": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", + "@storybook/addon-essentials": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", "@storybook/preset-create-react-app": "^1.5.0", - "@storybook/react": "6.0.0-alpha.19" + "@storybook/react": "6.0.0-alpha.25" } } diff --git a/examples/cra-ts-kitchen-sink/package.json b/examples/cra-ts-kitchen-sink/package.json index e5bcdf6b7517..c15b3afc090a 100644 --- a/examples/cra-ts-kitchen-sink/package.json +++ b/examples/cra-ts-kitchen-sink/package.json @@ -1,6 +1,6 @@ { "name": "cra-ts-kitchen-sink", - "version": "6.0.0-alpha.19", + "version": "6.0.0-alpha.25", "private": true, "scripts": { "build": "react-scripts build", @@ -34,14 +34,14 @@ "typescript": "3.7.5" }, "devDependencies": { - "@storybook/addon-a11y": "6.0.0-alpha.19", - "@storybook/addon-actions": "6.0.0-alpha.19", - "@storybook/addon-knobs": "6.0.0-alpha.19", - "@storybook/addon-links": "6.0.0-alpha.19", - "@storybook/addon-options": "6.0.0-alpha.19", - "@storybook/addons": "6.0.0-alpha.19", + "@storybook/addon-a11y": "6.0.0-alpha.25", + "@storybook/addon-actions": "6.0.0-alpha.25", + "@storybook/addon-knobs": "6.0.0-alpha.25", + "@storybook/addon-links": "6.0.0-alpha.25", + "@storybook/addon-options": "6.0.0-alpha.25", + "@storybook/addons": "6.0.0-alpha.25", "@storybook/preset-create-react-app": "^1.5.0", - "@storybook/react": "6.0.0-alpha.19", + "@storybook/react": "6.0.0-alpha.25", "@types/enzyme": "^3.9.0", "@types/node": "13.5.3", "@types/react": "^16.8.14", diff --git a/examples/dev-kits/logo.svg b/examples/dev-kits/logo.svg index 9809fb9021a1..26fa14630673 100644 --- a/examples/dev-kits/logo.svg +++ b/examples/dev-kits/logo.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/examples/dev-kits/manager.js b/examples/dev-kits/manager.js index f105fc1d65ba..7254179364b3 100644 --- a/examples/dev-kits/manager.js +++ b/examples/dev-kits/manager.js @@ -1,8 +1,8 @@ -import React from 'react'; +import React, { useState } from 'react'; import { PropTypes } from 'prop-types'; import { Button } from '@storybook/react/demo'; import { addons } from '@storybook/addons'; -import { useAddonState, useStoryState } from '@storybook/api'; +import { useAddonState, useStoryState, useGlobalArgs } from '@storybook/api'; import { themes } from '@storybook/theming'; import { AddonPanel } from '@storybook/components'; @@ -13,6 +13,7 @@ addons.setConfig({ brandImage: logo, brandTitle: 'Custom - Storybook', ...themes.dark, + appContentBg: 'white', }, panelPosition: 'bottom', selectedPanel: 'storybook/roundtrip', @@ -58,3 +59,37 @@ addons.addPanel('useAddonState', { title: 'useAddonState', render: StatePanel, }); + +const GlobalArgsPanel = ({ active, key }) => { + const [globalArgs, updateGlobalArgs] = useGlobalArgs(); + const [globalArgsInput, updateGlobalArgsInput] = useState(JSON.stringify(globalArgs)); + return ( + +
+

Global Args

+ +
{ + e.preventDefault(); + updateGlobalArgs(JSON.parse(globalArgsInput)); + }} + > +