From 52142d7828b1dc641c5591ef1bf017ef74916bb7 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sun, 31 May 2026 19:05:59 +0330 Subject: [PATCH 1/2] increase test timeout --- packages/app/e2e.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/e2e.test.ts b/packages/app/e2e.test.ts index 1cecb457..9f20b963 100644 --- a/packages/app/e2e.test.ts +++ b/packages/app/e2e.test.ts @@ -75,7 +75,7 @@ beforeAll(async () => { shell: true, }, ); -}, 70_000); +}, 180_000); afterAll(async () => { await server.ensureClose(); @@ -156,7 +156,7 @@ describe.sequential.each([ expect(process.stderr).toContain( "private-playground/ because the package is private", ); - }, 20_000); + }, 60_000); it(`serves and installs playground-a for ${mode}`, async () => { const [owner, repo] = payload.repository.full_name.split("/"); From 0f06241a0f527c32dfd0d7d6cf4e1c8b3c1a7b9a Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Mon, 1 Jun 2026 11:08:14 +0330 Subject: [PATCH 2/2] update --- packages/utils/index.test.ts | 18 ++++++++++++++++++ packages/utils/index.ts | 16 +++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/packages/utils/index.test.ts b/packages/utils/index.test.ts index 87e79c5f..461b4c3f 100644 --- a/packages/utils/index.test.ts +++ b/packages/utils/index.test.ts @@ -47,6 +47,24 @@ describe("utils", () => { utils.extractOwnerAndRepo("git+http://github.com/org/repo.git"), ).toEqual(["org", "repo"]); }); + + it("returns org and repo for GitHub shorthand", () => { + expect(utils.extractOwnerAndRepo("org/repo")).toEqual(["org", "repo"]); + }); + + it("returns org and repo for github: shorthand", () => { + expect(utils.extractOwnerAndRepo("github:org/repo")).toEqual([ + "org", + "repo", + ]); + }); + + it("returns org and repo for URLs without .git suffix", () => { + expect(utils.extractOwnerAndRepo("https://github.com/org/repo")).toEqual([ + "org", + "repo", + ]); + }); }); describe("extractRepository", () => { diff --git a/packages/utils/index.ts b/packages/utils/index.ts index 2ef980ca..833eb4c4 100644 --- a/packages/utils/index.ts +++ b/packages/utils/index.ts @@ -1,15 +1,25 @@ import type { PackageManifest } from "query-registry"; const githubUrlRegex = - /^(?:git\+)?https?:\/\/github\.com\/([^/]+)\/([^/]+)\.git$/; + /^(?:git\+)?https?:\/\/github\.com\/([^/]+)\/([^/]+)\/?$/; +const githubShorthandRegex = /^(?:github:)?([^/]+)\/([^/]+)$/; export function extractOwnerAndRepo( repositoryUrl: string, ): [string, string] | null { - const match = repositoryUrl.match(githubUrlRegex); + const match = + repositoryUrl.match(githubUrlRegex) ?? + repositoryUrl.match(githubShorthandRegex); if (match) { - return [match[1], match[2]]; + let repo = match[2]; + if (repo.endsWith(".git")) { + repo = repo.slice(0, -4); + } else if (repo.includes(".git")) { + return null; + } + + return [match[1], repo]; } return null;