-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove unnecessary patch type errors
- Loading branch information
1 parent
ff5ca9e
commit de37ac6
Showing
4 changed files
with
34 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
import { argv } from 'yargs'; | ||
import { Param } from './interactive.model'; | ||
import { argv, Options } from 'yargs'; | ||
import { getEnvPreset } from '../../pre-set'; | ||
|
||
function getDefaultByCliMode(): boolean { | ||
return getEnvPreset().interactive as boolean; | ||
} | ||
export const param: Param = { | ||
interactive: { | ||
alias: 'i', | ||
type: 'boolean', | ||
description: 'When false questions are skipped with the values from the suggestions. This is useful for CI integrations.', | ||
default: getDefaultByCliMode() | ||
} | ||
}; | ||
export const interactive = { | ||
alias: 'i', | ||
type: 'boolean', | ||
description: 'When false questions are skipped with the values from the suggestions. This is useful for CI integrations.', | ||
default: getDefaultByCliMode() | ||
} satisfies Options; | ||
|
||
// We don't rely on yargs option normalization features as this can happen before cli bootstrap | ||
export function get(): boolean { | ||
const { interactive, i } = argv as any as {interactive?: boolean, i?: boolean}; | ||
return interactive !== undefined ? Boolean(interactive) : i !== undefined ? Boolean(i) : param.interactive.default; | ||
return interactive !== undefined ? Boolean(interactive) : i !== undefined ? Boolean(i) : getDefaultByCliMode(); | ||
} |
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 |
---|---|---|
@@ -1,20 +1,15 @@ | ||
import { argv } from 'yargs'; | ||
import { Param } from './verbose.model'; | ||
import { GlobalOptionsArgv } from './types'; | ||
import { argv, Options } from 'yargs'; | ||
import { getEnvPreset } from '../../pre-set'; | ||
|
||
|
||
export const param: Param = { | ||
verbose: { | ||
alias: 'v', | ||
type: 'boolean', | ||
description: 'Run with verbose logging', | ||
default: getEnvPreset().verbose | ||
} | ||
}; | ||
export const verbose = { | ||
alias: 'v', | ||
type: 'boolean', | ||
description: 'Run with verbose logging', | ||
default: getEnvPreset().verbose | ||
} satisfies Options; | ||
|
||
// We don't rely on yargs option normalization features as this can happen before cli bootstrap | ||
export function get(): boolean { | ||
const {verbose} = argv as unknown as GlobalOptionsArgv; | ||
return verbose; | ||
const {verbose} = argv as unknown as {verbose?: boolean}; | ||
return !!verbose; | ||
} |
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 |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import { argv } from 'yargs'; | ||
import { Param } from './rc.model'; | ||
import { argv, Options } from 'yargs'; | ||
import { getEnvPreset } from '../../../pre-set'; | ||
import { GlobalOptionsArgv } from '../../options/types'; | ||
|
||
export const param: Param = { | ||
rcPath: { | ||
alias: 'p', | ||
type: 'string', | ||
description: 'Path to user-flow.config.json. e.g. `./user-flowrc.json`', | ||
default: getEnvPreset().rcPath | ||
} | ||
}; | ||
export const rcPath = { | ||
alias: 'p', | ||
type: 'string', | ||
description: 'Path to user-flow.config.json. e.g. `./user-flowrc.json`', | ||
default: getEnvPreset().rcPath | ||
} satisfies Options; | ||
|
||
// We don't rely on yargs option normalization features as this can happen before cli bootstrap | ||
export function get(): string { | ||
const { rcPath } = argv as unknown as GlobalOptionsArgv; | ||
const { rcPath } = argv as unknown as { rcPath: string }; | ||
return rcPath as string | ||
} |