shuttle-hq / shuttle

Build & ship backends without writing any infrastructure files.
https://shuttle.rs
Apache License 2.0
6.07k stars 251 forks source link

[Feature]: Support node during build step for building static frontends #1678

Open versecafe opened 7 months ago

versecafe commented 7 months ago

Describe the feature

Support Node 18 & 20 lts for building static HTML/CSS/JS which is served by a rust process, example being Astrox where node is needed in the build step with Astro to produce static files which are then served by an axum backend which also provides the backend API. This would be extremely useful as Node based tooling still makes up the bulk of modern UI development and with static site generators like astro becoming more and more popular this could allow shuttle to fit the niche in web hosting that currently Vercel & Netlify completely miss

Suggestion or Example of how the feature would be used

shuttle.toml supporting some additional build steps that may call on in this case node to build out static files which are then served by a rust binary, example project given above

Duplicate declaration

jonaro00 commented 7 months ago

Great suggestion! We will try supporting it in the new builder #1547

versecafe commented 7 months ago

@jonaro00 Since the build containers are linux based maybe integrating just some wrapping over nvm and default enabling corepack to allow simple tooling like below

[tools]
node = { version = "20.11.1", script = "npm install && npm run build" }
node = { version = "20", flags = ["lts", "corepack"], script = "pnpm i && pnpm build" }

or automatically check for build script and automatically install deps based off given lock file and default to npm like vercel does

jonaro00 commented 4 days ago

@versecafe Installing and running node should now be possible with hook scripts on shuttle.dev: https://docs.shuttle.dev/docs/builds#experimental-hook-scripts Would you like to give it a try?