@igor.dvlpr/is-git-repo v1.0.2
π Table of contents
π€ Features
- π checks if a directory is a Git repo
- β both async and sync methods supported
- π½ cross-platform
- βοΈ lightweight
π΅πΌ Usage
!WARNING This module requires that the
git
executable is installed and available in the system path.If not, it needs to be installed first.
Install the module by executing:
npm i '@igor.dvlpr/is-git-repo'
π€ΉπΌ API
isGitRepo(options?): Promise<boolean>
Asynchronously checks if a local directory is a Git repository.
options
- Optional object with options:
directory
- Sets the current working directory, otherwise the current directory will be used instead.
Will throw an error if the passed directory is not valid or does not exist.
Returns a Boolean indicating whether provided local directory is a Git repository.
isGitRepoSync(options?): boolean
Synchronously checks if a local directory is a Git repository.
options
- Optional object with options:
directory
- Sets the current working directory, otherwise the current directory will be used instead.
Will throw an error if the passed directory is not valid or does not exist.
Returns a Boolean indicating whether provided local directory is a Git repository.
β¨ Examples
example.mts
import { isGitRepoSync } from '@igor.dvlpr/is-git-repo'
console.log(isGitRepoSync({ directory: '../my-git-project' })) // true
π Changelog
π The changelog is available here: CHANGELOG.md.
πͺͺ License
Licensed under the MIT license which is available here, MIT license.
𧬠Related
@igor.dvlpr/vscode-folderpicker
β¨ Provides a custom Folder Picker API + UI for Visual Studio Code. π¨
π Gets the origin URL a local Git repository. πΊοΈ
πΌ Provides a way to check if the given path is the root drive/directory. β
π§΅ Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. π
πͺ Provides ways of testing whether an array of chars is present inside a given String. β
π¨π»βπ» Author
Created by Igor DimitrijeviΔ (@igorskyflyer).