Skip to content

feat: configure preview and simulator URL on init#183

Merged
lihbr merged 4 commits into
mainfrom
feat/init-preview-and-simulator
May 13, 2026
Merged

feat: configure preview and simulator URL on init#183
lihbr merged 4 commits into
mainfrom
feat/init-preview-and-simulator

Conversation

@angeloashmore
Copy link
Copy Markdown
Member

@angeloashmore angeloashmore commented May 11, 2026

Resolves:

Description

When initializing a Prismic project, set a default slice simulator URL and a "Development" preview entry pointing at localhost, but only if the repository doesn't already have them configured. This applies to the Next.js, Nuxt, and SvelteKit adapters.

Without this change, developers need to manually configure previews in the repository. We already generate the necessary preview files in the project.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Note

Medium Risk
Adds automatic repository configuration (simulator URL and preview configs) during init, which introduces new network-side effects and could fail due to auth/permissions or overwrite expectations if the presence checks are wrong.

Overview
Configures Prismic repository settings during init for next, nuxt, and sveltekit: on onProjectInitialized, it now sets a default Slice Simulator URL and creates a "Development" preview pointing at localhost only if the repository has no existing simulator URL or preview configs.

Normalizes --repo/legacy repository names to lowercase in init, and extends integration tests to assert simulator/preview configuration is created for new repos and preserved for repos with pre-existing preview/simulator settings (including adding a test-only setSimulatorUrl helper).

Reviewed by Cursor Bugbot for commit c9d8479. Bugbot is set up for automated code reviews on this repo. Configure here.

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/adapters/nextjs.ts
Copy link
Copy Markdown

@xrutayisire xrutayisire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread src/adapters/sveltekit.ts

const simulatorUrl = await getSimulatorUrl({ repo, token, host });
if (!simulatorUrl) {
await setSimulatorUrl("http://localhost:5173/slice-simulator", { repo, token, host });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 I always wondered why we don’t also use localhost:3000 for SvelteKit. I know 5173 is the default from Vite, but having 3000 everywhere could make things simpler and more consistent I guess.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5173 is 1337 for SITE 🤓

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also VITE since 5 is V in Roman numerals!

@xrutayisire: I always wondered why we don’t also use localhost:3000 for SvelteKit. I know 5173 is the default from Vite, but having 3000 everywhere could make things simpler and more consistent I guess.

It's better to follow each framework's conventions, in my opinion, rather than force our conventions. Developers will be less surprised and will have less to learn if we follow what they expect.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cf8c5b0. Configure here.

Comment thread test/init.test.ts
@lihbr lihbr merged commit 2979d6b into main May 13, 2026
40 of 42 checks passed
@lihbr lihbr deleted the feat/init-preview-and-simulator branch May 13, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants