Home Manual Reference Source

Function

Static Public Summary
public

Generates a Provider with an already defined name for the program.

public

plugins(prefix: string): Provider

Generate a Provider with an already defined prefix for the plugins.

public

promptWithOptions(messagesPrefix: string): Provider

Generates a Provider with an already defined message prefix.

public

tempFilesCustom(directory: string, locationName: string, serviceName: string): Provider

Generates a Provider with a custom directory and/or location name for the temp directory.

Static Public

public cliWithName(name: string): Provider source

import {cliWithName} from 'projext/src/services/cli/cli.js'

Generates a Provider with an already defined name for the program.

Params:

NameTypeAttributeDescription
name string

The name of the program.

Return:

Provider

Example:

// Generate the provider
const provider = cliWithName('my-program');
// Register it on the container
container.register(provider);
// Getting access to the service instance
const cli = container.get('cli');

public plugins(prefix: string): Provider source

Generate a Provider with an already defined prefix for the plugins.

Params:

NameTypeAttributeDescription
prefix string

The prefix the dependencies need to have in order to be identified as plugins.

Return:

Provider

Example:

// Generate the provider
const provider = plugins('my-plugin-');
// Register it on the container
container.register(provider);
// Getting access to the service instance
const plugins = container.get('plugins');

public promptWithOptions(messagesPrefix: string): Provider source

import {promptWithOptions} from 'projext/src/services/common/prompt.js'

Generates a Provider with an already defined message prefix.

Params:

NameTypeAttributeDescription
messagesPrefix string
  • optional

A prefix to include in front of all the messages.

Return:

Provider

Example:

// Generate the provider
const provider = promptWithOptions('my-prefix');
// Register it on the container
container.register(provider);
// Getting access to the service instance
const prompt = container.get('prompt');

public tempFilesCustom(directory: string, locationName: string, serviceName: string): Provider source

import {tempFilesCustom} from 'projext/src/services/common/tempFiles.js'

Generates a Provider with a custom directory and/or location name for the temp directory. You can also specify a custom service name, which can be helpfull if you want to create multiple services for temp files.

Params:

NameTypeAttributeDescription
directory string
  • optional

The name of the temp directory.

locationName string
  • optional

The name that will be used to register the temp directory path as a location on the pathUtils service.

serviceName string
  • optional
  • default: 'tempFiles'

The name that will be used to register the TempFiles instance as a service.

Return:

Provider

Example:

// Generate the provider
const provider = tempFilesCustom('.my-files', 'myTempFiles', 'myTempFiles');
// Register it on the container
container.register(provider);
// Get access to the service instance
const myTempFiles = container.get('myTempFiles');