Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JavascriptGenerator

A Dockerfile generator for Javascript projects

Hierarchy

Index

Constructors

constructor

  • new JavascriptGenerator(urlFetcher: UrlFetcher, pkg: SoftwarePackage, folder?: undefined | string, nodeMajorVersion?: number): JavascriptGenerator

Properties

Optional baseImage

baseImage: undefined | string

Manually define the image to inherit FROM

folder

folder: string

The directory to scan for relevant files

nodeMajorVersion

nodeMajorVersion: number

The major version of Node.js to use.

Defaults to the latest LTS release

package

package: SoftwarePackage

The package that this generator generates a Dockerfile for

Protected Readonly urlFetcher

urlFetcher: UrlFetcher

The instance of IUrlFetcher to fetch URLs

Methods

applies

  • applies(): boolean

aptKeysCommand

  • aptKeysCommand(sysVersion: string): string

aptPackages

  • aptPackages(sysVersion: string): Array<string>

aptRepos

  • aptRepos(sysVersion: string): Array<string>

baseIdentifier

  • baseIdentifier(): string

baseName

  • baseName(): string

baseVersion

  • baseVersion(): string

baseVersionName

  • baseVersionName(baseIdentifier: string): string

envVars

  • envVars(sysVersion: string): Array<[string, string]>
  • A list of environment variables to set in the image as name, value pairs

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns Array<[string, string]>

exists

  • exists(subpath: string): boolean
  • Does a path exist within the project folder?

    Parameters

    • subpath: string

      The path within the folder

    Returns boolean

fetch

  • fetch(url: string, options?: any): Promise<any>
  • Fetch content from a URL

    Parameters

    • url: string

      The URL to fetch

    • Default value options: any = { responseType: 'json' }

      Request options

    Returns Promise<any>

filterPackages

  • filterPackages(runtimePlatform: string): Array<SoftwarePackage>

generate

  • generate(comments?: boolean, stencila?: boolean): string
  • Generate a Dockerfile for a SoftwareEnvironment instance

    Parameters

    • Default value comments: boolean = true

      Should a comments be added to the Dockerfile?

    • Default value stencila: boolean = false

      Should relevant Stencila language packages be installed in the image?

    Returns string

glob

  • glob(pattern: string | Array<string>): Array<string>
  • Get a list of paths that match a pattern in the project folder.

    Parameters

    • pattern: string | Array<string>

      The glob pattern

    Returns Array<string>

installCommand

  • installCommand(sysVersion: string): string | undefined

installFiles

  • installFiles(sysVersion: string): Array<[string, string]>

projectFiles

  • projectFiles(): Array<[string, string]>

read

  • read(subpath: string): string
  • Read a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    Returns string

runCommand

  • runCommand(): string | undefined

stencilaInstall

  • stencilaInstall(sysVersion: string): string | undefined

write

  • write(subpath: string, content: string): void
  • Write to a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    • content: string

      The content to write to the file

    Returns void

Generated using TypeDoc