config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config contains structs and interfaces used to map sveltin artifact to configurations.

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"`
	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 Pages

type Pages struct {
	Content       string `mapstructure:"content"`
	Index         string `mapstructure:"index"`
	IndexEndpoint string `mapstructure:"indexendpoint"`
	Slug          string `mapstructure:"slug"`
	SlugEndpoint  string `mapstructure:"slugendpoint"`
	SlugLayout    string `mapstructure:"sluglayout"`
}

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 {
	ProjectName   string
	CSSLibName    string
	ThemeName     string
	NPMClientName string
}

ProjectConfig represents the user selections when creating a new sveltin project.

func NewProjectConfig added in v0.11.0

func NewProjectConfig(name, css, theme, npmc string) *ProjectConfig

NewProjectConfig creates a pointer to a ProjectConfig struct.

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 SveltinSettings added in v0.2.0

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

SveltinSettings is the struct used the map the YAML file.

func (*SveltinSettings) GetAPIFilename added in v0.11.0

func (c *SveltinSettings) 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 (*SveltinSettings) GetAPIPath added in v0.11.0

func (c *SveltinSettings) GetAPIPath() string

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

func (*SveltinSettings) GetAPIVersion added in v0.11.0

func (c *SveltinSettings) GetAPIVersion() string

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

func (*SveltinSettings) GetBuildPath added in v0.11.0

func (c *SveltinSettings) GetBuildPath() string

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

func (*SveltinSettings) GetConfigPath added in v0.11.0

func (c *SveltinSettings) GetConfigPath() string

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

func (*SveltinSettings) GetContentPageFilename added in v0.11.0

func (c *SveltinSettings) GetContentPageFilename() string

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

func (*SveltinSettings) GetContentPath added in v0.11.0

func (c *SveltinSettings) GetContentPath() string

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

func (*SveltinSettings) GetIndexEndpointFilename added in v0.11.0

func (c *SveltinSettings) GetIndexEndpointFilename() string

GetIndexEndpointFilename returns '+page.svelte' file.

func (*SveltinSettings) GetIndexPageFilename added in v0.11.0

func (c *SveltinSettings) GetIndexPageFilename() string

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

func (*SveltinSettings) GetLibPath added in v0.11.0

func (c *SveltinSettings) GetLibPath() string

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

func (*SveltinSettings) GetParamsPath added in v0.11.0

func (c *SveltinSettings) GetParamsPath() string

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

func (*SveltinSettings) GetProjectRoot added in v0.11.0

func (c *SveltinSettings) GetProjectRoot() string

GetProjectRoot returns a string representing the current working directory.

func (*SveltinSettings) GetRoutesPath added in v0.11.0

func (c *SveltinSettings) GetRoutesPath() string

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

func (*SveltinSettings) GetSlugEndpointFilename added in v0.11.0

func (c *SveltinSettings) GetSlugEndpointFilename() string

GetSlugEndpointFilename returns '+page.ts' as filename for the slug.

func (*SveltinSettings) GetSlugLayoutFilename added in v0.11.0

func (c *SveltinSettings) GetSlugLayoutFilename() string

GetSlugLayoutFilename returns '+layout.svelte' as filename for the slug.

func (*SveltinSettings) GetSlugPageFilename added in v0.11.0

func (c *SveltinSettings) GetSlugPageFilename() string

GetSlugPageFilename returns '+page.svelte' filename for the slug.

func (*SveltinSettings) GetSrcPath added in v0.11.0

func (c *SveltinSettings) GetSrcPath() string

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

func (*SveltinSettings) GetStaticPath added in v0.11.0

func (c *SveltinSettings) GetStaticPath() string

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

func (*SveltinSettings) GetThemeComponentsPath added in v0.11.0

func (c *SveltinSettings) GetThemeComponentsPath() string

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

func (*SveltinSettings) GetThemeConfigFilename added in v0.11.0

func (c *SveltinSettings) GetThemeConfigFilename() string

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

func (*SveltinSettings) GetThemePartialsPath added in v0.11.0

func (c *SveltinSettings) GetThemePartialsPath() string

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

func (*SveltinSettings) GetThemesPath added in v0.11.0

func (c *SveltinSettings) 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
	Name            string
	Settings        *SveltinSettings
	ProjectSettings *tpltypes.ProjectSettings
	NPMClient       *tpltypes.NPMClientData
	Vite            *tpltypes.ViteData
	Page            *tpltypes.PageData
	Resource        *tpltypes.ResourceData
	Content         *tpltypes.ContentData
	Metadata        *tpltypes.MetadataData
	Menu            *tpltypes.MenuData
	NoPage          *tpltypes.NoPageData
	Theme           *tpltypes.ThemeData
	Misc            *tpltypes.MiscFileData
}

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

Jump to

Keyboard shortcuts

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