Options
All
  • Public
  • Public/Protected
  • All
Menu

Local project using git. Provides the ability to perform git operations such as commit, and to set and push to a remote.

Hierarchy

Implemented by

Index

Properties

baseDir

baseDir: string

branch

branch: string

id

name

name: string

newRepo

newRepo: boolean

Optional provenance

provenance: string

For debugging: how was this project created?

release

Release any locks held

remote

remote: string

Methods

add

  • add(f: File): Promise<this>

addDirectory

  • addDirectory(path: string): Promise<this>
  • Add an empty directory to the project. Should be preserved through all transformations, although may not be accessible in some implementations.

    Parameters

    • path: string

      path to directory relative to root of project

    Returns Promise<this>

addFile

  • addFile(path: string, content: string): Promise<this>
  • Add the given file to the project. Path can be nested. Content is a literal string.

    Parameters

    • path: string

      path to file relative to root of project

    • content: string

      The content to be placed in the new file

    Returns Promise<this>

addFileSync

  • addFileSync(path: string, content: string): void
  • Add the given file to the project. Path can be nested. Content is a literal string. This method will throw an error if it is not successful.

    Parameters

    • path: string

      path to file relative to root of project

    • content: string

      The content to be placed in the new file

    Returns void

checkout

  • checkout(sha: string): Promise<this>
  • Check out a particular commit. We'll end in detached head state

    Parameters

    • sha: string

      sha or branch identifier

    Returns Promise<this>

commit

  • commit(message: string): Promise<this>

configureFromRemote

  • configureFromRemote(): Promise<this>
  • Sets the user config by using GitHub user information. Make sure to use a token that has user scope.

    Returns Promise<this>

createAndSetRemote

  • createAndSetRemote(gid: RemoteRepoRef, description: string, visibility: "private" | "public"): Promise<this>

createBranch

  • createBranch(name: string): Promise<this>

deleteDirectory

  • deleteDirectory(path: string): Promise<this>
  • Recursively delete a directory and all its contents. Path can be nested. Errors when deleting the directory do not result in a rejected Promise being returned.

    Parameters

    • path: string

      path to directory relative to root of project

    Returns Promise<this>

deleteDirectorySync

  • deleteDirectorySync(path: string): void
  • Recursively deletes a directory and all its contents with the given path. Errors when deleting the directory are caught.

    Parameters

    • path: string

      path to directory relative to root of project

    Returns void

deleteFile

  • deleteFile(path: string): Promise<this>
  • Delete the given file from the project. Path can be nested. Errors when deleting the file do not result in a rejected Promise being returned.

    Parameters

    • path: string

      path to file relative to root of project

    Returns Promise<this>

deleteFileSync

  • deleteFileSync(path: string): void
  • Delete the given file from the project. Path can be nested. Errors when deleting the file are caught.

    Parameters

    • path: string

      path to file relative to root of project

    Returns void

directoryExistsSync

  • directoryExistsSync(path: string): boolean

fileExistsSync

  • fileExistsSync(path: string): boolean
  • Does a regular file with the given path exist? It will return false if the file does not exist or is not a regular file.

    Parameters

    • path: string

      path to file relative to root of project

    Returns boolean

findFile

  • findFile(path: string): Promise<File>
  • Attempt to find a regular file at path. This method will return a rejected Promise if the file does not exist or is not a regular file. You may well want getFile, which returns a Promise of the file or undefined.

    Parameters

    • path: string

      path to file relative to root of project

    Returns Promise<File>

findFileSync

  • findFileSync(path: string): File
  • Find a regular file with the given path. Return undefined if file does not exist or is not a regular file.

    Parameters

    • path: string

      path to file relative to root of project

    Returns File

getFile

  • getFile(path: string): Promise<File | undefined>
  • Attempt to find a regular file at path. Never throws an exception, returns undefined if file does not exist or is not a regular file.

    Parameters

    • path: string

      path to file relative to root of project

    Returns Promise<File | undefined>

gitStatus

hasBranch

  • hasBranch(name: string): Promise<boolean>

hasDirectory

  • hasDirectory(path: string): Promise<boolean>
  • Does a directory exist at this path? It will return false if directory does not exist or if file at path is not a directory.

    Parameters

    • path: string

      path to directory relative to root of project

    Returns Promise<boolean>

hasFile

  • hasFile(path: string): Promise<boolean>
  • Does a regular file exist at this path? It will return false for non-existent files, directories, block devices, FIFOs, sockets, etc.

    Parameters

    • path: string

      path to file relative to root of project

    Returns Promise<boolean>

init

  • init(): Promise<this>

isClean

  • isClean(): Promise<boolean>

makeExecutable

  • makeExecutable(path: string): Promise<this>

makeExecutableSync

  • makeExecutableSync(path: string): void

moveFile

  • moveFile(oldPath: string, newPath: string): Promise<this>

push

raisePullRequest

  • raisePullRequest(title: string, body: string, targetBranch?: string): Promise<this>
  • Raise a PR after a push to this branch

    Parameters

    • title: string
    • body: string
    • Optional targetBranch: string

    Returns Promise<this>

revert

  • revert(): Promise<this>

setRemote

  • setRemote(remote: string): Promise<this>

setUserConfig

  • setUserConfig(user: string, email: string): Promise<this>

streamFiles

  • streamFiles(...globPatterns: string[]): FileStream
  • Return a node stream of the files in the project meeting the given path criteria. Uses default exclusions in the glob path.

    Parameters

    • Rest ...globPatterns: string[]

      glob patterns per minimatch

    Returns FileStream

streamFilesRaw

  • streamFilesRaw(globPatterns: string[], opts: __type): FileStream

totalFileCount

  • totalFileCount(): Promise<number>

Generated using TypeDoc