JSPM

@igor.dvlpr/is-git-repo

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16114F
  • License MIT

🐸 Checks if a directory is a local Git repository. πŸ•ΆοΈ

Package Exports

  • @igor.dvlpr/is-git-repo
  • @igor.dvlpr/is-git-repo/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@igor.dvlpr/is-git-repo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Is Git repo?


🐸 Checks if a directory is a local Git repository. πŸ•ΆοΈ



πŸ’– Support further development

I work hard for every project, including this one
and your support means a lot to me!

Consider buying me a coffee. β˜•
Thank you for supporting my efforts! πŸ™πŸ˜Š


Donate to igorskyflyer

@igorskyflyer




πŸ“ƒ 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.


@igor.dvlpr/vscode-folderpicker

✨ Provides a custom Folder Picker API + UI for Visual Studio Code. 🎨


@igor.dvlpr/git-repo-url

🌐 Gets the origin URL a local Git repository. πŸ—ΊοΈ


@igor.dvlpr/is-rootdir

πŸ”Ό Provides a way to check if the given path is the root drive/directory. β›”


@igor.dvlpr/str-is-in

🧡 Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. πŸ”


@igor.dvlpr/chars-in-string

πŸͺ Provides ways of testing whether an array of chars is present inside a given String. β˜„


πŸ‘¨πŸ»β€πŸ’» Author

Created by Igor Dimitrijević (@igorskyflyer).