@igor.dvlpr/git-repo-url
v1.0.3
Published
🌐 Gets the origin URL a local Git repository. 🗺️
Downloads
1
Maintainers
Readme
📃 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
📖 Provides recursive readdir() and readdirSync() functions. 📁
🔼 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. 🎨
🐸 Checks if a directory is a local Git repository. 🕶️
📚 An npm package for fetching Windows registry keys. 🗝
👨🏻💻 Author
Created by Igor Dimitrijević (@igorskyflyer).