Installer
mongoose-data-seed installer
Example:
// create installer
const installer = new Installer({ seedersFolder: './seeders' });
// run seeders
const observable = installer.install();
// subscribe logger
observable.subscribe({
next({ type, payload }) {
switch (type) {
case Installer.operations.START:
console.log('Installer started!');
break;
case Installer.operations.SUCCESS:
console.log('Installer finished successfully!');
break;
}
},
error({ type, payload }) {
console.error(`Error: ${type}`);
console.error(payload.error);
}
});
Static Member Summary
| Static Public Members | ||
| public static |
Installer operations constants |
|
Constructor Summary
| Public Constructor | ||
| public |
constructor(config: InstallerConfig) Creates mongoose-data-seed installer |
|
Method Summary
| Public Methods | ||
| public |
get the config that should be written into the |
|
| public |
install(): Observable Run installer - install |
|
Static Public Members
Public Constructors
public constructor(config: InstallerConfig) source
Creates mongoose-data-seed installer
Params:
| Name | Type | Attribute | Description |
| config | InstallerConfig |
|
Generator config |
Public Members
public config: Object source
Full configuration object
Properties:
| Name | Type | Attribute | Description |
| userPackageJsonPath | string | path to the user package.json file. |
|
| customSeederTemplateFilename | string |
|
custom seeder template filename. |
| customSeederTemplatePath | string |
|
custom seeder template path. |
| userSeedersFolderName | string | seeders folder name. |
|
| userSeedersFolderPath | string | seeders folder path. |
|
| userConfigExists | boolean | user has a config file?. |
|
| userConfigFilename | string |
|
config file name. |
| userConfigFilepath | string |
|
config file path. |
| configTemplatePath | string | config template path. |
Public Methods
public getGeneratorConfig(): InstallerConfig source
get the config that should be written into the package.json
