Repository navigation
Improve Astro detection and add --caddy option - #171
Open
kylemclaren wants to merge 2 commits into
Open
kylemclaren wants to merge 2 commits into
kylemclaren wants to merge 2 commits into
Conversation
- Detect astro and @astrojs/node in devDependencies. - Read outDir and base from astro.config. - Serve the site's 404 page and use relative redirects for static sites. - Run the start script for the node adapter in middleware mode. - Keep devDependencies for SSR when astro or the adapter is one. - Add --caddy to serve static Vite and Astro sites with Caddy.
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.
Changes
Astro detection
astroindevDependenciestoo. Before, an app withastroonly indevDependencieswas a generic Node.js app, and the container rannode index.js.@astrojs/nodeindevDependenciestoo. Before, such an app was a static site, and nginx showed its default page.astroor@astrojs/nodeis indevDependenciesof an SSR app, do not prune development dependencies. The server imports the adapter and its dependencies (for exampleserver-destroy) at runtime.middlewaremode, the build output is a handler for a custom server, not a server. The app is now not treated as SSR, so the container runs thestartscript. Before, the container rannode ./dist/server/entry.mjs, which exited at once.outDirfromastro.config.*. Before, a customoutDircaused the image build to fail, because/app/distdid not exist.basefromastro.config.*for static sites. The files are copied below the base path, so/docs/serves the site. Before, all pages returned 404.Static Astro sites with nginx
absolute_redirect off. Before,/aboutredirected tohttp://<host>/about/, which drops HTTPS and the port.error_page 404 /404.html, so the site's own 404 page is served (for example Starlight's). Before, nginx showed its default 404 page.--caddyoption--caddyoption: serve static Vite and Astro sites withcaddy:2-alpineinstead of nginx. nginx stays the default.--nginx-rootdoes not change.Tests
devDependencies, middleware mode,outDirandbase, and--caddy.astro-config(outDir,base,astroindevDependencies),astro-middleware,astro-caddyandvite-caddy.astro-staticfixture updated for the nginx config.These apps from
create-astrobuild and start in Docker, and their pages, redirects and 404 pages give the expected responses:minimal,basics,blogandstarlighttemplates, with npm.minimalalso with pnpm.--caddy.outDir, withbase(nginx and--caddy), and withastroindevDependencies.output: 'server', with the default output and an on-demand page, with@astrojs/nodeindevDependencies, and inmiddlewaremode with a custom server.