Function
Static Public Summary | ||
public |
aliasToCommand(alias: string): string Get the command name of a given alias |
|
public |
commandToFunction(command: string): Function Get the function of a given command |
|
public |
Exit mongoose-data-seed. |
|
public |
async generateSeeder(name: string): Promise Generate a new seeder. |
|
public |
Get the command and the arguments from the cli |
|
public |
getFolderNameFromPath(path: string): string Get folder name from given path. |
|
public |
getObjectWithSelectedKeys(obj: Object, keys: string[]): Object Get object with selected keys from a given object. |
|
public |
getOptions(argv: string[]): Object Get generate options from argv |
|
public |
getOptions(argv: string[]): Object Get init options from argv |
|
public |
getOptions(argv: string[]): Object Get run options from argv or prompts |
|
public |
help() Prints the generate command user-guide |
|
public |
async help() Prints the help |
|
public |
help() Prints the install command user-guide |
|
public |
help() Prints the run command user-guide |
|
public |
mongoose-data-seed generate command |
|
public |
mongoose-data-seed init command |
|
public |
mongoose-data-seed run command |
|
public |
Whether a given command is an alias |
|
public |
normalizeSeederFileName(name: string): string Normalize seeder filename. |
|
public |
normalizeSeederName(name: string): string Normalize seeder name. |
|
public |
async promptMissingOptions(options: Object): Promise Prompt missing options for init command |
|
public |
Run seeders |
|
public |
runCommand(command: string, argv: string): * Run command |
|
public |
async runinstaller(options: Object): Promise Run the installer |
|
public |
validateOptions(options: Object) Validate generate command options |
|
public |
validateSeederTemplatePath(name: string): boolean Validate seeder template path. |
|
public |
validateSeedersFolderName(name: string): boolean Validate seeders folder name. |
|
public |
Validate user config. |
Static Public
public aliasToCommand(alias: string): string source
import {aliasToCommand} from 'mongoose-data-seed/src/lib/commands/helpers.js'
Get the command name of a given alias
Params:
Name | Type | Attribute | Description |
alias | string |
public commandToFunction(command: string): Function source
import {commandToFunction} from 'mongoose-data-seed/src/lib/commands/helpers.js'
Get the function of a given command
Params:
Name | Type | Attribute | Description |
command | string | command name |
public exit(error: Error) source
import {exit} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Exit mongoose-data-seed.
Params:
Name | Type | Attribute | Description |
error | Error |
|
Exit with error when supplied. |
public async generateSeeder(name: string): Promise source
import generateSeeder from 'mongoose-data-seed/src/lib/commands/generate/generate-seeder.js'
Generate a new seeder.
Params:
Name | Type | Attribute | Description |
name | string | seeder name |
public getCommandAndArgvFromCli(): Object source
import {getCommandAndArgvFromCli} from 'mongoose-data-seed/src/lib/commands/helpers.js'
Get the command and the arguments from the cli
public getFolderNameFromPath(path: string): string source
import {getFolderNameFromPath} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Get folder name from given path.
Params:
Name | Type | Attribute | Description |
path | string | path |
public getObjectWithSelectedKeys(obj: Object, keys: string[]): Object source
import {getObjectWithSelectedKeys} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Get object with selected keys from a given object.
public getOptions(argv: string[]): Object source
import {getOptions} from 'mongoose-data-seed/src/lib/commands/generate/options.js'
Get generate options from argv
Params:
Name | Type | Attribute | Description |
argv | string[] | cli argv |
public getOptions(argv: string[]): Object source
import {getOptions} from 'mongoose-data-seed/src/lib/commands/init/options.js'
Get init options from argv
Params:
Name | Type | Attribute | Description |
argv | string[] | cli argv |
public getOptions(argv: string[]): Object source
import {getOptions} from 'mongoose-data-seed/src/lib/commands/run/options.js'
Get run options from argv or prompts
Params:
Name | Type | Attribute | Description |
argv | string[] | cli argv |
public help() source
import help from 'mongoose-data-seed/src/lib/commands/generate/help.js'
Prints the generate command user-guide
public async help() source
import help from 'mongoose-data-seed/src/lib/commands/help/index.js'
Prints the help
public help() source
import help from 'mongoose-data-seed/src/lib/commands/init/help.js'
Prints the install command user-guide
public help() source
import help from 'mongoose-data-seed/src/lib/commands/run/help.js'
Prints the run command user-guide
public async index(argv: stringp[]): Promise source
import index from 'mongoose-data-seed/src/lib/commands/generate/index.js'
mongoose-data-seed generate command
Params:
Name | Type | Attribute | Description |
argv | stringp[] | cli arguments |
public async index(argv: stringp[]): Promise source
import index from 'mongoose-data-seed/src/lib/commands/init/index.js'
mongoose-data-seed init command
Params:
Name | Type | Attribute | Description |
argv | stringp[] | cli arguments |
public async index(argv: stringp[]): Promise source
import index from 'mongoose-data-seed/src/lib/commands/run/index.js'
mongoose-data-seed run command
Params:
Name | Type | Attribute | Description |
argv | stringp[] | cli arguments |
public isAlias(command: string): Boolean source
import {isAlias} from 'mongoose-data-seed/src/lib/commands/helpers.js'
Whether a given command is an alias
Params:
Name | Type | Attribute | Description |
command | string |
public normalizeSeederFileName(name: string): string source
import {normalizeSeederFileName} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Normalize seeder filename.
Params:
Name | Type | Attribute | Description |
name | string | seeder name |
public normalizeSeederName(name: string): string source
import {normalizeSeederName} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Normalize seeder name.
Params:
Name | Type | Attribute | Description |
name | string | seeder name |
public async promptMissingOptions(options: Object): Promise source
import {promptMissingOptions} from 'mongoose-data-seed/src/lib/commands/init/options.js'
Prompt missing options for init command
Params:
Name | Type | Attribute | Description |
options | Object |
|
Init command options |
options.seedersFolder | [type] | seeders folder |
|
options.customSeederTemplate | [type] | custom seeder template |
public async run(options: Object): Promise source
import run from 'mongoose-data-seed/src/lib/commands/run/run.js'
Run seeders
public runCommand(command: string, argv: string): * source
import {runCommand} from 'mongoose-data-seed/src/lib/commands/helpers.js'
Run command
Return:
* |
public async runinstaller(options: Object): Promise source
import runinstaller from 'mongoose-data-seed/src/lib/commands/init/run-installer.js'
Run the installer
public validateOptions(options: Object) source
import {validateOptions} from 'mongoose-data-seed/src/lib/commands/generate/options.js'
Validate generate command options
Throw:
throw error when options are not valid. |
public validateSeederTemplatePath(name: string): boolean source
import {validateSeederTemplatePath} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Validate seeder template path.
Params:
Name | Type | Attribute | Description |
name | string | path |
public validateSeedersFolderName(name: string): boolean source
import {validateSeedersFolderName} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Validate seeders folder name.
Params:
Name | Type | Attribute | Description |
name | string | folder name |
public validateUserConfig() source
import {validateUserConfig} from 'mongoose-data-seed/src/lib/utils/helpers.js'
Validate user config.
Throw:
throw error when user config is not valid. |