How to set git clone options using git+https dependency in package.json

For example I got dependency:
“saby-typescript”: “git+https://github.com/saby/TypeScript.git#rc-19.500”,

when I run npm install, npm clones full github.com/saby/TypeScript repository with all branches and history.

I want npm to use git clone https://github.com/saby/TypeScript.git --depth 1 --single-branch --branch rc-19.500 instead of full cloning.

How can I do that?

Wouldn’t this approach fail if the hash portion isn’t a branch? You can also put tag names, commit hashes, or semver:<range> (which selects among semver tags). I don’t know how we’d do that without fetching all the refs, but I might be missing some git trick?

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.