Home Reference Source Test
public class | source

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

Creates mongoose-data-seed installer

Member Summary

Public Members
public

Full configuration object

Method Summary

Public Methods
public

get the config that should be written into the package.json

public

install(): Observable

Run installer - install mongoose-data-seeder

Static Public Members

public static operations: Object source

Installer operations constants

Properties:

NameTypeAttributeDescription
START string

Installation starts.

SUCCESS string

Installation succeed.

ERROR string

Installation finished with an error.

Public Constructors

public constructor(config: InstallerConfig) source

Creates mongoose-data-seed installer

Params:

NameTypeAttributeDescription
config InstallerConfig
  • optional

Generator config

Public Members

public config: Object source

Full configuration object

Properties:

NameTypeAttributeDescription
userPackageJsonPath string

path to the user package.json file.

customSeederTemplateFilename string
  • nullable: true

custom seeder template filename.

customSeederTemplatePath string
  • nullable: true

custom seeder template path.

userSeedersFolderName string

seeders folder name.

userSeedersFolderPath string

seeders folder path.

userConfigExists boolean

user has a config file?.

userConfigFilename string
  • nullable: true

config file name.

userConfigFilepath string
  • nullable: true

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

Return:

InstallerConfig

generator config

public install(): Observable source

Run installer - install mongoose-data-seeder

Return:

Observable

See: