Package Exports
- git-url-parse
- git-url-parse/lib/index.js
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 (git-url-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
git-url-parse
A high level git url parser for common git providers.
☁️ Installation
# Using npm
npm install --save git-url-parse
# Using yarn
yarn add git-url-parse
📋 Example
// Dependencies
const GitUrlParse = require("git-url-parse");
console.log(GitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git"));
// => {
// protocols: []
// , port: null
// , resource: "github.com"
// , user: "git"
// , pathname: "/IonicaBizau/node-git-url-parse.git"
// , hash: ""
// , search: ""
// , href: "git@github.com:IonicaBizau/node-git-url-parse.git"
// , token: ""
// , protocol: "ssh"
// , toString: [Function]
// , source: "github.com"
// , name: "node-git-url-parse"
// , owner: "IonicaBizau"
// }
console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git"));
// => {
// protocols: ["https"]
// , port: null
// , resource: "github.com"
// , user: ""
// , pathname: "/IonicaBizau/node-git-url-parse.git"
// , hash: ""
// , search: ""
// , href: "https://github.com/IonicaBizau/node-git-url-parse.git"
// , token: ""
// , protocol: "https"
// , toString: [Function]
// , source: "github.com"
// , name: "node-git-url-parse"
// , owner: "IonicaBizau"
// }
console.log(GitUrlParse("https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js"));
// { protocols: [ 'https' ],
// protocol: 'https',
// port: null,
// resource: 'github.com',
// user: '',
// pathname: '/IonicaBizau/git-url-parse/blob/master/test/index.js',
// hash: '',
// search: '',
// href: 'https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js',
// token: '',
// toString: [Function],
// source: 'github.com',
// name: 'git-url-parse',
// owner: 'IonicaBizau',
// organization: '',
// ref: 'master',
// filepathtype: 'blob',
// filepath: 'test/index.js',
// full_name: 'IonicaBizau/git-url-parse' }
console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git").toString("ssh"));
// => "git@github.com:IonicaBizau/node-git-url-parse.git"
console.log(GitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString("https"));
// => "https://github.com/IonicaBizau/node-git-url-parse.git"
❓ Get Help
There are few ways to get help:
- Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
- For bug reports and feature requests, open issues. 🐛
- For direct and quick help, you can use Codementor. 🚀
📝 Documentation
gitUrlParse(url)
Parses a Git url.
Params
- String
url
: The Git url to parse.
Return
- GitUrl The
GitUrl
object containing: protocols
(Array): An array with the url protocols (usually it has one element).port
(null|Number): The domain port.resource
(String): The url domain (including subdomains).user
(String): The authentication user (usually for ssh urls).pathname
(String): The url pathname.hash
(String): The url hash.search
(String): The url querystring value.href
(String): The input url.protocol
(String): The git url protocol.token
(String): The oauth token (could appear in the https urls).source
(String): The Git provider (e.g."github.com"
).owner
(String): The repository owner.name
(String): The repository name.ref
(String): The repository ref (e.g., "master" or "dev").filepath
(String): A filepath relative to the repository root.filepathtype
(String): The type of filepath in the url ("blob" or "tree").full_name
(String): The owner and name values in theowner/name
format.toString
(Function): A function to stringify the parsed url into another url type.organization
(String): The organization the owner belongs to. This is CloudForge specific.git_suffix
(Boolean): Whether to add the.git
suffix or not.
stringify(obj, type)
Stringifies a GitUrl
object.
Params
- GitUrl
obj
: The parsed Git url object. - String
type
: The type of the stringified url (defaultobj.protocol
).
Return
- String The stringified url.
😋 How to contribute
Have an idea? Found a bug? See how to contribute.
💖 Support my projects
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
Starring and sharing the projects you like 🚀
—I love books! I will remember you after years if you buy me one. 😁 📖
—You can make one-time donations via PayPal. I'll probably buy a
coffeetea. 🍵—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
Bitcoin—You can send me bitcoins at this address (or scanning the code below):
1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6
Thanks! ❤️
💫 Where is this library used?
If you are using this library in one of your projects, add it in this list. ✨
release-it
documentation
apollo
@backstage/backend-common
@plone/scripts
@atomist/automation-client
@storybook/storybook-deployer
@backstage/integration
@pvm/core
@kadira/storybook-deployer
workspace-tools
gatsby-source-git
@backstage/plugin-catalog-backend
@backstage/plugin-scaffolder-backend
@lerna-lite/core
umi-build-dev
@nuxt/telemetry
@era-ci/utils
@atomist/automation-client-ext-raven
git-source
semantic-release-gitmoji
@qiwi/semantic-release-gh-pages-plugin
@atomist/sdm-pack-analysis
apify-shared
@git-stack/server-core
remax-stats
strapi-generate-new
common-boilerplate
renovate
@backstage/plugin-techdocs-node
@s-ui/studio
@instructure/ui-scripts
@appworks/project-utils
@jswork/next-git-url
@umijs/block-sdk
@lerna/github-client
@micro-app/shared-utils
@oumi/block-sdk
@radjs/block-sdk
@wetrial/block-sdk
datoit-generate-new
@appirio/appirio
@backstage/plugin-techdocs
@log4brains/core
@xdn/cli
@atomist/skill
@koumoul/gh-pages-multi
@zeplin/cli
@pvm/gitlab
@atomist/cli
@brisk-docs/gatsby-generator
@microservices/cli
@vamsikc/plugin-catalog
hzero-block-sdk
@spryker-lerna/github-client
gitbook-start-plugin-iaas-ull-es-noejaco2017
omg
clipped
fotingo
git-issues
@stackbit/dev-common
@guardian/cdk
lambda-service
octokit-downloader
stylelint-formatter-utils
sync-repos
@enkeledi/react-native-week-month-date-picker
copy-github-directory
@kevinbds/techdocs-common
docula-ui
@s-ui/mono
@facadecompany/ignition-ui
@focusworkstemp/project-utils
@git-stack/hemera-plugin
@jaredpalmer/workspace-tools
@unibtc/release-it
scaffolder-core
testarmada-midway
autorelease-setup
@geut/git-url-parse
@erquhart/lerna-github-client
@oumi/cli-ui
wiby
sherry-utils
changelog.md
@yarnpkg/plugin-git
@pubbo/github-client
@sanv/apify-shared
@0x-lerna-fork/github-client
@atomist/uhura
@pmworks/project-utils
@feizheng/next-git-url
@hygiene/plugin-github-url
@iceworks/project-utils
gcpayz-block-sdk
generator-clearphp
documentation-custom-markdown
@antv/gatsby-theme-antv
@backstage/plugin-scaffolder
@scafflater/scafflater
@brisk-docs/website
@buschtoens/documentation
@dandean/storybook-deployer
@emedvedev/renovate
@dougkulak/semantic-release-gh-pages-plugin
@hemith/react-native-tnk
@hugomrdias/documentation
@pageshare/cli
@merna/github-client
@lerna-test-v1/markdown
@jswork/topics2keywords
@pvdlg/semantic-release
@rianfowler/backstage-backend-common
auto-changelog-vsts
@deskbtm/workspace-tools
debone
cz-conventional-changelog-befe
create-apex-js-app
gatsby-source-git-remotes
gatsby-source-npmjs
flutter-boot
fster
gatsby-theme-zh
git-service-node
git-origin-check
git-yoink
harry-reporter
jsnix
kef-core
konitor
laborious
l-other-data
lime-cli
npm_one_1_2_3
miguelcostero-ng2-toasty
mdnext-loader
native-kakao-login
open-pull-request
rn-adyen-dropin
simple-github-release
snipx
react-native-contact-list
react-native-biometric-authenticate
react-native-arunmeena1987
react-native-is7
react-native-kakao-maps
react-native-my-first-try-arun-ramya
react-native-payu-payment-testing
quinntainer
qts-fission
react-native-ytximkit
release-it-http
spk
@mmomtchev/documentation
tooling-personal
todo2issue
vuepress-plugin-remote-url
tmplr
gitlab-ci-variables-cli
gtni
gitc
gitbook-start-iaas-bbdd-alex-moi
gitbook-start-iaas-ull-es-merquililycony
lcov-server
@cliz/gpm
docula-ui-express
prep-barv11
@axetroy/gpm
@belt/repo
belt-repo
@geut/git-compare-template
@gasket/plugin-metrics
cover-builder
@positionex/position-sdk
ewizard-cli
@1coin178/github-compare
@arcanis/sherlock
@cilyn/bitbucket
@corelmax/react-native-my2c2p-sdk
@csmith/release-it
@esops/publish-github-pages
@felipesimmi/react-native-datalogic-module
@narfeta/catalog-backend
@hawkingnetwork/react-native-tab-view
@infinitecsolutions/storybook-deployer
@pipelinedoc/cli
ftl-renovate
gatsby-theme-cone
gatsby-theme-nestx
generate-github-directory
git-url-promise
git-observer
github-action-readme
coc-discord-rpc
@xyz/create-package
@theowenyoung/gatsby-source-git
@voodeng/uppacks
bitbucket-pullr
configorama
drowl-base-theme-iconset
dx-scanner
native-apple-login
react-native-cplus
npm_qwerty
patchanon-cli
pbc
wsj.gatsby-source-git
semantic-release-github-milestones
tldw
react-native-arunjeyam1987
publish-version
generator-openapi-repo
github-publish-npm
pr-log
complan
@shopgate/pwa-releaser
react-native-bubble-chart
@geut/chan-parser
@evanpurkhiser/tooling-personal
@blackglory/git-list
nmrium-cli
github-assistant
@tmplr/node
react-native-flyy
@stackbit/cli
@edgio/cli
@react-18-pdf/root
@wekanteam/documentation
@1nd/documentation
@amorist/gatsby-theme-antd
@apardellass/react-native-audio-stream
@campus-online/gatsby-source-git
@carrotwu/wcli
@docomodigital/pdor
@cyber-tools/cyber-npm
@cratosw/gatsby-antd
@domestika/mono
@git-stack/module-server
@geeky-apo/react-native-advanced-clipboard
@lerna-test-v1/git
@patrickhulce/scripts
@saad27/react-native-bottom-tab-tour
@tjmonsi/generator-uplb-hci-lab-project-template
@tjmonsi/generator-project-template
@vicoders/cli2
@voodeng/archive
auto-clone
aral-vps-test
cirodown
candlelabssdk
canarist
@tagoro9/git
committing
detect-node-support
gatsby-theme-art-graph
generator-bootstrap-boilerplate-template
gatsby-theme-cone-oc
@turborepo/workspace-tools
git-imitate
github-books
git-upstream
react-native-dsphoto-module
react-native-responsive-size
react-native-sayhello-module
learning-journal-ci
just-dev-sdk
meta-release
nixitech_cli
openapi-repo-generator
npm_one_12_34_1_
npm_one_2_2
payutesting
sn-flutter-boot
umi-plugin-repo
wp-continuous-deployment
@axetroy/git-clone
branch-release
semantic-release-telegram
gatsby-theme-iot
download-repo-cli
gd-cli
gitbook-start-iaas-ull-es-alex-moi
gitline
documentation-markdown-themes
@con-test/react-native-concent-common
yarn-upgrade-on-ci
@dvcorg/cml
react-native-shekhar-bridge-test
react-feedback-sdk
@oiti/documentoscopy-react-native
generate-preview
@pvm/github
@kb-sanity/proto-kb-plugin
@stagas/documentation-fork
@jupiterone/graph-checkmarx
@gogogosir/build-cli
@backstage/plugin-techdocs-module-addons-contrib
@layer0/cli
@activeviam/documentation
@mayahq/mayadev
@pagedip/tool-autorelease
@elestu/actions-dependacop
@epranka/create-tsx-package
@githubtraining/github-exercise-manager
@hnp/package-scripts
@hjin/generator-app
@stavalfi/ci
birken-react-native-community-image-editor
cetus-cli
@shushuer/cli
create-release-it
create-sourcegraph-extension
gatsby-theme-hansin
git-multi-profile
gitlab-tool-cli
luojia-cli-dev
mdxbook
myrenobatebot
node-norman
reac-native-arun-ramya-test
react-native-plugpag-wrapper
react-native-pulsator-native
react-native-arun-ramya-test
react-native-arunramya151
react-native-transtracker-library
@s-ui/changelog
vscode-gpm
sinanews-flutter-boot
vuepress-theme-next
bridgewwater-cli
@kevinbds/plugin-techdocs
@wpbrothers/sbcli
@alitajs/block-sdk
ourbigbook
ci-yarn-upgrade
bibi
gitbook-start-https-alex-moi
mira
moto-connector
nodeschool-admin
ogh
one-more-gitlab-cli
ship-release
ssh-remote
strapper
@jfilipe-sparta/react-native-module_2
@rocket.chat/houston
@saleor/cli
cogoportutils
airbyte-faros-destination
release2hub
cc-flow
kube-workflow
@backstage/plugin-catalog-import
@cythral/renovate
@epranka/create-package
@generates/kdot
@georgs/beachball
@limejs/cli
@bcgov/gatsby-source-github-raw
@atomist/ci-sdm
@makepad/puppeteer-cli
@mockswitch/cli
@rescribe/cli
@pubcore/node-docker-build
@reshiftsecurity/reshift-plugin-npm
@tahini/nc
@senti-techlabs/generator-senti-project-template
@whey/gatsby-theme-whey
@zpmpkg/zpm
@zalando-backstage/plugin-catalog
air-material_cli
actions-package-update
angularvezba
aral-server
astra-ufo-sdk
blog-flutter-boot
react-native-syan-photo-picker
@wecraftapps/react-native-use-keyboard
documentation-fork
documentation42
create-n
gatsby-source-github-raw
git-csv
git-cherry-fix
git-push-pr
kit-command
l2forlerna
next-mdx-books
myrenovatebot
native-google-login
private-beachball
raact-native-arunramya151