Skip to content

Commit 4525806

Browse files
committed
Allow repository shorthand with nested path
1 parent 13ab98c commit 4525806

File tree

8 files changed

+17
-1
lines changed

8 files changed

+17
-1
lines changed

pkg/src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function isDeprecatedGitHubGitUrl(url) {
9191

9292
// Reference: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository
9393
const SHORTHAND_REPOSITORY_URL_RE =
94-
/^(?:(?:github|bitbucket|gitlab):[\w\-]+\/[\w\-]+|gist:\w+|[\w\-]+\/[\w\-]+)$/
94+
/^(?:(?:github|bitbucket|gitlab):[\w\-]+\/[\w\-/]+|gist:\w+|[\w\-]+\/[\w\-]+)$/
9595
/**
9696
* @param {string} url
9797
*/

pkg/tests/fixtures/invalid-repository-value-object-deprecated/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "publint-invalid-repository-value-object-deprecatec",
33
"version": "0.0.1",
4+
"private": true,
45
"type": "commonjs",
56
"repository": {
67
"type": "git",

pkg/tests/fixtures/invalid-repository-value-object-not-git-url/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "publint-invalid-repository-value-object-not-git-url",
33
"version": "0.0.1",
4+
"private": true,
45
"type": "commonjs",
56
"repository": {
67
"type": "git",

pkg/tests/fixtures/invalid-repository-value-object-shorthand-site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "publint-invalid-repository-value-object-shorthand-site",
33
"version": "0.0.1",
4+
"private": true,
45
"type": "commonjs",
56
"repository": {
67
"type": "git",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "publint-invalid-repository-value-shorthand-nested",
3+
"version": "0.0.1",
4+
"private": true,
5+
"type": "commonjs",
6+
"repository": "gitlab:org/user/repo"
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "publint-invalid-repository-value-shorthand",
33
"version": "0.0.1",
4+
"private": true,
45
"type": "commonjs",
56
"repository": "npm/npm"
67
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "publint-invalid-repository-value-string-not-url",
33
"version": "0.0.1",
4+
"private": true,
45
"type": "commonjs",
56
"repository": "not_an_url"
67
}

pkg/tests/playground.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { equal } from 'uvu/assert'
55
import { publint } from '../lib/node.js'
66
import { formatMessage } from '../lib/utils-node.js'
77

8+
// TODO: migrate these to fs-fixture
9+
810
testFixture('exports-browser-conflict', [
911
'EXPORTS_VALUE_CONFLICTS_WITH_BROWSER',
1012
'USE_EXPORTS_OR_IMPORTS_BROWSER'
@@ -154,6 +156,8 @@ testFixture('invalid-repository-value-string-not-url', [
154156

155157
testFixture('invalid-repository-value-shorthand', [])
156158

159+
testFixture('invalid-repository-value-shorthand-nested', [])
160+
157161
testFixture('invalid-repository-value-object-not-git-url', [
158162
{
159163
code: 'INVALID_REPOSITORY_VALUE',

0 commit comments

Comments
 (0)