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

[db] Load seed files with vite dev server #10941

Merged
merged 2 commits into from
May 3, 2024

Conversation

bholmesdev
Copy link
Contributor

Changes

Branched from db seeding refactor: #10919

Adds back vite dev server loading for db seed files.

  • Reuse existing dev server during development
  • Create a temporary vite server during production builds. This mirrors how the Astro content collection config is loaded
  • Prevent infinite seeding loops by tracking whether seeding is in-progress.

Testing

Ensure existing tests pass.

Docs

N/A

Copy link

changeset-bot bot commented May 2, 2024

⚠️ No Changeset found

Latest commit: bb0031b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@bholmesdev bholmesdev force-pushed the feat/load-db-seed-with-vite-server branch from 56f7e00 to bb0031b Compare May 2, 2024 22:34
Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

You've now been responsible for the addition of 2 additional Vite servers in Astro. This is okay - however, we would like to warn you that your current subscription only allows for 3 additional Vite servers, and you may want to upgrade to continue in the future.

@bholmesdev bholmesdev merged commit 3b014fd into refactor/db-seed May 3, 2024
13 checks passed
@bholmesdev bholmesdev deleted the feat/load-db-seed-with-vite-server branch May 3, 2024 14:59
bholmesdev added a commit that referenced this pull request May 3, 2024
* fix: move recreateTables() to integration hooks

* feat: recreate and seed at load, not in virtual runtime

* feat: eager build db on startup and seed file change

* fix: respect database_file in dbUrl

* chore: remove duplicate recreateTables call

* chore: remove now self-explanatory comments

* fix: remove invalidateModule call for eager loading

* feat: respect seed package paths

* fix: remove duplicate recreateTables() call

* refactor: move recreateTables() to vite-plugin-db

* refactor: move queries.ts from runtime/ to core/

* fix: update test import to core/queries

* refactor: move executeSeedFile to vite-plugin-db

* refactor: extract seeding and recreating to helper fns

* chore: changeset

* chore: revert connectToStudio refactor

* wip: log db url

* fix(test): normalize astro_database_file flag for windows

* Revert "wip: log db url"

This reverts commit 558e2de.

* Revert "Revert "wip: log db url""

This reverts commit ffd004e.

* fix: correctly resolve relative paths with unit test

* chore: remove unused dbDirPath

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* chore: remove unused import

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* chore: remove unused type

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* fix: remove bad import

* [db] Load seed files with vite dev server (#10941)

* feat: load seed files with full vite dev server

* chore: remove unused export

---------

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
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.

3 participants