Support for GitLab, Bitbucket remote templates
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, typescript
- Lĩnh vực
- cli
Hướng nghiên cứu
Start in packages/cli/src/create/discovery.ts, where isGitHubUrl, parseGitHubUrl and discoverTemplate decide whether input goes to degit, then check the remote.ts hint and the expandCreateShorthand skip. Read the GitHub cases in packages/cli/src/create/tests/discovery.spec.ts first. Done when gitlab:, gitlab.com and bitbucket forms route to degit with the host kept, existing GitHub tests still pass, and new spec cases cover them.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
As a developer using Vite+ with GitLab, I want vp create to scaffold from templates hosted on GitLab (gitlab.com or self-hosted), so my team can share project templates the same way GitHub users can.
Current behavior (vp v1.1.0)
GitHub works:
$ vp create github:nkzw-tech/fate-template --no-interactive
◇ Scaffolded fate-template
→ Next: cd fate-template && vp run
GitLab, the same public repo in both forms, fails:
$ vp create gitlab:gitlab-org/project-templates/express --no-interactive
◇ Generating project…
■ Template "gitlab:gitlab-org/project-templates/express" not found on npm. Run
vp create --list to see available templates.
$ vp create https://gitlab.com/gitlab-org/project-templates/express --no-interactive
◇ Generating project…
■ Template "https://gitlab.com/gitlab-org/project-templates/express" not found
on npm. Run vp create --list to see available templates.
The input isn't recognized as a remote template, so it falls through to the npm package lookup.
Why it matters
- Many teams, especially companies, host code on GitLab (often self-hosted), not GitHub.
- Vite+ already supports GitLab on the CI side (
setup-vpGitLab template, GitLab CI/CD guide). Scaffolding is the missing piece of that flow. vp createalready usesdegitfor remote templates, and degit already supports these hosts. With degit 3.10.0 directly, both commands above work:
$ pnpm dlx [email protected] gitlab:gitlab-org/project-templates/express out-nested
> cloned gitlab-org/project-templates/express#HEAD to out-nested
$ pnpm dlx [email protected] https://gitlab.com/gitlab-org/gitlab-runner-docker-cleanup out-url
> cloned gitlab-org/gitlab-runner-docker-cleanup#HEAD to out-url
So only the template detection in Vite+ is GitHub-only.
Suggested solution
Where the limit is
packages/cli/src/create/discovery.ts (on main):
isGitHubUrl()(L12): only matchesgithub:,https://github.com/andgithub.com/.parseGitHubUrl()(L21): reduces input to bareuser/repo. Fine for GitHub (degit's default host), but it drops the host prefix degit needs for anything else. The URL regexgithub\.com\/([^/]+\/[^/]+)would also cut GitLab nested groups (group/subgroup/repo).discoverTemplate()(L133): only routes todegitwhenisGitHubUrl()is true. Everything else falls through to the npm lookup, which gives the "not found on npm" error above.
Related spots:
packages/cli/src/create/bin.ts(L597): usesisGitHubUrl/inferGitHubRepoNameto infer the target directory.packages/cli/src/create/templates/remote.ts:isGitHubTemplate = command === 'degit'(L26), and the error hint says "Make sure the GitHub repository exists" (L72).expandCreateShorthand()(L234): already skips inputs containing:, sogitlab:andhttps://gitlab.com/...are safe there. Bare forms likegit.sr.ht/user/repowould still need an explicit skip.
What degit already supports (degit 3.10, docs/USAGE.md)
| Host | Forms |
|---|---|
| GitLab | gitlab:user/repo, https://gitlab.com/user/repo, [email protected]:user/repo |
| Self-hosted GitLab | gitlab://git.example.com/user/repo |
| Bitbucket | bitbucket:user/repo, https://bitbucket.org/user/repo, [email protected]:user/repo |
| Sourcehut | git.sr.ht/user/repo, https://git.sr.ht/user/repo, [email protected]:user/repo |
It also handles GitLab nested groups, #ref (branch/tag/commit), and private repos over SSH.
Proposed change
- Make the GitHub-only helpers generic (e.g.
isRemoteGitTemplate,toDegitSource,inferRemoteRepoName), or extend the existing ones. - Detection: also match
gitlab:,gitlab://,gitlab.com/,bitbucket:,bitbucket.org/,git.sr.ht/andgit@<host>:forms. - Source passed to degit:
- GitHub: keep the current behavior (bare
user/repo), so nothing changes for existing users. - Other hosts: pass the input through as-is, keeping the host. degit already parses these forms, so Vite+ doesn't need its own parser, and nested groups and
#refkeep working.
- GitHub: keep the current behavior (bare
- Repo name inference (default target dir): last path segment, without
.gitor#ref. expandCreateShorthand(): explicitly skip bare host forms likegit.sr.ht/user/repo.remote.tserror hint: "repository" instead of "GitHub repository", and mention SSH access for private / self-hosted repos.
Tests
packages/cli/src/create/__tests__/discovery.spec.ts:
GitHub template helpers(L275): add detection, degit source and repo-name cases for GitLab (shorthand, URL,.git), self-hosted GitLab, a nested group and Bitbucket.should not expand GitHub URLs(L248): add the new forms.discoverTemplate(degit test near L290): add a GitLab case checkingcommand === 'degit'and that the host is kept inargs[0].- Keep the existing GitHub cases unchanged as a regression guard.
Docs
docs/guide/create.md: update "Template Sources" and the "Use remote templates" examples:
vp create gitlab:user/repo
vp create https://gitlab.com/group/subgroup/repo
vp create gitlab://git.example.com/user/repo
vp create bitbucket:user/repo
Alternative
Workarounds today. Both skip what vp create adds on top (agent files, editor config, hooks, package manager setup):
pnpm dlx degit gitlab:user/repo my-app
cd my-app && vp install
or
git clone --depth 1 https://gitlab.com/user/repo.git my-app
then remove my-app/.git and run vp install.
A smaller first step could be GitLab only (gitlab:, gitlab.com/ and gitlab://), since that's likely where most non-GitHub demand is.
Additional context
- Reproduced with vp v1.1.0 (current npm
latest). The same GitHub-only detection is indiscovery.tsonmainand onrelease/v1.2.0 - No existing issue or PR found (searched "gitlab", "degit", "remote template")
- degit host support: https://github.com/Rich-Harris/degit/blob/master/docs/USAGE.md
- Related GitLab work in Vite+: #1920, #2239, #2258, #2520
- Side note: the current error ("not found on npm") is misleading for git URLs. Even without full support, detecting a non-GitHub git host and saying "only GitHub remote templates are supported" would help
Validations
- Read the Contributing Guidelines.
- Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
- Check that there isn't already an issue requesting the same feature.
- Ngôn ngữ chính
- Rust
- Star
- 6k
- Fork
- 274
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 211
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-plus
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2882 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
voidzero-dev/vite-plus#2097 · 10 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
the `vp migrate` command wrongly rewrite "vite/rolldown/plugins" to "vite-plus/rolldown/plugins"Có thể đã có người làm @Crimson341 đã nhận hôm nay. Đang mởpending triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
voidzero-dev/vite-plus#3050 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
vp migrate crashes with "Undefined meta var" when a migrated config string contains `$`Có thể đã có người làm @BenjyLimmy đã nhận 2 ngày trước. Đang mởbug
voidzero-dev/vite-plus#3045 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add a dedicated Package Management section with command reference pagesCó thể đã có người làm @jong-kyung đã nhận 2 ngày trước. Đang mởdocumentation
voidzero-dev/vite-plus#3041 · 4 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/vite-plus
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
adorsys/status-list-server#698 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Expose the dot grid colourĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nannou-org/egui_graph#92 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
Deduplicate normalized_f64_bits (hash_table.rs and bloom_filter.rs)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
tursodatabase/turso#10002 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
topgrade-rs/topgrade#2419 ·
Maintainer thường phản hồi trong vòng 1 ngày