Skip to content

Commit bbc8fb8

Browse files
committed
feat: allow alternative npm registry url
1 parent 3a16fe6 commit bbc8fb8

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

.changeset/fair-waves-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': minor
3+
---
4+
5+
Allow for an alternate npm registry to be passed when calling the cli.

packages/cli/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ program
5353
)
5454
.option('-d, --dry', 'dry run (no changes are made to files)')
5555
.option('--run-in-band', 'run serially in the current process')
56+
.option(
57+
'--registry <value>',
58+
'Define a registry where the package should be fetched from',
59+
)
5660
.addOption(
5761
new Option(
5862
'--verbose <parser>',

packages/cli/src/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PluginManager } from 'live-plugin-manager';
44
import { fetchPackageConfig } from './fetch-package';
55

66
export default async function list(packages: string[]) {
7-
const packageManager = new PluginManager();
7+
const packageManager = new PluginManager({});
88
const configs = [];
99

1010
for (const packageName of packages) {

packages/cli/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default async function main(paths: string[], flags: Flags) {
2525

2626
const packageManager = new PluginManager({
2727
pluginsPath: path.join(__dirname, 'node_modules'),
28+
npmRegistryUrl: flags.registry,
2829
});
2930

3031
let transforms: string[] = [];

packages/cli/src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@ export interface Flags {
3636
cpus?: number;
3737
dry?: boolean;
3838
runInBand?: boolean;
39+
40+
/** Npm registry url that will be used to fetch the packages from. */
41+
registry?: string;
3942
verbose?: '0' | '1' | '2';
4043
}

0 commit comments

Comments
 (0)