-
Notifications
You must be signed in to change notification settings - Fork 86
feat: add HostedGitInfo.fromManifest
#288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This encapsulates the logic used in `npm repo`
wraithgar
reviewed
Dec 17, 2024
Yay! When do you think this can go out in a semver-minor? (obv it'll still need CI to run) |
~/D/n/h/b/main (fromManifest|✚2) $ git diff
diff --git a/lib/index.js b/lib/index.js
index c5220a4..2a7100d 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -15,7 +15,7 @@ function unknownHostedUrl (url) {
pathname,
} = new URL(url)
- if (!protocol || !hostname) {
+ if (!hostname) {
return null
}
diff --git a/test/github.js b/test/github.js
index 7d7739b..7429bd8 100644
--- a/test/github.js
+++ b/test/github.js
@@ -345,5 +345,13 @@ t.test('from manifest', t => {
}
t.throws(() => HostedGit.fromManifest(nonStringRepo))
+ const fileRepo = {
+ name: 'foo',
+ repository: {
+ url: 'file:///path/dot.git',
+ },
+ }
+ t.equal(HostedGit.fromManifest(fileRepo), null)
+ This implements my original suggestion |
alrighty, updated |
@ljharb @wraithgar this seems to have fallen off the radar. It looks good to me. Anything to add here? |
@owlstronaut as far as i know it's ready to go, just hasn't been revisited since january 3rd. |
owlstronaut
approved these changes
Apr 14, 2025
Merged
thanks! |
owlstronaut
pushed a commit
that referenced
this pull request
Apr 14, 2025
🤖 I have created a release *beep* *boop* --- ## [8.1.0](v8.0.2...v8.1.0) (2025-04-14) ### Features * [`ef0865c`](ef0865c) [#288](#288) add `HostedGitInfo.fromManifest` (#288) (@ljharb) ### Chores * [`ac08fe8`](ac08fe8) [#296](#296) bump @npmcli/template-oss from 4.23.6 to 4.24.3 (#296) (@dependabot[bot], @npm-cli-bot) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This encapsulates the logic used in
npm repo
Per Slack discussion. Once this is published and updated in the cli, I'll happily adapt the
npm repo
code to use this method.The method will either return a HGI instance, a string URL, or
null
.