config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Package config ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Version  string      `mapstructure:"version"`
	Resource APIResource `mapstructure:"resource"`
	Metadata APIMetadata `mapstructure:"metadata"`
}

API represents the API folder structure in a Sveltin project.

type APIMetadata

type APIMetadata struct {
	Filename string `mapstructure:"filename"`
	Public   string `mapstructure:"public"`
}

APIMetadata represents the folder name and its file for a metadata API in a sveltin project.

type APIResource

type APIResource struct {
	Filename string `mapstructure:"filename"`
	Public   string `mapstructure:"public"`
}

APIResource represents the folder name and its file for a resource API in a sveltin project.

type AppTemplate

type AppTemplate struct {
	Name string
	URL  string
}

AppTemplate is the stuct presenting the github repository used by sveltin to clone the starter project repos.

type IConfig

type IConfig interface {
	GetProjectRoot() string
	GetBuildPath() string
	GetConfigPath() string
	GetContentPath() string
	GetStaticPath() string
	GetSrcPath() string
	GetAPIPath() string
	GetAPIVersion() string
	GetAPIFilename() string
	GetPublicAPIFilename() string
	GetLibPath() string
	GetRoutesPath() string
	GetThemesPath() string
	GetThemeConfigFilename() string
	GetThemeComponentsPath() string
	GetThemePartialsPath() string
	GetIndexPageFilename() string
	GetSlugPageFilename() string
	GetContentPageFilename() string
}

IConfig is the interface defining the methods to be implemented.

type MenuConfig struct {
	Resources   []*ResourceItem
	Pages       []string
	WithContent bool
}

MenuConfig is the struct representing a menu item.

type NoPage

type NoPage struct {
	Config *ProjectConfig
	Items  *NoPageItems
}

NoPage is the struct representing a no-public page (sitemap and rss) for a sveltin project.

type NoPageItems

type NoPageItems struct {
	Resources []string
	Content   map[string][]string
	Metadata  map[string][]string
	Pages     []string
}

NoPageItems is the struct representing an item of no-public page (sitemap and rss) for a sveltin project.

type Pages

type Pages struct {
	Content string `mapstructure:"content"`
	Index   string `mapstructure:"index"`
	Slug    string `mapstructure:"slug"`
}

Pages is the struct representing a public page and its content for a sveltin project.

type Paths

type Paths struct {
	Build   string `mapstructure:"build"`
	Config  string `mapstructure:"config"`
	Content string `mapstructure:"content"`
	Static  string `mapstructure:"static"`
	Src     string `mapstructure:"src"`
	Routes  string `mapstructure:"routes"`
	Lib     string `mapstructure:"lib"`
	API     string `mapstructure:"api"`
	Themes  string `mapstructure:"themes"`
}

Paths is the struct mapping the folders structure for a sveltin project.

type ProjectConfig added in v0.4.0

type ProjectConfig struct {
	BaseURL              string `mapstructure:"VITE_PUBLIC_BASE_PATH"`
	SitemapChangeFreq    string `mapstructure:"sitemapChangeFreq"`
	SitemapPriority      string `mapstructure:"sitemapPriority"`
	SvelteKitBuildFolder string `mapstructure:"SVELTEKIT_BUILD_FOLDER"`
	FTPHost              string `mapstructure:"FTP_HOST"`
	FTPPort              int    `mapstructure:"FTP_PORT"`
	FTPUser              string `mapstructure:"FTP_USER"`
	FTPPassword          string `mapstructure:"FTP_PASSWORD"`
	FTPServerFolder      string `mapstructure:"FTP_SERVER_FOLDER"`
	FTPDialTimeout       int    `mapstructure:"FTP_DIAL_TIMEOUT"`
	FTPEPSVMode          bool   `mapstructure:"FTP_EPSV"`
}

ProjectConfig is the struct used to map the env.production file props.

type PromptContent

type PromptContent struct {
	ErrorMsg string
	Label    string
}

PromptContent is the struct by sveltin asking the user to provide info.

type ResourceItem

type ResourceItem struct {
	// contains filtered or unexported fields
}

ResourceItem is a struct representing a resource and its content as menu item.

func NewResourceItem

func NewResourceItem(name string) *ResourceItem

NewResourceItem returns a pointer to a ResourceItem struct.

func (*ResourceItem) AddChild

func (r *ResourceItem) AddChild(name string)

AddChild appends an item to the slice of contents.

func (*ResourceItem) GetContents

func (r *ResourceItem) GetContents() []string

GetContents returns a slice of strings with contents for a resource.

func (*ResourceItem) GetName

func (r *ResourceItem) GetName() string

GetName returns a string representing the resource item name.

type SveltinConfig

type SveltinConfig struct {
	Pages Pages `mapstructure:"pages"`
	Paths Paths `mapstructure:"paths"`
	API   API   `mapstructure:"api"`
	Theme Theme `mapstructure:"theme"`
}

SveltinConfig is the struct used the map the YAML file.

func (*SveltinConfig) GetAPIFilename

func (c *SveltinConfig) GetAPIFilename() string

GetAPIFilename returns a string representing the path to the 'src/routes/api/v1/version.ts' folder relative to the current working directory.

