Skip to content

Commit

Permalink
feat: setting a custom uplink registry
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Nov 6, 2024
1 parent ff6b5be commit b9c5c5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pnpm/registry-mock",
"version": "3.43.0",
"version": "3.44.0",
"description": "Mock the npm registry",
"main": "dist/index.js",
"bin": "dist/bin/pnpm-registry-mock.js",
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export const getIntegrity = (pkgName: string, pkgVersion: string): string => {

export { REGISTRY_MOCK_PORT }

export function prepare () {
export interface PrepareOptions {
uplinkedRegistry?: string
}

export function prepare (opts?: PrepareOptions) {
const tempy = require('tempy')
const storage = tempy.directory()

Expand All @@ -68,7 +72,7 @@ export function prepare () {
storage,
uplinks: {
npmjs: {
url: process.env['PNPM_REGISTRY_MOCK_UPLINK'] || 'https://registry.npmjs.org/',
url: opts?.uplinkedRegistry || process.env['PNPM_REGISTRY_MOCK_UPLINK'] || 'https://registry.npmjs.org/',
// performance improvements
// https://verdaccio.org/docs/en/uplinks

Expand Down

0 comments on commit b9c5c5c

Please sign in to comment.