mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 15:44:20 +00:00
5c32e0ba7c
The flag iterates through the lockfile entries, rewrites `resolved` URLs to those that will be in the cache (like `fixup_yarn_lock` from yarn2nix), removes `integrity` for git deps whose hash won't match the reproducible repacking that the fetcher does, writes the amended lockfile, and exits.
18 lines
634 B
JavaScript
18 lines
634 B
JavaScript
const path = require('path')
|
|
|
|
// This has to match the logic in pkgs/development/tools/yarn2nix-moretea/yarn2nix/lib/urlToName.js
|
|
// so that fixup_yarn_lock produces the same paths
|
|
const urlToName = url => {
|
|
const isCodeloadGitTarballUrl = url.startsWith('https://codeload.github.com/') && url.includes('/tar.gz/')
|
|
|
|
if (url.startsWith('git+') || isCodeloadGitTarballUrl) {
|
|
return path.basename(url)
|
|
} else {
|
|
return url
|
|
.replace(/https:\/\/(.)*(.com)\//g, '') // prevents having long directory names
|
|
.replace(/[@/%:-]/g, '_') // replace @ and : and - and % characters with underscore
|
|
}
|
|
}
|
|
|
|
module.exports = { urlToName };
|