func (*SveltinConfig) GetAPIPath

func (c *SveltinConfig) GetAPIPath() string

GetAPIPath returns a string representing the path to the 'src/routes/api' folder relative to the current working directory.

func (*SveltinConfig) GetAPIVersion

func (c *SveltinConfig) GetAPIVersion() string

GetAPIVersion returns a string representing the path to the 'src/routes/api/v1' folder relative to the current working directory.

func (*SveltinConfig) GetBuildPath

func (c *SveltinConfig) GetBuildPath() string

GetBuildPath returns a string representing the path to the 'build' folder relative to the current working directory.

func (*SveltinConfig) GetConfigPath

func (c *SveltinConfig) GetConfigPath() string

GetConfigPath returns a string representing the path to the 'config' folder relative to the current working directory.

func (*SveltinConfig) GetContentPageFilename

func (c *SveltinConfig) GetContentPageFilename() string

GetContentPageFilename returns a string representing the path to the 'content' folder relative to the current working directory.

func (*SveltinConfig) GetContentPath

func (c *SveltinConfig) GetContentPath() string

GetContentPath returns a string representing the path to the 'content' folder relative to the current working directory.

func (*SveltinConfig) GetIndexPageFilename

func (c *SveltinConfig) GetIndexPageFilename() string

GetIndexPageFilename returns a string representing the path to the 'index' file relative to the current working directory.

func (*SveltinConfig) GetLibPath

func (c *SveltinConfig) GetLibPath() string

GetLibPath returns a string representing the path to the 'src/lib' folder relative to the current working directory.

func (*SveltinConfig) GetMetadataAPIFilename

func (c *SveltinConfig) GetMetadataAPIFilename() string

GetMetadataAPIFilename returns a string representing the path to the 'src/routes/api/v1/<metadata>' folder relative to the current working directory.

func (*SveltinConfig) GetProjectRoot

func (c *SveltinConfig) GetProjectRoot() string

GetProjectRoot returns a string representing the current working directory.

func (*SveltinConfig) GetPublicAPIFilename

func (c *SveltinConfig) GetPublicAPIFilename() string

GetPublicAPIFilename returns a string representing the path to the 'src/routes/api/v1/published.ts' file relative to the current working directory.

func (*SveltinConfig) GetPublicMetadataAPIFilename

func (c *SveltinConfig) GetPublicMetadataAPIFilename() string

GetPublicMetadataAPIFilename returns a string representing the path to the 'src/routes/api/v1/<metadata>/published.js' file relative to the current working directory.

func (*SveltinConfig) GetRoutesPath

func (c *SveltinConfig) GetRoutesPath() string

GetRoutesPath returns a string representing the path to the 'src/routes' folder relative to the current working directory.

func (*SveltinConfig) GetSlugPageFilename

func (c *SveltinConfig) GetSlugPageFilename() string

GetSlugPageFilename returns a string representing the path to the 'slug' file relative to the current working directory.

func (*SveltinConfig) GetSrcPath

func (c *SveltinConfig) GetSrcPath() string

GetSrcPath returns a string representing the path to the 'src' folder relative to the current working directory.

func (*SveltinConfig) GetStaticPath

func (c *SveltinConfig) GetStaticPath() string

GetStaticPath returns a string representing the path to the 'static' folder relative to the current working directory.

func (*SveltinConfig) GetThemeComponentsPath

func (c *SveltinConfig) GetThemeComponentsPath() string

GetThemeComponentsPath returns a string representing the path to the 'themes/<theme>/components' folder relative to the current working directory.

func (*SveltinConfig) GetThemeConfigFilename

func (c *SveltinConfig) GetThemeConfigFilename() string

GetThemeConfigFilename returns a string representing the path to the 'themes/theme.config.js' file relative to the current working directory.

func (*SveltinConfig) GetThemePartialsPath

func (c *SveltinConfig) GetThemePartialsPath() string

GetThemePartialsPath returns a string representing the path to the 'themes/<theme>/partials' folder relative to the current working directory.

func (*SveltinConfig) GetThemesPath

func (c *SveltinConfig) GetThemesPath() string

GetThemesPath returns a string representing the path to the 'themes' folder relative to the current working directory.

type TemplateData

type TemplateData struct {
	ProjectName string
	NPMClient   string
	BaseURL     string
	PortNumber  string
	Name        string
	Resource    string
	Type        string
	Config      *SveltinConfig
	Menu        *MenuConfig
	NoPage      *NoPage
	ThemeName   string
	Misc        string
}

TemplateData is the struct representing all the data to be passed to a template file.

type Theme

type Theme struct {
	File       string `mapstructure:"file"`
	Components string `mapStructure:"components"`
	Partials   string `mapstructure:"partials"`
}

Theme represents the theme folder structure in a Sveltin project.

type TplConfig

type TplConfig struct {
	PathToTplFile string
	Funcs         template.FuncMap
	Data          TemplateData
}

TplConfig is the struct representing all is needed by a template file (path to the template, functions map and template data).

func (*TplConfig) Run added in v0.3.0

func (tplConfig *TplConfig) Run(embedFS *embed.FS) []byte

Run executes the templates and return the content as []byte.

Jump to

Keyboard shortcuts

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