build-git-clone
v1.0.3
Published
clone repositories in the desired folder, allowing custom commands to be executed within the cloned repository
Downloads
3
Readme
build-git-clone (ts/js)
clone repositories in the desired folder, allowing custom commands to be executed within the cloned repository
Install
npm install --save build-git-clone
Quick Start
import { clone } from 'build-git-clone'
clone('build-git-clone', 'https://github.com/emanuelmoraes-dev/build-git-clone.git')
Import
import { clone, StdioLog } from 'build-git-clone'
API
async function clone (
folder: string,
url: string,
afterCommand: string | null = null,
options: object = {
git = 'git',
stdioInherit = true,
stdoutLog = StdioLog.IncludeShow,
stderrLog = StdioLog.IncludeShow,
internalLog = StdioLog.IncludeShow
}
): Promise<[
(Error | null),
{ stdout: string, stderr: string }
]>
Arguments
- folder: destination folder
- url: repository url
- afterCommand: command to be executed within the cloned repository (optional)
- options: configuration options (optional)
- git: path to git binary (optional)
- stdioInherit: If true, standard input and output ONLY occur (not included in the return) by the terminal that runs the script
- stdoutLog: Defines what should be done with the standard output of the executed commands (optional)
- StdioLog.IncludeShow: Include in the return (stdout) and display in the console.log the standard output of the executed commands
- StdioLog.IncludeSilent: ONLY includes in the return (stdout) the standard output of the executed commands
- StdioLog.Show: ONLY display in the console.log the standard output of the executed commands
- StdioLog.None: Does nothing with standard output from commands executed
- stderrLog: Defines what should be done with the standard error output of the executed commands (optional)
- StdioLog.IncludeShow: Include in the return (stderr) and display in the console.log the standard error output of the executed commands
- StdioLog.IncludeSilent: ONLY includes in the return (stderr) the standard error output of the executed commands
- StdioLog.Show: ONLY display in the console.log the standard error output of the executed commands
- StdioLog.None: Does nothing with standard error output from commands executed
- internalLog: Defines what should be done with the logs generated internally (optional)
- StdioLog.IncludeShow: Include in the return (stdout) and display in the console.log the logs generated internally
- StdioLog.IncludeSilent: ONLY includes in the return (stdout) the logs generated internally
- StdioLog.Show: ONLY display in the console.log the logs generated internally
- StdioLog.None: Does nothing with the logs generated internally
Return
[error, { stdout, stderr }]
- error: Error launched in case of failure.
null
if there was no failure - stdout: Standard output obtained by all commands executed
- stderr: Standard error output obtained by all commands executed