Skip to content

Commit

Permalink
Allow repository shorthand with nested path
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Oct 24, 2024
1 parent 13ab98c commit 4525806
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function isDeprecatedGitHubGitUrl(url) {

// Reference: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository
const SHORTHAND_REPOSITORY_URL_RE =
/^(?:(?:github|bitbucket|gitlab):[\w\-]+\/[\w\-]+|gist:\w+|[\w\-]+\/[\w\-]+)$/
/^(?:(?:github|bitbucket|gitlab):[\w\-]+\/[\w\-/]+|gist:\w+|[\w\-]+\/[\w\-]+)$/
/**
* @param {string} url
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "publint-invalid-repository-value-object-deprecatec",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "publint-invalid-repository-value-object-not-git-url",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "publint-invalid-repository-value-object-shorthand-site",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "publint-invalid-repository-value-shorthand-nested",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": "gitlab:org/user/repo"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "publint-invalid-repository-value-shorthand",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": "npm/npm"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "publint-invalid-repository-value-string-not-url",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"repository": "not_an_url"
}
4 changes: 4 additions & 0 deletions pkg/tests/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { equal } from 'uvu/assert'
import { publint } from '../lib/node.js'
import { formatMessage } from '../lib/utils-node.js'

// TODO: migrate these to fs-fixture

testFixture('exports-browser-conflict', [
'EXPORTS_VALUE_CONFLICTS_WITH_BROWSER',
'USE_EXPORTS_OR_IMPORTS_BROWSER'
Expand Down Expand Up @@ -154,6 +156,8 @@ testFixture('invalid-repository-value-string-not-url', [

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

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

testFixture('invalid-repository-value-object-not-git-url', [
{
code: 'INVALID_REPOSITORY_VALUE',
Expand Down

0 comments on commit 4525806

Please sign in to comment.