Constructor
new BasePlugin(pkgName, app)
Name | Type | Description |
---|---|---|
pkgName | string | Package name (the one you use in package.json) |
app | Object | App instance reference. Usefull to call app method inside a plugin |
- Source
Members
alias :string
Getter for plugin's alias
- string
- Source
app :Object
Reference to app instance
- Object
- Source
config :Object
Config object
- Object
- Source
lib :TLib
Property to give you direct access to the most commonly used 3rd party library in a bajo based app. No manual import necessary, always available, everywhere, anytime!
Example:
const { camelCase, kebabCase } = this.lib._
console.log(camelCase('Elit commodo sit et aliqua'))
- TLib
- Source
name :string
Getter for plugin's name
- string
- Source
pkgName :string
Getter for plugin's package name
- string
- Source
(static, readonly) alias :string
Plugin alias. Derived plugin must provide its own, unique alias. If it left blank, Bajo will provide this automatically
- string
- Source
(static, constant) pkgName :string
Package name, the one from package.json
- string
- Source
(static, constant) pluginName :string
Plugin name. Simply the camel cased version of plugin's package name
- string
- Source
Methods
error(msg, …argsopt) → {Object}
Create an instance of Err object
Name | Type | Attributes | Description |
---|---|---|---|
msg | msg | Error message | |
args | any | <optional> <repeatable> | Argument variables you might want to add to the error object |
- Source
Err instance
- Type:
- Object
fatal(msg, …argsopt)
Create an instance of Err object, display it on screen and then force terminate the app process
Name | Type | Attributes | Description |
---|---|---|---|
msg | msg | Error message | |
args | any | <optional> <repeatable> | Argument variables you might want to add to the error object |
- Source
getConfig(pathopt, optionsopt) → {Object}
Get plugin's config value
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path | string | <optional> | dot separated config path (think of lodash's 'get'). If not provided, the full config will be given | |||||||||||||||||||||
options | Object | <optional> | {} | Options Properties
|
- Source
Returned object. If no path provided, the whole config object is returned
- Type:
- Object
initLog()
Initialize log. Please refer to Log class for more info
- Source
initPrint(optionsopt)
Initialize print engine. Please refer to Print class for more info
Name | Type | Attributes | Description |
---|---|---|---|
options | Object | <optional> | Print options |
- Source
Type Definitions
TLib
- Object
Name | Type | Description |
---|---|---|
_ | Object | Access to lodash |
fs | Object | Access to fs-extra |
fastGlob | Object | Access to fast-glob |
sprintf | Object | Access to sprintf |
aneka | Object | Access to aneka |
outmatch | Object | Access to outmatch |
dayjs | Object | Access to dayjs with utc & customParseFormat plugin already applied |
- Source