Skip to content

Commit 9bedce3

Browse files
committed
✨ Feature: change proxy\registry -> npmProxy
pmRegistry
1 parent 8747c23 commit 9bedce3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/lib/Logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Logger implements ILogger {
2323
}
2424

2525
private readonly ctx: IPicGo
26-
private logLevel!: string
26+
private logLevel!: string | string[]
2727
private logPath!: string
2828
constructor (ctx: IPicGo) {
2929
this.ctx = ctx

src/lib/PluginHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ export class PluginHandler implements IPluginHandler {
204204

205205
private async execCommand (cmd: string, modules: string[], where: string, options: IPluginHandlerOptions = {}, env: IProcessEnv = {}): Promise<IResult> {
206206
// options first
207-
const registry = options.registry || this.ctx.getConfig<Undefinable<string>>('settings.registry')
208-
const proxy = options.proxy || this.ctx.getConfig<Undefinable<string>>('settings.proxy')
207+
const registry = options.npmRegistry || this.ctx.getConfig<Undefinable<string>>('settings.npmRegistry')
208+
const proxy = options.npmProxy || this.ctx.getConfig<Undefinable<string>>('settings.npmProxy')
209209
return await new Promise((resolve: any): void => {
210210
let args = [cmd].concat(modules).concat('--color=always').concat('--save')
211211
if (registry) {

src/plugins/commander/pluginHandler.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const pluginHandler: IPlugin = {
88
.command('install <plugins...>')
99
.description('install picgo plugin')
1010
.alias('add')
11-
.option('-p, --proxy <proxy>', 'Add proxy for installing')
12-
.option('-r, --registry <registry>', 'Choose a registry for installing')
11+
.option('-p, --proxy <proxy>', 'Add proxy for installing plugins')
12+
.option('-r, --registry <registry>', 'Choose a registry for installing plugins')
1313
.action((plugins: string[], program: any) => {
1414
const { proxy, registry } = program
1515
const options = {
16-
proxy,
17-
registry
16+
npmProxy: proxy,
17+
npmRegistry: registry
1818
}
1919
ctx.pluginHandler.install(plugins, options).catch((e) => { ctx.log.error(e) })
2020
})
@@ -28,13 +28,13 @@ const pluginHandler: IPlugin = {
2828
cmd.program
2929
.command('update <plugins...>')
3030
.description('update picgo plugin')
31-
.option('-p, --proxy <proxy>', 'Add proxy for installing')
32-
.option('-r, --registry <registry>', 'Choose a registry for installing')
31+
.option('-p, --proxy <proxy>', 'Add proxy for installing plugins')
32+
.option('-r, --registry <registry>', 'Choose a registry for installing plugins')
3333
.action((plugins: string[], program: any) => {
3434
const { proxy, registry } = program
3535
const options = {
36-
proxy,
37-
registry
36+
npmProxy: proxy,
37+
npmRegistry: registry
3838
}
3939
ctx.pluginHandler.update(plugins, options).catch((e: Error) => { ctx.log.error(e) })
4040
})

src/types/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ export interface IConfig {
388388
debug?: boolean
389389
silent?: boolean
390390
settings?: {
391-
logLevel?: string
391+
logLevel?: string[]
392392
logPath?: string
393393
/** for npm */
394-
registry?: string
394+
npmRegistry?: string
395395
/** for npm */
396-
proxy?: string
396+
npmProxy?: string
397397
[others: string]: any
398398
}
399399
[configOptions: string]: any
@@ -437,8 +437,8 @@ export interface IPluginHandlerResult<T> {
437437
}
438438

439439
export interface IPluginHandlerOptions {
440-
proxy?: string
441-
registry?: string
440+
npmProxy?: string
441+
npmRegistry?: string
442442
}
443443

444444
/**

0 commit comments

Comments
 (0)