Home Reference Source Test
public class | source

Releaser

Bundles source files for release.

Example:

Assume later uses of `config` use the following value.
const config = {
     vendor: "shinka",
     code: "cli",
     version: "0.0.1-a"
};
new Releaser({}, config);
// => shinka-news-0.0.1-a.zip
new Releaser({
     vendor: "shin",
     directory: "to/a/dir"
}, config);
// => to/a/dir/shin-news-0.0.1-a.zip

Constructor Summary

Public Constructor
public

constructor(cmd: Cmd, config: Config, logger: LogObject)

Member Summary

Public Members
public

cmd: Cmd

Command arguments.

public

For vendor, code, and version lookup.

public
public

Output target.

public

logger#log is used to output progress, e.g.

Method Summary

Public Methods
public

errors(): string[]

Builds error messages.

public

Executes git archive to bundle release.

public

Builds filename from command arguments and config.

public

Outputs error messages.

public

Outputs success message.

public

Bundles source files for release with git archive.

public

Builds success message.

Public Constructors

public constructor(cmd: Cmd, config: Config, logger: LogObject) source

Params:

NameTypeAttributeDescription
cmd Cmd

Command arguments

config Config
  • optional
  • default: {}

For vendor, code, and version lookup.

logger LogObject
  • optional
  • default: new Logger()

logger#log is used to output progress

Public Members

public cmd: Cmd source

Command arguments.

Properties:

NameTypeAttributeDescription
cmd.output string
  • optional
  • nullable: true

Overrides default filename format.

cmd.directory string
  • optional
  • nullable: true

Prepended to filename.

cmd.vendor string
  • optional
  • nullable: true

Vendor name, e.g. shinka in shinka-cli.

cmd.code string
  • optional
  • nullable: true

Plugin code name, e.g. cli in shinka-cli.

cmd.semver string
  • optional
  • nullable: true

Semantic plugin version

public config: Config source

For vendor, code, and version lookup.

public errorList: Error[] source

public filename: string source

Output target.

public logger: LogObject source

logger#log is used to output progress, e.g. Logger#log or console#log.

Public Methods

public errors(): string[] source

Builds error messages.

Return:

string[]

public executeArchive() source

Executes git archive to bundle release.

public getFileName(): string source

Builds filename from command arguments and config.

Format defaults to vendor-code-semver.zip. cmd.output overwrites the default format. cmd.directory is prepended to the filename

Return:

string

Example:

new Releaser({}, config).getFileName();
// => shinka-cli-0.0.1-a.zip
new Releaser({
     vendor: "shin",
     code: "news",
     version: "1.0.0"
}, config).getFileName();
// => shin-news-1.0.0.zip
new Releaser({
     directory: "to/a/dir"
}, config).getFileName();
// => to/a/dir/shinka-news-0.0.1-a.zip
new Releaser({
     directory: "to/a/dir",
     output: "release.zip"
}, config).getFileName();
// => to/a/dir/release.zip

public outputErrors() source

Outputs error messages.

public outputSuccess() source

Outputs success message.

public release() source

Bundles source files for release with git archive.

public success(): string source

Builds success message.

Return:

string