Skip to content

Commit

Permalink
Merged by Peril
Browse files Browse the repository at this point in the history
docs: fix typo
  • Loading branch information
peril-staging[bot] committed Mar 6, 2019
2 parents 3a8e6cb + 2da9396 commit dfe4535
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<!-- Your comment below this -->

- Docs: fix typo - [@hiroppy]
- Fixed: isCI check for Codeship - [@msteward]

# 7.0.14
Expand Down
33 changes: 19 additions & 14 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
## How does Danger JS work?

Danger provides an evaluation system for creating per-application rules. Basically, it is running arbitrary JavaScript with some extra PR metadata added in at runtime.
Danger provides an evaluation system for creating per-application rules. Basically, it is running arbitrary JavaScript
with some extra PR metadata added in at runtime.

Actually doing that though, is a bit of a process.

## Setup

**Step 1: CI**. Danger needs to figure out what CI we're running on. You can see them all [in `source/ci_source/providers`][provs]. These use
ENV VARs to figure out which CI `danger ci` is running on and validate whether it is a pull request.
**Step 1: CI**. Danger needs to figure out what CI we're running on. You can see them all [in
`source/ci_source/providers`][provs]. These use ENV VARs to figure out which CI `danger ci` is running on and validate
whether it is a pull request.

**Step 2: Platform**. Danger needs to know which platform the code review is happening in. Today it's just GitHub, but BitBucket Server is around the corner.
**Step 2: Platform**. Danger needs to know which platform the code review is happening in. Today it's just GitHub, but
BitBucket Server is around the corner.

**Step 3: JSON DSL**. To allow for all of:

* `danger ci` to evaluate async code correctly
* `danger process` to work with other languages
* `peril` to arbitrarily sandbox danger per-run on a unique docker container
- `danger ci` to evaluate async code correctly
- `danger process` to work with other languages
- `peril` to arbitrarily sandbox danger per-run on a unique docker container

Danger first generates a JSON DSL. This can be passed safely between processes, or servers. For `danger ci` the exposed DSL is created
as a [DangerDSLJSONType][dangerdsl] and this is passed into the hidden [command `danger runner`][runner].
Danger first generates a JSON DSL. This can be passed safely between processes, or servers. For `danger ci` the exposed
DSL is created as a [DangerDSLJSONType][dangerdsl] and this is passed into the hidden [command `danger runner`][runner].

**Step 4: DSL**. The JSON DSL is picked up from STDIN in `danger runner` and then converted into a [DangerDSLType][dangerdsl]. This is basically where
functions are added into the DSL.
**Step 4: DSL**. The JSON DSL is picked up from STDIN in `danger runner` and then converted into a
[DangerDSLType][dangerdsl]. This is basically where functions are added into the DSL.

**Step 5: Evaluation**. With the DSL ready, the [inline runner][in_runner] sets up a transpiled environment for evaluating your code, and adds the DSL attributes into the global evaluation context. The Dangerfile has the `import {...} from 'danger'` stripped, and then is executed inline.
**Step 5: Evaluation**. With the DSL ready, the [inline runner][in_runner] sets up a transpiled environment for
evaluating your code, and adds the DSL attributes into the global evaluation context. The Dangerfile has the
`import {...} from 'danger'` stripped, and then is executed inline.

**Step 6: Results**. Once the `danger runner` process is finished with evaluation, the results are passed back to the the plaform. The platform then
chooses whether to create/delete/edit any messages in core review.
**Step 6: Results**. Once the `danger runner` process is finished with evaluation, the results are passed back to the
the platform. The platform then chooses whether to create/delete/edit any messages in core review.

[provs]: https://github.com/danger/danger-js/tree/master/source/ci_source/providers
[dangerdsl]: https://github.com/danger/danger-js/blob/master/sourformace/dsl/DangerDSL.ts
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/danger-process.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The JSON is documented using JSON Schema: [incoming][] and [outgoing][], these l
the types (incoming to your process) [DangerJSONDSLType][] and (coming out from your process) [DangerResults][],

I plan to add a full reference for this, similar to the reference for the user's DSL in the future in these docs.
_Note:_ The JSON **will include** your access token, so you probably want to sanitize that before commiting it to the
_Note:_ The JSON **will include** your access token, so you probably want to sanitize that before committing it to the
repo. I accidentally shipped 2 tokens in writing the feature.

A runner can output anything during the process to STDOUT, and it will be logged to the user. However, Danger JS is
Expand Down

0 comments on commit dfe4535

Please sign in to comment.