project

package
v0.3.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package project owns trbconfig.jsonc discovery, validation, and persistence.

Index

Constants

View Source
const (
	ManagedPackages  = "managed"
	ExternalPackages = "external"

	TypeScriptRuntimeBrowser = "browser"
	TypeScriptRuntimeBun     = "bun"
	TypeScriptRuntimeNode    = "node"
)
View Source
const ConfigName = "trbconfig.jsonc"
View Source
const DefaultGoVersion = "1.27"

DefaultGoVersion is the current Go toolchain supported by TypeRB.

View Source
const DefaultRubyVersion = "4.0.6"

DefaultRubyVersion is the current Ruby toolchain supported by TypeRB.

View Source
const DefaultSqldefVersion = "3.11.19"
View Source
const DefaultTypeScriptRuntime = TypeScriptRuntimeNode

DefaultTypeScriptRuntime preserves the runtime used by TypeScript projects created before runtime selection became explicit.

View Source
const DefaultTypeScriptVersion = "^6.0.0"

DefaultTypeScriptVersion follows the latest compatible TypeScript 6 patch.

Variables

View Source
var ErrConfigNotFound = errors.New(ConfigName + " not found")

ErrConfigNotFound reports that discovery reached the filesystem root.

Functions

This section is empty.

Types

type Config

type Config struct {
	Schema            string                        `json:"$schema,omitempty"`
	Name              string                        `json:"name"`
	Version           string                        `json:"version,omitempty"`
	Mode              string                        `json:"mode"`
	SourceDir         string                        `json:"sourceDir,omitempty"`
	OutDir            string                        `json:"outDir,omitempty"`
	CopyFiles         *bool                         `json:"copyFiles,omitempty"`
	PackageManagement string                        `json:"packageManagement,omitempty"`
	Packages          map[string]PackageRequirement `json:"packages,omitempty"`
	Dependencies      map[string]string             `json:"dependencies,omitempty"`
	DevDependencies   map[string]string             `json:"devDependencies,omitempty"`
	LocalPackages     map[string]string             `json:"localPackages,omitempty"`
	PackageOptions    map[string]json.RawMessage    `json:"packageOptions,omitempty"`
	Ruby              *RubyConfig                   `json:"ruby,omitempty"`
	Go                *GoConfig                     `json:"go,omitempty"`
	TypeScript        *TypeScriptConfig             `json:"typescript,omitempty"`
	Database          *DatabaseConfig               `json:"db,omitempty"`
	Jobs              *JobsConfig                   `json:"jobs,omitempty"`
	Root              string                        `json:"-"`
	Path              string                        `json:"-"`
}

func Find

func Find(start string) (*Config, error)

func Load

func Load(path string) (*Config, error)

func New

func New(root, mode string) *Config

func (*Config) ManagesPackages

func (c *Config) ManagesPackages() bool

func (*Config) OutputPath

func (c *Config) OutputPath() string

func (*Config) Save

func (c *Config) Save() error

func (*Config) ShouldCopyFiles

func (c *Config) ShouldCopyFiles() bool

func (*Config) SourcePath

func (c *Config) SourcePath() string

func (*Config) Validate

func (c *Config) Validate() error

type DBSqldefConfig added in v0.2.1

type DBSqldefConfig struct {
	Command   string   `json:"command,omitempty"`
	Version   string   `json:"version,omitempty"`
	Arguments []string `json:"arguments,omitempty"`
}

type DatabaseConfig added in v0.2.1

type DatabaseConfig struct {
	Adapter  string          `json:"adapter"`
	Database *DatabaseSource `json:"database,omitempty"`
	Schema   string          `json:"schema,omitempty"`
	Lock     string          `json:"lock,omitempty"`
	Sqldef   *DBSqldefConfig `json:"sqldef,omitempty"`
}

type DatabaseSource added in v0.2.1

type DatabaseSource struct {
	Value       string
	Environment string
}

func (DatabaseSource) MarshalJSON added in v0.2.1

func (s DatabaseSource) MarshalJSON() ([]byte, error)

func (DatabaseSource) Resolve added in v0.2.1

func (s DatabaseSource) Resolve(root, adapter string) (string, error)

func (*DatabaseSource) UnmarshalJSON added in v0.2.1

func (s *DatabaseSource) UnmarshalJSON(data []byte) error

type GoConfig

type GoConfig struct {
	Module               string            `json:"module,omitempty"`
	Version              string            `json:"version,omitempty"`
	RootPackage          string            `json:"rootPackage,omitempty"`
	IndirectDependencies map[string]string `json:"indirectDependencies,omitempty"`
	Sqldef               *SqldefConfig     `json:"sqldef,omitempty"`
}

type JobsConfig added in v0.2.3

type JobsConfig struct {
	Configuration string `json:"configuration"`
}

type PackageRequirement added in v0.2.3

type PackageRequirement struct {
	Source  string `json:"source,omitempty"`
	Version string `json:"version,omitempty"`
	Path    string `json:"path,omitempty"`
}

PackageRequirement identifies one TypeRB package. A package name is an import alias in the current dependency graph; Source selects an explicit Git origin and Path selects an explicitly local development package.

func (PackageRequirement) MarshalJSON added in v0.2.3

func (r PackageRequirement) MarshalJSON() ([]byte, error)

func (*PackageRequirement) UnmarshalJSON added in v0.2.3

func (r *PackageRequirement) UnmarshalJSON(data []byte) error

type RubyConfig

type RubyConfig struct {
	Source  string `json:"source,omitempty"`
	Version string `json:"version,omitempty"`
	Loader  string `json:"loader,omitempty"`
}

type SqldefConfig

type SqldefConfig struct {
	Command   string   `json:"command"`
	Arguments []string `json:"arguments,omitempty"`
	Database  string   `json:"database"`
	Schema    string   `json:"schema"`
}

type TypeScriptConfig

type TypeScriptConfig struct {
	PackageManager string            `json:"packageManager,omitempty"`
	ModuleType     string            `json:"moduleType,omitempty"`
	Runtime        string            `json:"runtime,omitempty"`
	Scripts        map[string]string `json:"scripts,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL