Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CodeSandbox examples #9286

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kennedybaird
Copy link
Contributor

@kennedybaird kennedybaird commented Aug 13, 2024

Using examples/usecase-todo to change the examples approach to solve for codesandbox issues.

  1. Moving to devcontainers as codesandbox is stopping supporting sandbox.config.json
  2. Hardcoding seed data in the example, whilst keeping the seed-data command
  3. Setting prisma to inherit versions
  4. Removing postinstall to avoid possible conflicts with prisma minor patch changes to their generator

To solve for the examples snapshot tests:

  • leaving the schema's in the example's folder
  • adding a new test:monorepo-snapshot-test command to replace postinstall
  • added a new test:examples-snapshot-tests to root package.json which targets the above command recursively in all examples folders
  • added a new examples_snapshot_tests test to ci to run the above command once

This is going to significantly reduce the time for actions as each of the smoke tests currently runs the postinstall for all the examples each time (~5m).

This approach also allows us to handle framework-nextjs-two-servers as well.

Copy link

codesandbox-ci bot commented Aug 13, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b23b849:

Sandbox Source
@keystone-6/sandbox Configuration

@dcousens
Copy link
Member

dcousens commented Aug 13, 2024

Seed data - I think it's best if we just stop ignoring the example.db files

Honestly, I think this is a good approach. We do this already, and it's solid.

The primary downside I can see is the lack of human readability for the binary file on GitHub. We otherwise have the examples/script example to showcase data seeding.

@dcousens
Copy link
Member

dcousens commented Aug 13, 2024

Maybe we can build the keystone.db files deterministically from our root scripts/ folder?

@kennedybaird
Copy link
Contributor Author

Seed data - I think it's best if we just stop ignoring the example.db files

Honestly, I think this is a good approach. We do this already, and it's solid.

The primary downside I can see is the lack of human readability for the binary file on GitHub. We otherwise have the examples/script example to showcase data seeding.

The intention was to still have the needed seed-data files, but have the database seeded for the first run

@kennedybaird

This comment was marked as outdated.

@kennedybaird

This comment was marked as resolved.

@kennedybaird
Copy link
Contributor Author

@dcousens - I think I've found a reasonable solution, have updated the PR.

@dcousens dcousens marked this pull request as ready for review August 20, 2024 05:48
@dcousens dcousens changed the title Examples - in-lining data, fixing codesandbox Fix CodeSandbox examples Oct 15, 2024
@dcousens dcousens marked this pull request as draft October 17, 2024 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants