chromatic-cli icon indicating copy to clipboard operation
chromatic-cli copied to clipboard

TurboSnap not bailed if package manifest change isn't dependency-related

Open skitterm opened this issue 3 years ago • 1 comments

TurboSnap doesn't bail if a package.json changes non-dependency fields (like scripts, version, license, etc). It still bails if a dependency field changes.

Currently I'm only looking for dependencies, devDependencies, and peerDependencies. Technically there are many more dependency-related fields that I could add to the list. Happy to loop back and add them in if we want to cover our bases.

Also changes wording for the package-json-related dependency changes ( Found a package file change in package.json -> Found a dependency change in package.json)

skitterm avatar Oct 06 '22 00:10 skitterm

FYI the unit tests are failing:

bin-src/lib/getDependentStoryFiles.test.ts (9.802 s)
  ● getDependentStoryFiles › detects direct changes to CSF files

    TypeError: Cannot read properties of undefined (reading 'changedPackageManifests')

      189 |     // If package.json dependencies changed, we still want to use the same TurboSnap bail reason
      190 |     // for now.
    > 191 |   } else if (ctx.git.changedPackageManifests?.length) {
          |                      ^
      192 |     ctx.turboSnap.bailReason = { changedPackageFiles: ctx.git.changedPackageManifests };
      193 |   }
      194 |

      at getDependentStoryFiles (bin-src/lib/getDependentStoryFiles.ts:191:22)
      at Object.<anonymous> (bin-src/lib/getDependentStoryFiles.test.ts:51:17)

yannbf avatar Oct 13 '22 08:10 yannbf