Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Majo

Index

Constructors

constructor

  • Returns Majo

Properties

Optional baseDir

baseDir: undefined | string

Base directory You normally set this by calling .source

Optional dotFiles

dotFiles: undefined | false | true

files

files: object

Type declaration

  • [filename: string]: File

meta

meta: object

An object you can use across middleware to share states

Type declaration

  • [k: string]: any

middlewares

middlewares: Middleware[]

Optional onWrite

onWrite: OnWrite

Optional sourcePatterns

sourcePatterns: string[]

Accessors

fileList

fileList:

Get an array of sorted file paths

Methods

createFile

  • createFile(relativePath: string, file: File): this
  • Create a new file

    Parameters

    • relativePath: string

      Relative path

    • file: File

    Returns this

deleteFile

  • deleteFile(relativePath: string): this
  • Delete a file

    Parameters

    • relativePath: string

      Relative path

    Returns this

dest

  • dest(dest: string, options?: DestOptions): Promise<this>
  • Run middlewares and write processed files to disk

    Parameters

    • dest: string

      Target directory

    • Default value options: DestOptions = {}

    Returns Promise<this>

file

  • file(relativePath: string): File
  • Get a file by relativePath path

    Parameters

    • relativePath: string

      Relative path

    Returns File

fileContents

  • fileContents(relativePath: string): string
  • Get file contents as a UTF-8 string

    Parameters

    • relativePath: string

      Relative path

    Returns string

fileStats

  • fileStats(relativePath: string): Stats
  • Get the fs.Stats object of specified file

    para

    relativePath Relative path

    Parameters

    • relativePath: string

    Returns Stats

filter

  • Filter files

    Parameters

    Returns this

process

  • process(): Promise<this>
  • Process middlewares against files

    Returns Promise<this>

rename

  • rename(fromPath: string, toPath: string): this
  • Parameters

    • fromPath: string
    • toPath: string

    Returns this

source

  • source(patterns: string | string[], options?: SourceOptions): this
  • Find files from specific directory

    Parameters

    • patterns: string | string[]
    • Default value options: SourceOptions = {}

    Returns this

transform

  • Transform file at given path

    Parameters

    Returns Promise<void>

use

  • Use a middleware

    Parameters

    Returns this

writeContents

  • writeContents(relativePath: string, contents: string): this
  • Write contents to specific file

    Parameters

    • relativePath: string

      Relative path

    • contents: string

    Returns this

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc