Skip to content

Commit 7c475d6

Browse files
gerbsenDaniel Gerberclaude
authored
Support full clone URLs in getDocs (e.g. GitLab repos) (#382)
getDocs.js hardcoded the GitHub host and prepended it to every `repo` entry in docs.package.json, so only GitHub repos could be imported. Resolve each entry to a clone URL instead: a full URL (https:// or git@) is used as-is, while a bare "owner/name" still falls back to the GitHub prefix for backwards compatibility. This unblocks adding application examples that live on GitLab. Signed-off-by: Daniel Gerber <394442-gerbsen@users.noreply.gitlab.com> Co-authored-by: Daniel Gerber <394442-gerbsen@users.noreply.gitlab.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 18c633b commit 7c475d6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

getDocs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ const reposJson = fs
1010
const repos = JSON.parse(reposJson)
1111
const ghUrl = 'https://github.com/'
1212

13+
// Resolve a repo entry to a clone URL.
14+
// A full URL (e.g. a GitHub or GitLab repo) is used as-is; a bare
15+
// "owner/name" is treated as a GitHub shorthand for backwards compatibility.
16+
const cloneUrl = (repo) =>
17+
/^(https?:\/\/|git@)/.test(repo) ? repo : ghUrl + repo
18+
1319
// Clone each repository, remove git folders and README files, and copy the docs to the target directory
1420
repos.forEach((repo) => {
1521
const repoDir = `repo_to_be_edited/${repo.label}`
1622

1723
// Clone the repository
18-
const cloneCommand = `git clone ${ghUrl + repo.repo} ${repoDir}`
24+
const cloneCommand = `git clone ${cloneUrl(repo.repo)} ${repoDir}`
1925
execSync(cloneCommand)
2026

2127
// Remove git folders

0 commit comments

Comments
 (0)