Documentation
¶
Index ¶
Constants ¶
View Source
const ( ActionRun = "run" ActionBuild = "build" )
View Source
const DefaultRegistryEndpoint = "https://raw.githubusercontent.com/kataras/iris-cli/main/registry.yml"
View Source
const ProjectFilename = ".iris.yml"
ProjectFilename is the current project's filename that is created on project creation (and automatically added to a .gitignore file if a git repository).
Variables ¶
View Source
var ErrProjectFileNotExist = errors.New("project file does not exist")
View Source
var ErrProjectNotExists = fmt.Errorf("project does not exist")
ErrProjectNotExists can be return as error value from the `Registry.Install` method.
Functions ¶
This section is empty.
Types ¶
type LiveReload ¶
type LiveReload struct {
// Disable set to true to disable browser live reload.
Disable bool `json:"disable" yaml:"Disable" toml:"Disable"`
// No, the server should have the localhost everywhere, accept just the port.
// // Addr is the host:port address of the websocket server.
// // The javascript file which listens on updates and should be included on the application
// // is served through: {Addr}/livereload.js.
// // The websocket endpoint is {Addr}/livereload.
// //
// // Defaults to :35729.
// Addr string `json:"addr" yaml:"Addr" toml:"Addr"`
Port int `json:"port" yaml:"Port" toml:"Port"`
// contains filtered or unexported fields
}
func NewLiveReload ¶
func NewLiveReload() *LiveReload
func (*LiveReload) HandleJS ¶
func (l *LiveReload) HandleJS() http.HandlerFunc
HandleJS serves the /livereload.js.
We handle the javascript side here in order to be easier to listen on reload events within any application.
Just add this script before the closing body tag: <script src="http://localhost:35729/livereload.js></script>" Note that Iris injects a script like that automatically if it runs under iris-cli, so users don't have to inject that manually.
func (*LiveReload) ListenAndServe ¶
func (l *LiveReload) ListenAndServe() error
func (*LiveReload) SendReloadSignal ¶
func (l *LiveReload) SendReloadSignal()
type Project ¶
type Project struct {
Name string `json:"name,omitempty" yaml:"Name" toml:"Name"` // e.g. starter-kit
// Remote.
Repo string `json:"repo" yaml:"Repo" toml:"Repo"` // e.g. "iris-contrib/starter-kit"
Version string `json:"version,omitempty" yaml:"Version" toml:"Version"` // if empty then set to "main"
// Local.
Dest string `json:"dest,omitempty" yaml:"Dest" toml:"Dest"` // if empty then $GOPATH+Module or ./+Module, absolute path of project destination.
Module string `json:"module,omitempty" yaml:"Module" toml:"Module"` // if empty then set to the remote module name fetched from go.mod
Replacements map[string]string `json:"-" yaml:"-" toml:"-"` // any raw text replacements.
// Pre Installation.
Reader func(io.Reader) ([]byte, error) `json:"-" yaml:"-" toml:"-"`
// Post installation.
// DisableInlineCommands disables source code comments stats with // $ _command_ to execute on "run" command.
DisableInlineCommands bool `json:"disable_inline_commands" yaml:"DisableInlineCommands" toml:"DisableInlineCommands"`
// NodePackageManager the node package manager to execute the npm commands.
// Defaults to "npm".
NodePackageManager string `json:"node_package_manager" yaml:"NodePackageManager" toml:"NodePackageManager"`
// DisableNpmInstall if `Run` and watch should NOT run npm install on first ran (and package.json changes).
// Defaults to false.
DisableNpmInstall bool `json:"disable_npm_install" yaml:"DisableNpmInstall" toml:"DisableNpmInstall"`
// NpmBuildScriptName the package.json -> scripts[name] to execute on run and frontend changes.
// Defaults to "build".
NpmBuildScriptName string `json:"npm_build_script_name" yaml:"NpmBuildScriptName" toml:"NpmBuildScriptName"`
Watcher Watcher `json:"watcher" yaml:"Watcher" toml:"Watcher"`
LiveReload *LiveReload `json:"livereload" yaml:"LiveReload" toml:"LiveReload"`
// Relative path of the files and directories installed, because the folder may be not empty
// and when installation fails we don't want to delete any user-defined files,
// just the project's ones before build.
Files []string `json:"files,omitempty" yaml:"Files" toml:"Files"`
BuildFiles []string `json:"build_files" yaml:"BuildFiles" toml:"BuildFiles"` // New directories and files, relatively to p.Dest, that are created by build (makefile, build script, npm install & npm run build).
MD5PackageJSON []byte `json:"md5_package_json" yaml:"MD5PackageJSON" toml:"MD5PackageJSON"`
// Running is set automatically to true on `Run` and false on interrupt,
// it is used for third-parties software to check if a specific project is running under iris-cli.
Running bool `json:"running" yaml:"Running,omitempty" toml:"Running"`
// contains filtered or unexported fields
}
func LoadFromDisk ¶
func (*Project) SaveToDisk ¶
type Registry ¶
type Registry struct {
Endpoint string `json:"endpoint,omitempty" yaml:"Endpoint" toml:"Endpoint"`
EndpointAsset func(string) ([]byte, error) `json:"-" yaml:"-" toml:"-"` // If EndpointAsset is not nil then it reads the Endpoint from that `EndpointAsset` function.
Projects map[string]string `json:"projects" yaml:"Projects" toml:"Projects"` // key = name, value = repo.
Names []string `json:"-" yaml:"-" toml:"-"` // sorted Projects names.
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
type Watcher ¶
type Watcher struct {
// Disable set to true to disable re-building and re-run the server and its frontend assets on file changes after first `Run`.
Disable bool `json:"disable" yaml:"Disable" toml:"Disable"`
// Backend file extensions.
Backend []string `json:"backend" yaml:"Backend" toml:"backend"`
// Frontend file extensions.
Frontend []string `json:"frontend" yaml:"Frontend" toml:"frontend"`
// IgnoreDirs directories pattern or literal root dir to ignore.
IgnoreDirs []string `json:"ignore_dirs" yaml:"IgnoreDirs" toml:"IgnoreDirs"`
}
Click to show internal directories.
Click to hide internal directories.