Skip to content

Commit b9c5c5c

Browse files
committed
feat: setting a custom uplink registry
1 parent ff6b5be commit b9c5c5c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pnpm/registry-mock",
3-
"version": "3.43.0",
3+
"version": "3.44.0",
44
"description": "Mock the npm registry",
55
"main": "dist/index.js",
66
"bin": "dist/bin/pnpm-registry-mock.js",

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ export const getIntegrity = (pkgName: string, pkgVersion: string): string => {
5656

5757
export { REGISTRY_MOCK_PORT }
5858

59-
export function prepare () {
59+
export interface PrepareOptions {
60+
uplinkedRegistry?: string
61+
}
62+
63+
export function prepare (opts?: PrepareOptions) {
6064
const tempy = require('tempy')
6165
const storage = tempy.directory()
6266

@@ -68,7 +72,7 @@ export function prepare () {
6872
storage,
6973
uplinks: {
7074
npmjs: {
71-
url: process.env['PNPM_REGISTRY_MOCK_UPLINK'] || 'https://registry.npmjs.org/',
75+
url: opts?.uplinkedRegistry || process.env['PNPM_REGISTRY_MOCK_UPLINK'] || 'https://registry.npmjs.org/',
7276
// performance improvements
7377
// https://verdaccio.org/docs/en/uplinks
7478

0 commit comments

Comments
 (0)