mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
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]>
41 lines
1.2 KiB
Go
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")
|
|
}
|