Environment
Node: 20.16.0
NPM: 10.8.1
Changelogen: 0.6.1
Environment: Docker Ubuntu
Reproduction
Repoduction Steps
- In
package.json, provide subgroup repository shortcut syntax
{
"repository": "gitlab:group/subgroup-a/subgroup-a1/repo.git"
}
- Run
npx changelogen and check the generated changelog
Expectation
It should generate changelog with link to commit.
## ...main
### 🤖 CI
- Added changelogen ([7b0990a](https://gitlab.com/group/subgroup-a/subgroup-a1/repo/commit/7b0990a))
### ❤️ Contributors
- Wuiyang Tan <wuiyang@live.com>
Actual result
The generated changelog did not includes link to commit.
## ...main
### 🤖 CI
- Added changelogen (7b0990a)
### ❤️ Contributors
- Wuiyang Tan <wuiyang@live.com>
More Information
I just tried with normal git repo link without shortcut syntax (https://gitlab.com/group/subgroup-a/subgroup-a1/repo), it work as expected.
Describe the bug
In repo with package.json using repository shortcut syntax, it cannot handle subgroup repository link correctly (gitlab:group/subgroup-a/subgroup-a1/repo.git)
The current regex for picking up the repository shortcut syntax only supports format [provider]:[owner]/[repo-name](.git)? without extra / in repo-name.
https://github.com/unjs/changelogen/blob/17ce7c7406bd2d8c14a9abf350977a4363ee3dc0/src/repo.ts#L41C1-L42C97
I believe updating the regex to accept optional / in repo-name section should be sufficient in picking up subgroups (and nested subgroups) repository.
// https://regex101.com/r/NA4Io6/1
const providerURLRegex =
- /^(?:(?<user>[\w-]+)@)?(?:(?<provider>[^/:]+):)?(?<repo>[\w-]+\/(?:\w|\.(?!git$)|-)+)(?:\.git)?$/;
+ /^(?:(?<user>[\w-]+)@)?(?:(?<provider>[^/:]+):)?(?<repo>[\w-]+\/(?:\/?\w|\.(?!git$)|-)+)(?:\.git)?$/;
Included regex101 link for testing: https://regex101.com/r/Cmuakg/1
Additional context
No response
Logs
Environment
Node: 20.16.0
NPM: 10.8.1
Changelogen: 0.6.1
Environment: Docker Ubuntu
Reproduction
Repoduction Steps
package.json, provide subgroup repository shortcut syntax{ "repository": "gitlab:group/subgroup-a/subgroup-a1/repo.git" }npx changelogenand check the generated changelogExpectation
It should generate changelog with link to commit.
Actual result
The generated changelog did not includes link to commit.
More Information
I just tried with normal git repo link without shortcut syntax (
https://gitlab.com/group/subgroup-a/subgroup-a1/repo), it work as expected.Describe the bug
In repo with
package.jsonusing repository shortcut syntax, it cannot handle subgroup repository link correctly (gitlab:group/subgroup-a/subgroup-a1/repo.git)The current regex for picking up the repository shortcut syntax only supports format
[provider]:[owner]/[repo-name](.git)?without extra/inrepo-name.https://github.com/unjs/changelogen/blob/17ce7c7406bd2d8c14a9abf350977a4363ee3dc0/src/repo.ts#L41C1-L42C97
I believe updating the regex to accept optional
/inrepo-namesection should be sufficient in picking up subgroups (and nested subgroups) repository.Included regex101 link for testing: https://regex101.com/r/Cmuakg/1
Additional context
No response
Logs