Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Latest commit

 

History

History
129 lines (87 loc) · 2.94 KB

installation_schema.md

File metadata and controls

129 lines (87 loc) · 2.94 KB

Installation Schema

Each plugin must have a valid installation for it to be able to be installed, the installation contains details on what files are sourced and any additional commands that must be run for the plugin to work.

Installation fields

origin

The origin points to where the plugin should be downloaded from, currently the only valid origin is "github"

Declaration: origin: PluginOrigin

PluginOrigin type

type PluginOrigin = "github"

sourceFiles

The sourceFiles defines what files should be "sourced" (read and executed in the shell).

Declaration: sourceFiles?: string | string[]

For Bash the sourceFile ususally matches one (or more) of the following:

*.plugin.bash
*.plugin.sh
*.bash
*.sh

For ZSH the sourceFile ususally matches one (or more) of the following:

*.plugin.zsh
*.zsh
*.zsh-theme
*.sh

preScript and postScript

The preScript and postScript are both InstallationScripts that can run before or after the plugin is sourced, these can be helpful if a plugin requires some environment variable set or other command run.

Declaration:

preScript?: InstallationScripts<string>
postScript?: InstallationScripts<string>

bash, zsh, and fish

By definining bash, zsh, or fish the behavior can be overrided for the sepecific shell, this takes an object with sourceFiles, preScript, and postScript.

This is useful if there are diffrent files to source between shells or diffrent scripts to run.


InstallationScript

An InstallationScript is a shell script that is used when installing a plugin. The script can either be a static or dynamic based on the shell being used and local context from the machine installing the plugin. The context currently only has the directory the plugin is installed in. This is useful for referencing other assests that are in the plugin directly from the script.

Declaration:

type InstallationScript<T> = T | InstallationScriptCompiler<T>;

InstallationScriptCompiler

The InstallationScriptCompiler is a function that takes a DotfileCompilationContext and returns a type T, this is likely either a string or string[].

Declaration:

type InstallationScriptCompiler<T> = (_: { ctx: DotfileCompilationContext }) => T;

DotfileCompilationContext

The DoffilesCompilationContext contains the Shell that the script should be generated for and PluginContext which contains the directory where the plugin was cloned locally.

Declaration:

interface DotfileCompilationContext {
  plugin: PluginContext;
  shell: "zsh" | "bash" | "fish";
  os: "linux" | "macos" | "windows" | "unknown";
}

PluginContext

interface PluginContext {
  installDirectory: string;
}