Hackmud Script Manager 0.1.2
Hackmud Script Manager is an API now.
hackmud_env-tools
is being depreciated, and its functions have now been merged into this package
Command
For the command, not much has changed, just added some more helpful text when you use hsm clear
wrong, and may have fixed an error related to the config.
API
build
▸ build(target
: string, distPath
: string): Promise<{ minLength: number ; name: string ; oldLength: number }[]>
Defined in index.ts:69
Builds target file or files in target folder and dumps them in specified directory.
Parameters:
Name | Type | Description |
---|---|---|
target |
string | file or folder to be built |
distPath |
string | folder to dump built files |
Returns: Promise<{ minLength: number ; name: string ; oldLength: number }[]>
clear
▸ clear(target
: string, hackmudPath
: string, user
: string): Promise<{ pushedRemoved: number ; targetRemoved: number }>
Defined in index.ts:44
Deletes target file or files in target folder and equivalent in hackmud folder.
Parameters:
Name | Type | Description |
---|---|---|
target |
string | file or folder to be cleared |
hackmudPath |
string | hackmud directory |
user |
string | hackmud user to target |
Returns: Promise<{ pushedRemoved: number ; targetRemoved: number }>
pull
▸ pull(srcPath
: string, hackmudPath
: string, scriptName
: string): Promise<void>
Defined in index.ts:330
Copies script from hackmud to local source folder.
Parameters:
Name | Type | Description |
---|---|---|
srcPath |
string | path to folder containing source files |
hackmudPath |
string | path to hackmud directory |
scriptName |
string | script to pull in user.script format |
Returns: Promise<void>
push
▸ push(srcPath
: string, hackmudPath
: string, users
: string[], scripts
: string[], callback?
: undefined | (info: Info) => void): Promise<Info[]>
Defined in index.ts:220
Push a specific or all scripts to a specific or all users.
In source directory, scripts in folders will override scripts with same name for user with folder name.
e.g. foo/bar.js overrides other bar.js script just for user foo.
Parameters:
Name | Type | Description |
---|---|---|
srcPath |
string | path to folder containing source files |
hackmudPath |
string | path to hackmud directory |
users |
string[] | users to push to (pushes to all if empty) |
scripts |
string[] | scripts to push from (pushes from all if empty) |
callback? |
undefined | (info: Info) => void | function that's called after each script has been built and written |
Returns: Promise<Info[]>
pushBuilt
▸ pushBuilt(target
: string, hackmudPath
: string, user
: string): Promise<{ pushedCount: number = 1 }>
Defined in index.ts:13
Copies target file or files in target folder to hackmud folder.
Parameters:
Name | Type | Description |
---|---|---|
target |
string | file or folder to be pushed |
hackmudPath |
string | hackmud directory |
user |
string | hackmud user to target |
Returns: Promise<{ pushedCount: number = 1 }>
watch
▸ watch(srcPath
: string, hackmudPath
: string, users
: string[], scripts
: string[], onUpdate?
: undefined | (info: Info) => void): void
Defined in index.ts:101
Watches target file or folder for updates and builds and pushes updated file.
Parameters:
Name | Type | Description |
---|---|---|
srcPath |
string | path to folder containing source files |
hackmudPath |
string | path to hackmud directory |
users |
string[] | users to push to (pushes to all if empty) |
scripts |
string[] | scripts to push from (pushes from all if empty) |
onUpdate? |
undefined | (info: Info) => void | function that's called after each script has been built and written |
Returns: void