Skip to content

Commit

Permalink
Remove the DSL duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jul 24, 2017
1 parent baee6df commit 7a143a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Master

- Remove the DSL duplication on the `danger` export, it wasn't needed or used. - orta
- Update to TypeScript 2.4.x - orta

### 1.0.0

Hello readers! This represents a general stability for Danger. It is mainly a documentation release, as
Expand Down
28 changes: 2 additions & 26 deletions source/runner/Dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,38 +83,14 @@ export function contextForDanger(dsl: DangerDSLType): DangerContext {
const message = (message: MarkdownString) => results.messages.push({ message })
const markdown = (message: MarkdownString) => results.markdowns.push(message)

// Anything _but_ danger, that is on the root-level DSL
const globals = {
return {
schedule,
fail,
warn,
message,
markdown,
console,
results,
}

// OK, so this is a bit weird, but hear me out.
//
// I am not sure if it makes sense for "danger js plugins" ( which will
// be normal npm modules) to work with the magic globals available in the runtime.
//
// So I'm _probably_ going to advocate that you pass in the `danger` object into
// functions for danger plugins. This means that they can use `danger.fail` etc. This
// should make it significantly easier to build and make tests for your modules.
//
// Which should mean we get more plugins overall.
//
// Which should be cool.
//
// So, I'm not going to expose these on the interfaces (and thus the public reference
// but it will go into a 'plugin authors guide' whatever that looks like.)
//
return {
...globals,
danger: {
...dsl,
...globals,
},
danger: dsl,
}
}

0 comments on commit 7a143a2

Please sign in to comment.