-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(commands): update type definition for commands
- Loading branch information
Showing
8 changed files
with
74 additions
and
85 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as program from 'commander'; | ||
|
||
program.parse(process.argv); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as program from 'commander'; | ||
|
||
program.parse(process.argv); | ||
|
||
console.log('Not Yet implmented'); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as program from 'commander'; | ||
import { getCISource } from '../ci_source/get_ci_source'; | ||
import { getPlatformForEnv } from '../platforms/platform'; | ||
import {Executor} from '../runner/Executor'; | ||
|
||
declare const global: any; | ||
|
||
program | ||
.option('-v, --verbose', 'Verbose output of files') | ||
.option('-c, --external-ci-provider [modulePath]', 'blah') | ||
.parse(process.argv); | ||
|
||
process.on('unhandledRejection', function(reason: string, _p: any) { | ||
console.log('Error: ', reason); | ||
process.exitCode = 1; | ||
}); | ||
|
||
if (process.env['DANGER_VERBOSE'] || (program as any).verbose) { | ||
global.verbose = true; | ||
} | ||
|
||
const source = getCISource(process.env, (program as any).externalCiProvider || undefined); | ||
|
||
if (!source) { | ||
console.log('Could not find a CI source for this run'); | ||
// Check for ENV["CI"] and wanr they might want a local command instead? | ||
process.exitCode = 1; | ||
} | ||
|
||
if (source && !source.isPR) { | ||
console.log('Skipping due to not being a PR'); | ||
} | ||
|
||
if (source && source.isPR) { | ||
const platform = getPlatformForEnv(process.env, source); | ||
if (!platform) { | ||
console.log(`Could not find a source code hosting platform for ${source.name}`); | ||
process.exitCode = 1; | ||
} | ||
|
||
if (platform) { | ||
console.log(`OK, looks good ${source.name} on ${platform.name}`); | ||
try { | ||
const exec = new Executor(source, platform); | ||
exec.setupAndRunDanger('dangerfile.js'); | ||
} catch (error) { | ||
process.exitCode = 1; | ||
console.error(error.message); | ||
console.error(error); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /usr/bin/env node | ||
|
||
// import app from "./app" | ||
import { version } from '../../package.json'; | ||
import * as program from 'commander'; | ||
|
||
// Provides the root node to the command-line architecture | ||
|
||
program | ||
.version(version) | ||
.command('run', 'Runs danger on your local system', {isDefault: true}) | ||
.command('init', 'Creates a new Dangerfile.js') | ||
.command('local', 'Runs your changes against ') | ||
.parse(process.argv); |