@igor.dvlpr/git-repo-url
TypeScript icon, indicating that this package has built-in type declarations

1.0.3Β β€’Β PublicΒ β€’Β Published

Git Repo URL


🌐 Gets the origin URL of 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

  • πŸ” gets the URL of a local 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/git-repo-url'

🀹🏼 API

getRepoUrl(options?): Promise<string>

Asynchronously gets the URL of a local directory if it 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 the URL if the directory is a Git repository, otherwise an empty string.


getRepoUrlSync(options?): string

Synchronously gets the URL of a local directory if it 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 the URL if the directory is a Git repository, otherwise an empty string.


✨ Examples

example.mts

import { getRepoUrlSync } from '@igor.dvlpr/git-repo-url'

console.log(getRepoUrlSync()) // prints e.g. 'https://github.com/igorskyflyer/npm-duoscribi'

πŸ“ Changelog

πŸ“‘ The changelog is available here: CHANGELOG.md.


πŸͺͺ License

Licensed under the MIT license which is available here, MIT license.


🧬 Related

@igor.dvlpr/recursive-readdir

πŸ“– Provides recursive readdir() and readdirSync() functions. πŸ“


@igor.dvlpr/is-rootdir

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


@igor.dvlpr/vscode-folderpicker

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


@igor.dvlpr/is-git-repo

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


@igor.dvlpr/regkeys

πŸ“š An npm package for fetching Windows registry keys. πŸ—


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

Created by Igor Dimitrijević (@igorskyflyer).

Package Sidebar

Install

npm i @igor.dvlpr/git-repo-url

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

9.4 kB

Total Files

5

Last publish

Collaborators

  • igor.dvlpr