chromatic-cli
chromatic-cli copied to clipboard
TurboSnap not bailed if package manifest change isn't dependency-related
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)
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)