Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

refactor(svelte): Improve integration with sg#64333

Merged
fkling merged 4 commits into
mainfrom
fkling/sk/improve-sg-start-integration
Aug 8, 2024
Merged

refactor(svelte): Improve integration with sg#64333
fkling merged 4 commits into
mainfrom
fkling/sk/improve-sg-start-integration

Conversation

@fkling

@fkling fkling commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

There currently isn't a 'one step' way to start a local Sourcegraph instance with the SvelteKit app.

This commit adds sg start enterprise-sveltekit to fix that.

The changes in https://github.com/sourcegraph/sourcegraph/pull/64272 allow us to run the vite dev server in front of the Sourcegraph instance, instead of building the assets and having them served by frontend.
This gives us the benefit of hot module reloading and in general seems to be a less fragile approach.

It's basically the same what we do with the React app in development mode.

Test plan

sg start enterprise-sveltekit starts the vite dev server as well as the sourcegraph instance. Navigating to https://sourcegraph.test:3443/search opens the Svelte app (when enabled and logged in). Making a change in a source file updates the web page immediately.

sg start web-sveltekit-standalone still works

There couldn't isn't a 'one step' way to start a local Sourcegraph
instance with the SvelteKit app.

This commit adds `sg start enterprise-sveltekit` to fix that.

The changes in https://github.com/sourcegraph/sourcegraph/pull/64272
allow us to run the vite dev server in front of the Sourcegraph
instance, instead of building the assets and having them served by
frontend.
This gives us the benefit of hot module reloading and in general seems
to be a less fragile approach.

It's basically the same what we do with the React app in development
mode.
@fkling fkling requested a review from camdencheek August 7, 2024 12:47
@cla-bot cla-bot Bot added the cla-signed label Aug 7, 2024
@fkling fkling self-assigned this Aug 7, 2024
Comment thread sg.config.yaml Outdated
Comment on lines 567 to 573

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is necessary or was used a lot.

@fkling fkling force-pushed the fkling/sk/improve-sg-start-integration branch from 2254401 to b5eda5e Compare August 7, 2024 13:18
Comment thread sg.config.yaml
Comment on lines +1535 to +1565
enterprise-sveltekit:
checks:
- docker
- redis
- postgres
- git
- dev-private
commands:
- frontend
- worker
- repo-updater
- web
- web-sveltekit
- gitserver-0
- gitserver-1
- searcher
- caddy
- symbols
- syntax-highlighter
- zoekt-index-0
- zoekt-index-1
- zoekt-web-0
- zoekt-web-1
- blobstore
- embeddings
env:
DISABLE_CODE_INSIGHTS_HISTORICAL: false
DISABLE_CODE_INSIGHTS: false
CADDY_FILE: dev/Caddyfile-sveltekit
# Proxy to the local server
SOURCEGRAPH_API_URL: http://localhost:3080

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wish there was a better way to just add one command to the existing command set :-/

@camdencheek camdencheek left a comment

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.

This looks great -- thank you!

I would really love it if we could get sg start to "just work" as well (including both react and svelte versions of the webapp). Even if HMR doesn't work, it would be nice to have that better represent a real instance.

@fkling

fkling commented Aug 7, 2024

Copy link
Copy Markdown
Contributor Author

I would really love it if we could get sg start to "just work" as well (including both react and svelte versions of the webapp).

Yeah. We could certainly just run pnpm build --watch. At the same time rebuilding seems to be very slow (in general the build is quite slow) so developing the SvelteKit app with it is not going to be pleasant.

@fkling fkling merged commit 1c72982 into main Aug 8, 2024
@fkling fkling deleted the fkling/sk/improve-sg-start-integration branch August 8, 2024 09:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants