This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to override recorded registry
- Loading branch information
Caleb ツ Everett
committed
Dec 23, 2021
1 parent
37ad149
commit 151a31f
Showing
6 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
function resolveOptions (opts) { | ||
return { | ||
omitLockfileRegistryResolved: opts.omitLockfileRegistryResolved, | ||
registry: opts.registry, | ||
recordResolvedRegistry: opts.recordResolvedRegistry, | ||
} | ||
} | ||
|
||
function overrideResolves (resolved, opts) { | ||
if (opts.omitLockfileRegistryResolved) { | ||
return undefined | ||
} | ||
if (opts.registry && opts.recordResolvedRegistry && resolved.startsWith(opts.registry)) { | ||
// TODO handle scoped packages with their own registries. | ||
return opts.recordResolvedRegistry + resolved.slice(opts.registry.length) | ||
} | ||
return resolved | ||
} | ||
|
||
module.exports = { overrideResolves, resolveOptions } |
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 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