conventional-changelog / get-pkg-repo

Get repository user and project information from package.json file contents.
MIT License
17 stars 13 forks source link

Bitbucket URL incorrectly parsed (interpretes scm as part of user) #76

Open Hi-Fi opened 3 years ago

Hi-Fi commented 3 years ago

In package.json I have following repo definition (format correct that's provided by Bitbucket DataCenter):

  "repository": {
    "type": "git",
    "url": "https://bb.example.com/scm/project1/repo1.git"
  },

When this is parsed, following is obtained:

npx get-pkg-repo package.json
{
  browse: [Function (anonymous)],
  domain: 'bb.example.com',
  project: 'repo1',
  type: null,
  user: 'scm/project1'
}

Bitbucket uses that scm part only at clone URLs. Cloning without it doesn't work, but also UI URLs with it doesn't work (only special case is that full URL, that goes to repo front page).

Expected

{
  browse: [Function (anonymous)],
  domain: 'bb.example.com',
  project: 'repo1',
  type: null,
  user: 'project1'
}