Options
All
  • Public
  • Public/Protected
  • All
Menu

The class helps you bundle apps for deployment on Edgio.

Hierarchy

  • DeploymentBuilder

Index

Constructors

constructor

Properties

appDir

appDir: string

edgioDir

edgioDir: string

jsDir

jsDir: string

permanentStaticAssetsDir

permanentStaticAssetsDir: string

sourcesDir

sourcesDir: string

staticAssetsDir

staticAssetsDir: string

Accessors

Static edgioVersion

  • get edgioVersion(): string
  • Edgio version of @edgio/core.

    Returns string

Methods

addDefaultAppResources

  • addDefaultAppResources(defaultAppPath: string): this
  • Ensures all assets in the "all", "js", and "ts" subdirectories of defaultAppPath are either already present in the user's app or are copied over from defaultAppPath.

    Parameters

    • defaultAppPath: string

    Returns this

    A self reference, suitable for chaining

addDefaultEdgioScripts

  • addDefaultEdgioScripts(scriptsOverride?: {}, overrideExisting?: boolean): this
  • Copies all the edgio scripts into the package.json file, if they don't already exist.

    Parameters

    • Default value scriptsOverride: {} = {}

      Used to pass framework-specific script overrides

    • Default value overrideExisting: boolean = false

      Set to true to override existing edgio script elements

    Returns this

    A self reference, suitable for chaining

addJSAsset

  • addJSAsset(src: string, dest?: undefined | string, options?: CopyOptionsSync): this
  • Adds an asset to the bundle for JavaScript workers

    Parameters

    • src: string

      The source path

    • Optional dest: undefined | string

      An optional destination path within the lambda root directory. If not provided, the destination path will be the same as the source path.

    • Optional options: CopyOptionsSync

      Options for copySync

    Returns this

    a self reference, suitable for chaining

addSource

  • addSource(src: string): void
  • Copies a file or directory into .edgio/src

    Parameters

    • src: string

    Returns void

addStaticAsset

  • addStaticAsset(src: string, dest?: undefined | string, __namedParameters?: { exclude: string[]; permanent: boolean }): this
  • Adds a folder or file as static asset. Also register directories as asset aliases when they contains an index.html file

    Parameters

    • src: string

      The source path

    • Optional dest: undefined | string

      An optional destination path in s3. If not provided, the destination path will be the same as the source path.

    • Default value __namedParameters: { exclude: string[]; permanent: boolean } = {}
      • exclude: string[]
      • permanent: boolean

    Returns this

    a self reference, suitable for chaining

build

  • Copies all of the standard assets into the JS and static asset bundles. These are the same for any framework.

    Parameters

    Returns Promise<void>

buildServiceWorker

  • buildServiceWorker(src?: string, dest?: string, injectManifest?: undefined | false | true, globOptions?: undefined | { globDirectory: string; globPatterns: string[] }): Promise<void>
  • Exports a function to build service worker with globManifest options

    default

    resolve(process.cwd(), 'sw', 'service-worker.js')

    default

    resolve(process.cwd(), '.edgio_temp', 'service-worker.js')

    Parameters

    • Default value src: string = resolve(process.cwd(), 'sw', 'service-worker.js')

      the source path to the service-worker

    • Default value dest: string = resolve(process.cwd(), '.edgio_temp', 'service-worker.js')

      the destination path to the bundled service-worker

    • Optional injectManifest: undefined | false | true

      Optional - True would invoke injectManifest as well

    • Optional globOptions: undefined | { globDirectory: string; globPatterns: string[] }

      Optional - { globDirectory: string, globPatterns: string[] }

    Returns Promise<void>

    void

clearPreviousBuildOutput

  • clearPreviousBuildOutput(): this
  • Deletes the output of the previous build.

    Returns this

copySync

  • copySync(from: string, to: string, copySyncOptions?: CopyOptionsSync): void
  • Copies a file

    Parameters

    • from: string

      the source path

    • to: string

      the destination path

    • Default value copySyncOptions: CopyOptionsSync = {}

    Returns void

deleteMapFiles

  • deleteMapFiles(dir: string): void
  • Deletes all .map files from specified folder

    Parameters

    • dir: string

    Returns void

emptyDirSync

  • emptyDirSync(dir: string): void
  • Deletes all files in a directory

    Parameters

    • dir: string

      The directory to empty

    Returns void

exec

  • exec(command: string, options?: ExecOptions): Promise<unknown>
  • Runs a command.

    Parameters

    • command: string
    • Default value options: ExecOptions = {}

      Options for shelljs

    Returns Promise<unknown>

    A promise that resolves when the command is finished.

getRouter

  • getRouter(): Promise<Router>
  • Returns the router instance.

    Returns Promise<Router>

includeFiles

  • includeFiles(): Promise<void>
  • Adds all configured extra files to the lamdba directory

    Returns Promise<void>

includeNodeModules

  • includeNodeModules(): Promise<void>
  • Adds all dependencies from package.json to the JS bundle (excluding devDependencies)

    Returns Promise<void>

isYarn

  • isYarn(): boolean
  • Returns boolean

log

  • log(...msg: any[]): void
  • Logs a message to the console if process.env.debug is set to true

    Parameters

    • Rest ...msg: any[]

      The message to log

    Returns void

preparePackageJson

  • preparePackageJson(): void
  • Copies the package.json file into the lambda and adjust all dependencies that use file paths

    Returns void

readFileSync

  • readFileSync(path: string, __namedParameters?: { encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" }): string
  • Reads a file

    Parameters

    • path: string

      the file path

    • Default value __namedParameters: { encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" } = {}
      • encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"

    Returns string

    The file contents

removeSync

  • removeSync(path: string): void
  • Deletes a file

    Parameters

    • path: string

      The file to delete

    Returns void

setStaticAssetExpiration

  • setStaticAssetExpiration(path: string, maxAgeSeconds: number, staleWhileRevalidateSeconds: number): this
  • Configures the TTL for a static asset. Once the TTL has expired, it will be refreshed by forwarding requests for that asset to serverless.

    Parameters

    • path: string

      The path to the asset within the app

    • maxAgeSeconds: number

      The TTL in seconds

    • staleWhileRevalidateSeconds: number

    Returns this

    A self-reference, suitable for chaining

writeFileSync

  • writeFileSync(to: string, content: string): void
  • Writes a file

    Parameters

    • to: string

      the destination path

    • content: string

      the contents of the file

    Returns void

Generated using TypeDoc