config

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 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

View Source
const (
	BlankTheme    string = "blank"
	SveltinTheme  string = "sveltin"
	ExistingTheme string = "existing"
)

names for the available thems options.

Variables

AvailableThemes is the list of the available themes.

Functions

This section is empty.

Types

type API

type API struct {
	Version  string `mapstructure:"version"`
	Filename string `mapstructure:"filename"`
}

API represents the API folder structure 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"`
	IndexEndpoint string `mapstructure:"indexendpoint"`
	Slug          string `mapstructure:"slug"`
	SlugEndpoint  string `mapstructure:"slugendpoint"`
}

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"`
	Themes  string `mapstructure:"themes"`
	Src     string `mapstructure:"src"`
	Params  string `mapstructure:"params"`
	Lib     string `mapstructure:"lib"`
	Routes  string `mapstructure:"routes"`
	API     string `mapstructure:"api"`
}

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 represents an ask to the user and contains the relative error message.

type PromptObject added in v0.7.0

type PromptObject struct {
	ID   string
	Name string
}

PromptObject represents an item to display inside the list by promptui.

func (*PromptObject) String added in v0.7.0

func (po *PromptObject) String() string

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 StarterTemplate added in v0.8.1

type StarterTemplate struct {
	Name string
	URL  string
}

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

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/<resource>/index.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) GetIndexEndpointFilename added in v0.6.0

func (c *SveltinConfig) GetIndexEndpointFilename() string

GetIndexEndpointFilename returns a string representing the path to the 'index' file 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) GetParamsPath added in v0.8.9

func (c *SveltinConfig) GetParamsPath() string

GetParamsPath returns a string representing the path to the 'src/params' 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) 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) GetSlugEndpointFilename added in v0.6.0

func (c *SveltinConfig) GetSlugEndpointFilename() string

GetSlugEndpointFilename returns a string representing the path to the 'slug' file 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
	Theme       *ThemeData
	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 ThemeData added in v0.8.0

type ThemeData struct {
	ID     string
	IsNew  bool
	Name   string
	CSSLib string
	URL    string
}

ThemeData contains info about the theme.

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