Skip to content

Commit 56f0100

Browse files
committedMar 22, 2022
Update to commander 9.x types
1 parent 3918872 commit 56f0100

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed
 

‎source/commands/utils/sharedDangerfileArgs.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import program from "commander"
1+
import { Command } from "commander"
22
import chalk from "chalk"
33

4-
process.on("unhandledRejection", function(reason: string, _p: any) {
4+
process.on("unhandledRejection", function (reason: string, _p: any) {
55
console.log(chalk.red("Error: "), reason)
66
process.exitCode = 1
77
})
88

9-
export interface SharedCLI extends program.CommanderStatic {
9+
export interface SharedCLI extends Command {
1010
/** Should we be posting as much info as possible? */
1111
verbose: boolean
1212
/** Output to STDOUT instead of leaving a comment */

‎source/runner/dslGenerator.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { DangerDSLJSONType } from "../dsl/DangerDSL"
33
import { CliArgs } from "../dsl/cli-args"
44
import { CISource } from "../ci_source/ci_source"
55
import { emptyGitJSON } from "../platforms/github/GitHubGit"
6-
import { CommanderStatic } from "commander"
6+
import { Command } from "commander"
77

88
export const jsonDSLGenerator = async (
99
platform: Platform,
1010
source: CISource,
11-
program: CommanderStatic
11+
program: Command
1212
): Promise<DangerDSLJSONType> => {
1313
const useSimpleDSL = platform.getPlatformReviewSimpleRepresentation && source.useEventDSL
1414

@@ -27,7 +27,7 @@ export const jsonDSLGenerator = async (
2727
id: program.id,
2828
textOnly: program.textOnly,
2929
verbose: program.verbose,
30-
staging: program.staging
30+
staging: program.staging,
3131
}
3232

3333
const dslPlatformName = jsonDSLPlatformName(platform)

‎source/runner/jsonToContext.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { jsonToDSL } from "./jsonToDSL"
33
import { contextForDanger, DangerContext } from "./Dangerfile"
44
import { DangerDSLJSON } from "./dangerDSLJSON"
55
import { CISource } from "../ci_source/ci_source"
6-
import { CommanderStatic } from "commander"
6+
import { Command } from "commander"
77

88
/**
99
* Reads in the JSON string converts to a dsl object and gets the change context
@@ -12,12 +12,8 @@ import { CommanderStatic } from "commander"
1212
* @param program {any} commander
1313
* @returns {Promise<DangerContext>} context for danger
1414
*/
15-
export async function jsonToContext(
16-
JSONString: string,
17-
program: CommanderStatic,
18-
source: CISource
19-
): Promise<DangerContext> {
20-
const dslJSON = { danger: new DangerDSLJSON(JSONString, (program as any) as CliArgs) }
15+
export async function jsonToContext(JSONString: string, program: Command, source: CISource): Promise<DangerContext> {
16+
const dslJSON = { danger: new DangerDSLJSON(JSONString, program as any as CliArgs) }
2117
const dsl = await jsonToDSL(dslJSON.danger, source)
2218
return contextForDanger(dsl)
2319
}

0 commit comments

Comments
 (0)