Files
pack/core/providers/node/svelte.go
T
zeekayandHanzo Dev 5a8a970b16 chore(pack): drop Railway branding from our own docs, comments, and examples
Rewrites our own comments, help text, and example READMEs that named
Railway or linked railway.app so they describe what they do instead.
Retargets the changelog generator and RELEASE.md's Actions/release
links at this repo. Leaves upstream issue links, the MIT copyright,
and the builder/runtime/frontend image references untouched -- those
still point at ghcr.io/railwayapp because we don't publish our own
copies of those images yet.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-04 02:05:25 -07:00

41 lines
1.2 KiB
Go

package node
import "github.com/hanzoai/pack/core/generate"
const DefaultSvelteKitStartCommand = "node build"
func (p *NodeProvider) configureSvelteKit(ctx *generate.GenerateContext, build *generate.CommandStepBuilder) {
if !p.isSvelteKit() || !p.usesSvelteKitAdapterAuto() {
return
}
// Causes @sveltejs/adapter-auto to select adapter-node, so the build emits a Node server.
// Oddly, GCP_BUILDPACKS is the only env var adapter-auto recognizes for Node; there is no generic PaaS signal.
ctx.Logger.LogInfo("SvelteKit with adapter-auto detected, forcing adapter-node")
build.AddVariables(map[string]string{"GCP_BUILDPACKS": "true"})
}
func (p *NodeProvider) getSvelteKitStartCommand() string {
if !p.isSvelteKit() || !p.usesSvelteKitAdapterAuto() {
return ""
}
return DefaultSvelteKitStartCommand
}
func (p *NodeProvider) isSvelteKit() bool {
return p.isSvelteKitPackage(p.workspace.Root)
}
func (p *NodeProvider) isSvelteKitPackage(pkg *WorkspacePackage) bool {
if pkg == nil || pkg.PackageJson == nil {
return false
}
return pkg.PackageJson.hasDependency("svelte") && pkg.PackageJson.hasDependency("@sveltejs/kit")
}
func (p *NodeProvider) usesSvelteKitAdapterAuto() bool {
return p.hasDependency("@sveltejs/adapter-auto")
}