railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

core/providers/node/astro.go

core/providers/node/astro.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package node import (	"regexp"	"strings" 	"github.com/railwayapp/railpack/core/generate") const (	DefaultAstroOutputDirectory = "dist") func (p *NodeProvider) isAstroPackage(pkg *WorkspacePackage, ctx *generate.GenerateContext) bool {	astroConfigMjs := "astro.config.mjs"	astroConfigTs := "astro.config.ts"	if pkg.Path != "" {		astroConfigMjs = pkg.Path + "/astro.config.mjs"		astroConfigTs = pkg.Path + "/astro.config.ts"	} 	hasAstroConfig := ctx.App.HasFile(astroConfigMjs) || ctx.App.HasFile(astroConfigTs)	hasAstroBuildCommand := strings.Contains(strings.ToLower(pkg.PackageJson.GetScript("build")), "astro build") 	return hasAstroConfig && hasAstroBuildCommand} func (p *NodeProvider) isAstro(ctx *generate.GenerateContext) bool {	return p.isAstroPackage(p.workspace.Root, ctx)} func (p *NodeProvider) isAstroSPA(ctx *generate.GenerateContext) bool {	if !p.isAstro(ctx) {		return false	} 	configFileContents := p.getAstroConfigFileContents(ctx)	hasServerOutput := strings.Contains(configFileContents, "output: 'server'")	hasAdapter := p.hasDependency("@astrojs/node") || p.hasDependency("@astrojs/vercel") || p.hasDependency("@astrojs/cloudflare") || p.hasDependency("@astrojs/netlify") 	return !hasServerOutput && !hasAdapter} func (p *NodeProvider) getAstroOutputDirectory(ctx *generate.GenerateContext) string {	configFileContents := p.getAstroConfigFileContents(ctx)	if configFileContents != "" {		// Look for outDir in config		outDirRegex := regexp.MustCompile(`outDir:\s*['"](.+?)['"]`)		matches := outDirRegex.FindStringSubmatch(configFileContents)		if len(matches) > 1 {			return matches[1]		}	} 	return DefaultAstroOutputDirectory} func (p *NodeProvider) getAstroConfigFileContents(ctx *generate.GenerateContext) string {	_, contents, _ := ctx.App.ReadFirstFileOf("astro.config.mjs", "astro.config.ts")	return contents} // TODO feels like we should be able to specify this in the start command and avoid injecting additional vars into the container?func (p *NodeProvider) getAstroEnvVars() map[string]string {	envVars := map[string]string{		"HOST": "0.0.0.0",	} 	return envVars}