This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-19 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
Copyright (c) 2015-21 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+437 -81
View File
@@ -1,16 +1,54 @@
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
[![git-url-parse](http://i.imgur.com/HlfMsVf.png)](#)
# git-url-parse
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Travis](https://img.shields.io/travis/IonicaBizau/git-url-parse.svg)](https://travis-ci.org/IonicaBizau/git-url-parse/) [![Version](https://img.shields.io/npm/v/git-url-parse.svg)](https://www.npmjs.com/package/git-url-parse) [![Downloads](https://img.shields.io/npm/dt/git-url-parse.svg)](https://www.npmjs.com/package/git-url-parse) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
> A high level git url parser for common git providers.
## :cloud: Installation
```sh
@@ -22,6 +60,17 @@ yarn add git-url-parse
```
## :clipboard: Example
@@ -96,17 +145,28 @@ console.log(GitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toS
## :question: Get Help
There are few ways to get help:
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
2. For bug reports and feature requests, open issues. :bug:
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
## :memo: Documentation
@@ -153,12 +213,22 @@ Stringifies a `GitUrl` object.
## :yum: How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].
## :sparkling_heart: 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).
@@ -177,99 +247,385 @@ However, if you get some profit from this or just want to encourage me to contin
Thanks! :heart:
## :dizzy: Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:
- `release-it`
- `documentation`
- `apollo`
- `@atomist/automation-client`
- `@storybook/storybook-deployer`
- `@backstage/backend-common`
- `@backstage/integration`
- `@kadira/storybook-deployer`
- `gatsby-source-git`
- `umi-build-dev`
- `@era-ci/utils`
- `@atomist/automation-client-ext-raven`
- `workspace-tools`
- `apify-shared`
- `strapi-generate-new`
- `@nuxt/telemetry`
- `semantic-release-gitmoji`
- `git-source`
- `@qiwi/semantic-release-gh-pages-plugin`
- `@git-stack/server-core`
- `@atomist/sdm-pack-analysis`
- `@lerna/github-client`
- `common-boilerplate`
- `@backstage/plugin-catalog`
- `renovate`
- `@umijs/block-sdk`
- `@appirio/appirio`
- `@s-ui/studio`
- `@instructure/ui-scripts`
- `@wetrial/block-sdk`
- `hzero-block-sdk`
- `remax-stats`
- `@feizheng/next-git-url`
- `@radjs/block-sdk`
- `@log4brains/core`
- `scaffolder-core`
- `@xdn/cli`
- `query-registry`
- `@appworks/project-utils`
- `beachball`
- `@oumi/block-sdk`
- `@zeplin/cli`
- `@backstage/techdocs-common`
- `@atomist/skill`
- `@backstage/plugin-scaffolder-backend`
- `@backstage/plugin-catalog-backend`
- `@micro-app/shared-utils`
- `gitbook-start-plugin-iaas-ull-es-noejaco2017`
- `autorelease-setup`
- `documentation-custom-markdown`
- `@hygiene/plugin-github-url`
- `sherry-utils`
- `@unibtc/release-it`
- `clipped`
- `@erquhart/lerna-github-client`
- `@0x-lerna-fork/github-client`
- `docula-ui`
- `@brisk-docs/gatsby-generator`
- `@microservices/cli`
- `stylelint-formatter-utils`
- `omg`
- `@facadecompany/ignition-ui`
- `@temporg/rds-scripts`
- `@git-stack/hemera-plugin`
- `@vamsikc/plugin-catalog`
- `@pubbo/github-client`
- `@jaredpalmer/workspace-tools`
- `@iceworks/project-utils`
- `sync-repos`
- `@sanv/apify-shared`
- `@atomist/cli`
- `@atomist/uhura`
- `lambda-service`
- `@s-ui/mono`
- `fotingo`
- `@yarnpkg/plugin-git`
- `wiby`
- `generator-clearphp`
- `@oumi/cli-ui`
- `@koumoul/gh-pages-multi`
- `@pmworks/project-utils`
- `@geut/git-url-parse`
- `@strapi/generate-new`
- `@backstage/plugin-techdocs`
- `@backstage/plugin-scaffolder`
- `committing`
- `gitbook-start-https-alex-moi`
- `gitbook-start-iaas-ull-es-merquililycony`
- `proyecto-sytw-alex-moi`
- `gitbook-start-iaas-ull-es-alex-moi`
- `gitbook-start-iaas-bbdd-alex-moi`
- `complan`
- `@axetroy/git-clone`
- `generator-cleanphp`
- `@axetroy/gpmx`
- `generator-ckeditor4`
- `documentation-habitlab`
- `nodeschool-admin`
- `one-more-gitlab-cli`
- `def-core`
- `gd-cli`
- `node-coverage-server`
- `strapper`
- `github-publish-npm`
- `ogh`
- `sinit`
- `smart-clone`
- `download-repo-cli`
- `generator-nm-bti`
- `gitc`
- `gitline`
- `gitlab-ci-variables-cli`
- `gitlab-ci-variables-setter-cli`
- `documentation-fork`
- `@axetroy/gpm`
- `generator-openapi-repo`
- `git-url-promise`
- `kef-core`
- `@pvdlg/semantic-release`
- `gitlab-tool-cli`
- `snipx`
- `yarn-upgrade-on-ci`
- `@hjin/generator-app`
- `@reframe/github-pages`
- `belt-repo`
- `@esops/publish-github-pages`
- `@hugomrdias/documentation`
- `just-dev-sdk`
- `@activeviam/documentation`
- `git-signed`
- `cz-conventional-changelog-befe`
- `@voodeng/archive`
- `@voodeng/uppacks`
- `create-apex-js-app`
- `auto-changelog-vsts`
- `@campus-online/gatsby-source-git`
- `gtni`
- `ci-yarn-upgrade`
- `openapi-repo-generator`
- `git-imitate`
- `vscode-gpm`
- `documentation42`
- `@limejs/cli`
- `lime-cli`
- `laborious`
- `release-it-http`
- `bibi`
- `lcov-server`
- `create-release-it`
- `git-service-node`
- `@infinitecsolutions/storybook-deployer`
- `@1nd/documentation`
- `git-cherry-fix`
- `vuepress-plugin-remote-url`
- `gatsby-source-github-raw`
- `moto-connector`
- `@zpmpkg/zpm`
- `konitor`
- `release2hub`
- `@geut/git-compare-template`
- `@geut/chan-parser`
- `git-observer`
- `docula-ui-express`
- `sn-flutter-boot`
- `spk`
- `umi-plugin-repo`
- `@epranka/create-tsx-package`
- `flutter-boot`
- `node-norman`
- `remote-commit-url`
- `air-material_cli`
- `@belt/repo`
- `@dandean/storybook-deployer`
- `git-upstream`
- `@cratosw/gatsby-antd`
- `@tjmonsi/generator-uplb-hci-lab-project-template`
- `gatsby-theme-hansin`
- `generate-preview`
- `@temporg/ui-scripts`
- `bitbucket-pullr`
- `@whey/gatsby-theme-whey`
- `@docomodigital/pdor`
- `auto-clone`
- `aral-server`
- `gatsby-source-git-remotes`
- `@amorist/gatsby-theme-antd`
- `@stavalfi/ci`
- `@apardellass/react-native-audio-stream`
- `gatsby-theme-cone`
- `changelog.md`
- `wp-continuous-deployment`
- `l2forlerna`
- `@cilyn/bitbucket`
- `react-native-plugpag-wrapper`
- `meta-release`
- `git-csv`
- `ship-release`
- `ssh-remote`
- `react-native-pulsator-native`
- `@epranka/create-package`
- `@csmith/release-it`
- `cetus-cli`
- `react-native-kakao-maps`
- `configorama`
- `@geeky-apo/react-native-advanced-clipboard`
- `native-apple-login`
- `native-google-login`
- `@tahini/nc`
- `@hemith/react-native-tnk`
- `@pagedip/tool-autorelease`
- `react-native-contact-list`
- `branch-release`
- `@corelmax/react-native-my2c2p-sdk`
- `wsj.gatsby-source-git`
- `@pubcore/node-docker-build`
- `cc-flow`
- `git-origin-check`
- `gatsby-source-npmjs`
- `@git-stack/module-server`
- `@jswork/topics2keywords`
- `actions-package-update`
- `github-action-readme`
- `@rescribe/cli`
- `react-native-responsive-size`
- `@gvhinks/wiby`
- `mdnext-loader`
- `next-mdx-books`
- `mdxbook`
- `ftl-renovate`
- `@emedvedev/renovate`
- `create-sourcegraph-extension`
- `@hnp/package-scripts`
- `react-native-test-module-hhh`
- `git-multi-profile`
- `react-native-is7`
- `@s-ui/changelog`
- `generate-github-directory`
- `create-n`
- `@wpbrothers/sbcli`
- `@turborepo/workspace-tools`
- `learning-journal-ci`
- `@arcanis/sherlock`
- `@carrotwu/wcli`
- `@zalando-backstage/plugin-catalog`
- `mira`
- `github-assistant`
- `@vicoders/cli2`
- `patchanon-cli`
- `gatsby-theme-zh`
- `@gasket/plugin-metrics`
- `myrenobatebot`
- `myrenovatebot`
- `@buganto/client`
- `@patrickhulce/scripts`
- `gatsby-theme-nestx`
- `kit-command`
- `@datalogic/react-native-datalogic-module`
- `@pipelinedoc/cli`
- `@atomist/ci-sdm`
- `@cyber-tools/cyber-npm`
- `canarist`
- `pbc`
- `@1coin178/github-compare`
- `@elestu/actions-dependacop`
- `@senti-techlabs/generator-senti-project-template`
- `@lerna-test-v1/git`
- `git-lab-cli`
- `birken-react-native-community-image-editor`
- `sinanews-flutter-boot`
- `detect-node-support`
- `nmrium-cli`
- `fster`
- `@tagoro9/git`
- `native-kakao-login`
- `github-books`
- `blog-flutter-boot`
- `@bcgov/gatsby-source-github-raw`
- `@rianfowler/backstage-backend-common`
- `react-native-modal-progress-bar`
- `@lerna-test-v1/markdown`
- `dx-scanner`
- `harry-reporter`
- `tldw`
- `react-native-dsphoto-module`
- `@brisk-docs/website`
- `@hawkingnetwork/react-native-tab-view`
- `miguelcostero-ng2-toasty`
- `aral-vps-test`
- `@wolfe-labs/du-luac`
- `drowl-base-theme-iconset`
- `@shopgate/pwa-releaser`
- `rn-custom-tabview`
- `@theowenyoung/gatsby-source-git`
- `@apify/git`
- `git-yoink`
- `@makepad/puppeteer-cli`
- `@flareapp/ignition-ui`
- `jsnix`
- `@rocket.chat/houston`
- `@generates/kdot`
- `@felipesimmi/react-native-datalogic-module`
- `tooling-personal`
- `publish-version`
- `@dvcorg/cml`
- `cirodown`
- `semantic-release-telegram`
- `bridgewwater-cli`
- `git-push-pr`
- `@reshiftsecurity/reshift-plugin-npm`
- `temp-gatsby-theme`
- `@evanpurkhiser/tooling-personal`
- `@cythral/renovate`
- `@domestika/mono`
- `vuepress-theme-next`
- `documentation-markdown-themes`
- `@s-ui/ssr`
- `@alitajs/block-sdk`
- `coc-discord-rpc`
- `@dougkulak/semantic-release-gh-pages-plugin`
- `@guardian/cdk`
- `react-native-flyy`
- `@oat-sa/tao-extension-release`
- `@antv/gatsby-theme-antv`
- `@stackbit/cli`
- `@myetherwallet/mew-components`
- `rocali-apollo`
- `copy-github-directory`
- `@githubtraining/github-exercise-manager`
- `create-strapi-starter`
- `@backstage/plugin-catalog-import`
- `lage`
- `@layer0/cli`
- `pr-log`
- `git-issues`
- [`auto-changelog-vsts`](https://github.com/denisonluz/auto-changelog-vsts) (by Pete Cook)—Command line tool for generating a changelog from git tags and commit history
- [`autorelease-setup`](https://github.com/tyler-johnson/autorelease-setup#readme) (by Tyler Johnson)—A CLI tool for setting up a repository with autorelease.
- [`belt-repo`](https://npmjs.com/package/belt-repo) (by ewnd9)—repo module for belt
- [`bibi`](https://github.com/steelbrain/bibi#readme) (by steelbrain)—A repository management tool
- [`bitbucket-pullr`](https://github.com/julien-langlois/bitbucket-pr#readme) (by Julien Langlois)—CLI for creating Bitbucket pull request
- [`branch-release`](https://github.com/RomanGotsiy/branch-release#readme) (by Roman Hotsiy)—Build and tag package realease on a separate branch
- [`changelog.md`](https://github.com/egoist/changelog.md#readme) (by EGOIST)—Manage CHANGELOG.md so easy it hurts.
- [`ci-yarn-upgrade`](https://github.com/taichi/ci-yarn-upgrade) (by taichi)—Keep NPM dependencies up-to-date with CI, providing version-to-version diff for each library
- [`clipped`](https://github.com/clippedjs/clipped#readme) (by IniZio)—Reduce pain of configuration to once
- [`committing`](https://github.com/axetroy/committing#readme) (by Axetroy)—commit every days
- [`common-boilerplate`](https://github.com/node-modules/common-boilerplate#readme) (by TZ)—base class for boilerplate
- [`complan`](https://github.com/pranavparikh/complan#readme) (by Pranav Parikh)—COMPLexity ANalyzer Tool For Javascript
- [`create-apex-js-app`](https://github.com/dfrechdev/create-apex-js-app#readme) (by Daniel Frech)—Bootstrap a JavaScript app for Oracle APEX applications
- [`create-openapi-repo`](https://github.com/Rebilly/generator-openapi-repo#readme) (by Roman Hotsiy)—Generator of OpenAPI(fka Swagger) repository
- [`create-sourcegraph-extension`](https://github.com/sourcegraph/create-extension#readme)—CLI to generate the skeleton for a Sourcegraph extension
- [`cz-conventional-changelog-befe`](https://github.com/be-fe/cz-conventional-changelog-befe#readme) (by teeeemoji)—cz adaptor for baidu BEFE
- [`def-core`](https://npmjs.com/package/def-core) (by tbfed)—def core for deflite
- [`docula-ui`](https://npmjs.com/package/docula-ui)—Express.js bindings for Docula project
- [`docula-ui-express`](https://npmjs.com/package/docula-ui-express)—Express.js bindings for Docula project
- [`documentation`](https://github.com/documentationjs/documentation#readme) (by Tom MacWright)—a documentation generator
- [`documentation-custom-markdown`](https://npmjs.com/package/documentation-custom-markdown) (by Tom MacWright)—a documentation generator
- [`documentation-fork`](https://github.com/documentationjs/documentation#readme) (by Tom MacWright)—a documentation generator
- [`documentation-habitlab`](https://github.com/documentationjs/documentation#readme) (by Tom MacWright)—a documentation generator
- [`download-repo-cli`](https://github.com/egoist/download-repo-cli#readme) (by EGOIST)—CLI tool to download GitHub repo.
- [`gd-cli`](https://npmjs.com/package/gd-cli) (by Sylvain Baronnet)—GD Command Line Interface
- [`generate-preview`](https://github.com/citizensas/generate-preview#readme) (by Sassoun Derderian)—Get a preview from a git branch before publishing your npm package
- [`generator-ckeditor4`](https://github.com/mlewand/generator-ckeditor4#readme) (by Marek Lewandowski)—Yeoman generator for CKEditor 4
- [`generator-clearphp`](https://github.com/jkphl/generator-clearphp#readme) (by Joschi Kuphal)—Scaffold for Composer based PHP projects with a lot of integrations, advocating the use of The Clear Architecture (https://jkphl.is/articles/clear-architecture-php)
- [`generator-nm-bti`](https://gitlab.com/beneaththeink/generator-nm-bti#README) (by Tyler Johnson)—Scaffold out a node module, Beneath the Ink style.
- [`generator-openapi-repo`](https://github.com/Rebilly/generator-openapi-repo#readme) (by Roman Hotsiy)—Yeoman generator for OpenAPI(fka Swagger) repo to help you share spec for your API
- [`git-cherry-fix`](https://npmjs.com/package/git-cherry-fix)—> helps you get your fixes to another branch by cherry-picking them
- [`git-issues`](https://github.com/softwarescales/git-issues) (by Gabriel Petrovay)—Git issues extension to list issues of a Git project
- [`git-lab-cli`](https://npmjs.com/package/git-lab-cli)—gitlab-cli ==================
- [`git-signed`](https://github.com/Wizcorp/git-signed#readme) (by Marc Trudel)—git commit signing made easy (and enforceable)
- [`git-source`](https://github.com/IonicaBizau/git-source#readme)—Parse and stringify git urls in a friendly way.
- [`git-upstream`](https://github.com/Leko/git-upstream#readme) (by Leko)—Utility to set the remote "upstream" on forked repository
- [`git-url-promise`](https://github.com/joshuan/git-url#readme) (by Evgeniy Shershnev)—Git url promise
- [`gitbook-start-https-alex-moi`](https://github.com/ULL-ESIT-SYTW-1617/https-al-servidor-del-libro-alex-moi.git#readme) (by Moises Yanes Carballo)—Plugin deploy iaas https
- [`gitbook-start-iaas-bbdd-alex-moi`](https://github.com/ULL-ESIT-SYTW-1617/practica-localstrategy-y-base-de-datos-alex-moi.git#readme) (by Moises Yanes Carballo)—Plugin deploy iaas bbdd
- [`gitbook-start-iaas-ull-es-alex-moi`](https://github.com/ULL-ESIT-SYTW-1617/gitbook-start-iaas-ull-es-alex-moi.git#readme) (by Moises Yanes Carballo)—Plugin deploy maquina iaas-ull-es
- [`gitbook-start-iaas-ull-es-merquililycony`](https://github.com/ULL-ESIT-SYTW-1617/gitbook-start-iaas-ull-es-merquililycony#readme) (by Constanza León, Merquis Cruz, Liliana Galiano)—*El objetivo de esta práctica es extender el package NodeJS publicado en npm en una práctica anterior con una nueva*
*funcionalidad que permita que los usuarios realizar un despliegue automatico en el servidor de IAAS*
- [`gitbook-start-plugin-iaas-ull-es-noejaco2017`](http://creacion-de-paquetes-y-modulos-en-nodejs-noejaco2017/README.md) (by alu0100622492)—Despliegue plugin Iaas
- [`gitc`](https://github.com/cezarlz/gitc#readme) (by Cezar Luiz)—Manage your pull requests and issues from your command line.
- [`github-publish-npm`](https://github.com/ofersadgat/github-publish-npm) (by Ofer Sadgat)—This will upload publish npm assets to the GitHub Releases API.
- [`gitlab-ci-variables-cli`](https://github.com/temando/gitlab-ci-variables-cli#readme) (by Khoa Tran)—CLI tool to set/get pipeline variables on Gitlab CI.
- [`gitlab-tool-cli`](https://npmjs.com/package/gitlab-tool-cli)—gitlab-tool-cli ==================
- [`gitline`](https://github.com/cezarlz/gitline#readme) (by Cezar Luiz)—Manage your pull requests and issues from your command line.
- [`gtni`](https://nmrony.github.io/gtni) (by Nur Rony)—Install your all npm dependencies recursively with gtni while you are doing git clone, fetch or pull
- [`gub`](https://github.com/janryWang/gub#readme) (by janry)—> 接入成本极低,快速从原有项目(可运行项目)中clone出新项目,并重写package.json,安装依赖
- [`harry-reporter`](https://github.com/harry-reporter/harry-reporter#readme)—Reporter plugin for hermione
- [`just-dev-sdk`](https://github.com/just-group/just-dev-sdk#readme) (by zoujie.wzj)—just development sdk
- [`kef-core`](https://npmjs.com/package/kef-core) (by younth)—The awesome KEF
- [`konitor`](https://github.com/konnectors/konitor#readme) (by Simon Constans)—The command-line tool for monitoring konnectors
- [`lcov-server`](https://github.com/gabrielcsapo/lcov-server#readme) (by Gabriel J. Csapo)—🎯 A simple lcov server & cli parser
- [`miguelcostero-ng2-toasty`](https://github.com/akserg/ng2-toasty) (by Sergey Akopkokhyants)—Angular2 Toasty component shows growl-style alerts and messages for your web app
- [`moto-connector`](https://npmjs.com/package/moto-connector) (by limingv5)—JAN平台SDK
- [`node-norman`](https://github.com/zenwarr/norman#readme) (by zenwarr)—A tool to develop multi-package Node.js apps with ease.
- [`nodeschool-admin`](https://github.com/nodeschool/admin#readme) (by Martin Heidegger)—CLI tool for setting up and maintaining a nodeschool chapters and other things.
- [`ogh`](https://github.com/egoist/ogh#readme) (by EGOIST)—Open GitHub Page of your repo directly in Terminal.
- [`one-more-gitlab-cli`](https://github.com/chamerling/one-more-gitlab-cli) (by Christophe Hamerling)—One more Gitlab CLI
- [`pr-log`](https://github.com/lo1tuma/pr-log#readme) (by Mathias Schreck)—Changelog generator based on GitHub Pull Requests
- [`proyecto-sytw-alex-moi`](https://github.com/ULL-ESIT-SYTW-1617/proyecto-sytw-16-17-alex-moi#readme) (by Moises Yanes Carballo)—Module to build a book on GitBook
- [`semantic-release-gitmoji`](https://github.com/momocow/semantic-release-gitmoji#readme) (by MomoCow)—Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.
- [`sherry-utils`](https://github.com/sherry/sherry/packages/sherry-utils#readme) (by ULIVZ)—sherry-utils for Sherry
- [`ship-release`](https://github.com/IonicaBizau/ship-release#readme)—Publish new versions on GitHub and npm with ease.
- [`sinit`](https://npmjs.com/package/sinit) (by villadora)—Project initializer based on Scaffold
- [`smart-clone`](https://github.com/ethernetdan/smart-clone#readme)—Clone a directory into a Golang style directory structure
- [`snipx`](https://npmjs.com/package/snipx)—Best team snippets
- [`ssh-remote`](https://github.com/IonicaBizau/ssh-remote)—Automagically switch on the SSH remote url in a Git repository.
- [`strapper`](https://npmjs.com/package/strapper) (by Sam Newman)—Coming Soon
- [`testarmada-midway`](http://testarmada.io/documentation/Mocking/rWeb/JAVASCRIPT/Introduction) (by Himanshu Jain)—Mocking server to create reliable test data for test execution and development
- [`vscode-gpm`](https://github.com/axetroy/vscode-gpm#readme)—Git Project Manager
## :scroll: License
[MIT][license] © [Ionică Bizău][website]
[license]: /LICENSE
[website]: https://ionicabizau.net
[contributing]: /CONTRIBUTING.md
[docs]: /DOCUMENTATION.md
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
[patreon]: https://www.patreon.com/ionicabizau
[amazon]: http://amzn.eu/hRo9sIZ
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
[license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(https%3A%2F%2Fionicabizau.net)&year=2015#license-mit
[website]: https://ionicabizau.net
[contributing]: /CONTRIBUTING.md
+67 -7
View File
@@ -131,16 +131,26 @@ function gitUrlParse(url) {
urlInfo.name = splits[3];
urlInfo.full_name = urlInfo.organization + '/' + urlInfo.owner + '/_git/' + urlInfo.name;
}
if (urlInfo.query && urlInfo.query['path']) {
urlInfo.filepath = urlInfo.query['path'].replace(/^\/+/g, ''); // Strip leading slash (/)
}
if (urlInfo.query && urlInfo.query['version']) {
// version=GB<branch>
urlInfo.ref = urlInfo.query['version'].replace(/^GB/, ''); // remove GB
}
break;
}
default:
splits = urlInfo.name.split("/");
var nameIndex = splits.length - 1;
if (splits.length >= 2) {
var dashIndex = splits.indexOf("-", 2);
var blobIndex = splits.indexOf("blob", 2);
var treeIndex = splits.indexOf("tree", 2);
var commitIndex = splits.indexOf("commit", 2);
nameIndex = blobIndex > 0 ? blobIndex - 1 : treeIndex > 0 ? treeIndex - 1 : commitIndex > 0 ? commitIndex - 1 : nameIndex;
var srcIndex = splits.indexOf("src", 2);
var rawIndex = splits.indexOf("raw", 2);
nameIndex = dashIndex > 0 ? dashIndex - 1 : blobIndex > 0 ? blobIndex - 1 : treeIndex > 0 ? treeIndex - 1 : commitIndex > 0 ? commitIndex - 1 : srcIndex > 0 ? srcIndex - 1 : rawIndex > 0 ? rawIndex - 1 : nameIndex;
urlInfo.owner = splits.slice(0, nameIndex).join('/');
urlInfo.name = splits[nameIndex];
@@ -152,11 +162,12 @@ function gitUrlParse(url) {
urlInfo.ref = "";
urlInfo.filepathtype = "";
urlInfo.filepath = "";
if (splits.length > nameIndex + 2 && ["blob", "tree"].indexOf(splits[nameIndex + 1]) >= 0) {
urlInfo.filepathtype = splits[nameIndex + 1];
urlInfo.ref = splits[nameIndex + 2];
if (splits.length > nameIndex + 3) {
urlInfo.filepath = splits.slice(nameIndex + 3).join('/');
var offsetNameIndex = splits.length > nameIndex && splits[nameIndex + 1] === "-" ? nameIndex + 1 : nameIndex;
if (splits.length > offsetNameIndex + 2 && ["raw", "src", "blob", "tree"].indexOf(splits[offsetNameIndex + 1]) >= 0) {
urlInfo.filepathtype = splits[offsetNameIndex + 1];
urlInfo.ref = splits[offsetNameIndex + 2];
if (splits.length > offsetNameIndex + 3) {
urlInfo.filepath = splits.slice(offsetNameIndex + 3).join('/');
}
}
urlInfo.organization = urlInfo.owner;
@@ -170,7 +181,46 @@ function gitUrlParse(url) {
urlInfo.full_name += urlInfo.name;
}
}
// Bitbucket Server
if (urlInfo.owner.startsWith("scm/")) {
urlInfo.source = "bitbucket-server";
urlInfo.owner = urlInfo.owner.replace("scm/", "");
urlInfo.organization = urlInfo.owner;
urlInfo.full_name = urlInfo.owner + "/" + urlInfo.name;
}
var bitbucket = /(projects|users)\/(.*?)\/repos\/(.*?)((\/.*$)|$)/;
var matches = bitbucket.exec(urlInfo.pathname);
if (matches != null) {
urlInfo.source = "bitbucket-server";
if (matches[1] === "users") {
urlInfo.owner = "~" + matches[2];
} else {
urlInfo.owner = matches[2];
}
urlInfo.organization = urlInfo.owner;
urlInfo.name = matches[3];
splits = matches[4].split("/");
if (splits.length > 1) {
if (["raw", "browse"].indexOf(splits[1]) >= 0) {
urlInfo.filepathtype = splits[1];
if (splits.length > 2) {
urlInfo.filepath = splits.slice(2).join('/');
}
} else if (splits[1] === "commits" && splits.length > 2) {
urlInfo.commit = splits[2];
}
}
urlInfo.full_name = urlInfo.owner + "/" + urlInfo.name;
if (urlInfo.query.at) {
urlInfo.ref = urlInfo.query.at;
} else {
urlInfo.ref = "";
}
}
return urlInfo;
}
@@ -200,7 +250,7 @@ gitUrlParse.stringify = function (obj, type) {
case "http":
case "https":
var auth = obj.token ? buildToken(obj) : obj.user && (obj.protocols.includes('http') || obj.protocols.includes('https')) ? obj.user + "@" : "";
return type + "://" + auth + obj.resource + port + "/" + obj.full_name + maybeGitSuffix;
return type + "://" + auth + obj.resource + port + "/" + buildPath(obj) + maybeGitSuffix;
default:
return obj.href;
}
@@ -224,4 +274,14 @@ function buildToken(obj) {
}
}
function buildPath(obj) {
switch (obj.source) {
case "bitbucket-server":
return "scm/" + obj.full_name;
default:
return "" + obj.full_name;
}
}
module.exports = gitUrlParse;
+12 -12
View File
@@ -1,32 +1,32 @@
{
"_args": [
[
"git-url-parse@11.1.2",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
"git-url-parse@11.6.0",
"/home/node/nuxt"
]
],
"_from": "git-url-parse@11.1.2",
"_id": "git-url-parse@11.1.2",
"_from": "git-url-parse@11.6.0",
"_id": "git-url-parse@11.6.0",
"_inBundle": false,
"_integrity": "sha512-gZeLVGY8QVKMIkckncX+iCq2/L8PlwncvDFKiWkBn9EtCfYDbliRTTp6qzyQ1VMdITUfq7293zDzfpjdiGASSQ==",
"_integrity": "sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g==",
"_location": "/git-url-parse",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "git-url-parse@11.1.2",
"raw": "git-url-parse@11.6.0",
"name": "git-url-parse",
"escapedName": "git-url-parse",
"rawSpec": "11.1.2",
"rawSpec": "11.6.0",
"saveSpec": null,
"fetchSpec": "11.1.2"
"fetchSpec": "11.6.0"
},
"_requiredBy": [
"/@nuxt/telemetry"
],
"_resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.1.2.tgz",
"_spec": "11.1.2",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"_resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.6.0.tgz",
"_spec": "11.6.0",
"_where": "/home/node/nuxt",
"author": {
"name": "Ionică Bizău",
"email": "bizauionica@gmail.com",
@@ -80,5 +80,5 @@
"scripts": {
"test": "node test"
},
"version": "11.1.2"
"version": "11.6.0"
}