Skip to content

Chromatic + TurboSnap cannot find the base directory #971

@TheGreatLebowski

Description

@TheGreatLebowski

Hello,

I'm actually working on a monorepo with this structure :

monorepo
-- storybook
-- nextjs
-- components

In my storybook package.json I use theses scripts :

    "build-storybook": "storybook build",
    "chromatic": "chromatic --project-token=$CHROMATIC_TOKEN --exit-zero-on-changes --only-changed"

I also have a chromatic.config.json file :

{
  "buildScriptName": "build-storybook",
  "debug": true,
  "projectId": "Project:64ff2159f709623d8074467d",
  "zip": true,
  "storybookBaseDir": "tools/storybook"
}

Sometimes it works, sometimes not.

I tried to change the chromatic script adding --storybook-base-dir=./monorepo/storybook (Even if it's defined in my chromatic config file)

Here the error I am facing :

  ✖ Retrieving story files affected by recent changes
    → Run @chromatic-com/turbosnap-helper to get your base directory value.

14:14:24.136  git info: {"commit":{"commit":"d4cd24ae78e116010a94f123fab5935726767769","committedAt":1714399527000,"committerEmail":"MAIL","committerName":"PSEUDO"},"branch":"feat/run-ci-only-on-master","fromCI":false}

14:14:25.926  App firstBuild: %o, lastBuild: %o {"committedAt":1695026683000} {"commit":"fbf499c79fd44afd54edb96b58e2915f7a0c1cf5","committedAt":1714146792000}

14:14:25.941  Adding last branch build commit fbf499c79fd44afd54edb96b58e2915f7a0c1cf5 to commits with builds

14:14:25.941  step: checking 20 up to 1695026683

14:14:25.941  step: commitsWithBuilds: fbf499c79fd44afd54edb96b58e2915f7a0c1cf5

14:14:25.941  step: commitsWithoutBuilds: 

14:14:25.941  running git rev-list HEAD       --since 1695026683       -n 20 --not fbf499c79fd44afd54edb96b58e2915f7a0c1cf5

14:14:25.953  command output: d4cd24ae78e116010a94f123fab5935726767769

14:14:25.953  step: candidateCommits: d4cd24ae78e116010a94f123fab5935726767769, visitedCommitsWithoutBuilds: d4cd24ae78e116010a94f123fab5935726767769

14:14:26.383  step: newCommitsWithBuilds: d4cd24ae78e116010a94f123fab5935726767769

14:14:26.383  step: checking 40 up to 1695026683

14:14:26.383  step: commitsWithBuilds: fbf499c79fd44afd54edb96b58e2915f7a0c1cf5,d4cd24ae78e116010a94f123fab5935726767769

14:14:26.383  step: commitsWithoutBuilds: 

14:14:26.383  running git rev-list HEAD       --since 1695026683       -n 40 --not fbf499c79fd44afd54edb96b58e2915f7a0c1cf5 d4cd24ae78e116010a94f123fab5935726767769

14:14:26.405  command output: 

14:14:26.405  step: candidateCommits: , visitedCommitsWithoutBuilds: 

14:14:26.405  step: no candidateCommits; we are done

14:14:26.835  Final commitsWithBuilds: fbf499c79fd44afd54edb96b58e2915f7a0c1cf5,d4cd24ae78e116010a94f123fab5935726767769

14:14:26.835  running git rev-list fbf499c79fd44afd54edb96b58e2915f7a0c1cf5 d4cd24ae78e116010a94f123fab5935726767769 --not "fbf499c79fd44afd54edb96b58e2915f7a0c1cf5^@" "d4cd24ae78e116010a94f123fab5935726767769^@"

14:14:26.858  command output: d4cd24ae78e116010a94f123fab5935726767769,fbf499c79fd44afd54edb96b58e2915f7a0c1cf5

14:14:26.858  Found parentCommits: d4cd24ae78e116010a94f123fab5935726767769, fbf499c79fd44afd54edb96b58e2915f7a0c1cf5

14:14:28.988  Found baselineCommits: fbf499c79fd44afd54edb96b58e2915f7a0c1cf5, 07fc101e26ae35a4bacbb2bddc244183f9a048cd

14:14:29.059  [{"status":"rejected","reason":{}},{"status":"fulfilled","value":{}},{"status":"fulfilled","value":{"viewLayer":"react","version":"8.0.9"}},{"status":"rejected","reason":{}}]

14:14:29.060  Got environment:
              {}

14:14:30.048  Running build command: pnpm run build-storybook --output-dir /var/folders/y8/qj0m21010mnd4gtttj9jw_lm0000gn/T/chromatic--21649-BvEFA1s4GauC --webpack-stats-json /var/folders/y8/qj0m21010mnd4gtttj9jw_lm0000gn/T/chromatic--21649-BvEFA1s4GauC

14:14:30.048  Runtime metadata: {
                "nodePlatform": "darwin",
                "nodeVersion": "20.12.2",
                "packageManager": "pnpm",
                "packageManagerVersion": "8.8.0"
              }

14:14:40.361  Storybook base directory: ./tools/storybook

14:14:40.364  Not found: tools/storybook/storybook-stories.js

(I have the Not found error a with a lot of files, deleted them for readability)

14:14:40.365  ✖ TurboSnap disabled until base directory is set correctly
              The base directory allows TurboSnap to trace files.
              Set the --storybook-base-dir option as the relative path from the repository root to the Storybook project root.
              Run @chromatic-com/turbosnap-helper to get your base directory value.
14:14:40.378  ℹ Wrote Chromatic diagnostics report to chromatic-diagnostics.json

The error always seems to be from the base directory, but I tried different ways to defined it, I still have this error, any ideas ? 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugClassification: Something isn't workingneeds triageTracking: Issue needs confirmation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions