git-up is a dedicated, low-level JavaScript utility designed for robust parsing of various Git URL formats, including SSH (e.g., `git@github.com:user/repo.git`) and HTTPS (`https://github.com/user/repo.git`). It meticulously breaks down a given URL into a structured object, exposing components like protocols, port, resource, user, pathname, hash, search, href, and the derived Git protocol. The current stable version is 8.1.1, with recent releases indicating active maintenance and the addition of TypeScript types in version 8.1.0. Its release cadence is somewhat irregular, often driven by updates to its core dependency, `parse-url`. A key differentiator is its specific focus on Git URL nuances, making it more reliable for Git-centric tooling compared to general-purpose URL parsers, which might not correctly interpret SSH syntax or project paths.
npm install git-upVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing both SSH and HTTPS Git URLs and logging the structured output, showcasing the detailed breakdown of URL components.
Thoroughly test existing parsing logic and adapt code if `parse-url` 9.x.x introduces changes to the parsed object structure or edge case handling.
Review `parse-url` 8.x.x documentation and update any code that relies on specific parsed URL properties or behaviors that may have been altered.
Update logic handling `pathname` to account for trailing slashes, ensure `port` is treated as a string, and adjust any code that expects specific `resource` formats or relies on the absence of a `password` field.
For Safari compatibility, ensure `normalize-url` is updated or consider upgrading to `git-up@6.0.0` or later, as subsequent `parse-url` updates may have resolved the underlying issue. Always test thoroughly in Safari.
Change the import statement to `import gitUp from 'git-up';` to correctly import the default export.
Update `git-up` to the latest version and ensure your `node_modules/@types/git-up` are regenerated. Review the `GitUpResult` interface in the latest version for current property names and types, especially after major version bumps (e.g., `port` changed to `string` in v6).
Ensure the `input` argument passed to `gitUp()` is always a string representing the Git URL to be parsed.