fix: create new slices in the first configured library#199
Merged
Conversation
When prismic.config.json defines slice libraries, pull and slice create were writing new slices to the framework default path instead of the first listed library, causing them to be missed on subsequent push/pull cycles. Co-authored-by: Cursor <cursoragent@cursor.com>
angeloashmore
approved these changes
Jun 23, 2026
angeloashmore
left a comment
Member
There was a problem hiding this comment.
I agree, it looks good. I made a few refactors for the sake of code cleanliness, but the functionality remains the same: #200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prismic.config.jsonwhen creating slices viapull,sync, andslice createTest plan
npm test -- test/pull.test.ts test/slice-create.test.tswith E2E credentialslibraries: ["./slices/blog"]in a project, create a slice in Type Builder, runprismic pull, and confirm the slice lands under./slices/blog/prismic pushand confirm the slice is recognizedNote
Low Risk
Behavior change is limited to slice creation target paths; existing multi-library read paths were already in place, with new tests covering the configured-library case.
Overview
New slices from
pull,sync, andslice createare written to the first path inprismic.config.jsonlibraries, instead of always using the framework default (e.g../slices/).Adapter.createSlicenow defaultslibraryto(await getSliceLibraries())[0], which already resolves configured libraries or falls back to the default when none are set.Test helpers and
toContainSlicewere updated to scan all configured libraries (viagetSliceLibraries/ glob), and integration tests assert slices land under the first library (e.g../slices/blog) and not the root./slices/path.Reviewed by Cursor Bugbot for commit 20bbcef. Bugbot is set up for automated code reviews on this repo. Configure here.