diff --git a/changelog.md b/changelog.md index 478e16c5e..36a1a7ab5 100644 --- a/changelog.md +++ b/changelog.md @@ -2,7 +2,7 @@ // These docs are aimed at users rather than danger developers, so please limit technical // terminology to in here. -### Master +// ### Master ### 2.0.0-beta.1 @@ -22,22 +22,26 @@ - Adds a `--js` and `--json` option to `danger pr` which shows the output in a way that works with `danger process`. This means you can preview the data for any pull request. +./[@orta][] + ### 2.0.0-alpha.20 -- Moves away from vm2 to a require-based Dangerfile runner. This removes the sandboxing aspect of - the Dangerfile completely, but the sandboxing was mainly for Peril and I have a plan for that. +Moves away from vm2 to a require-based Dangerfile runner. This removes the sandboxing aspect of +the Dangerfile completely, but the sandboxing was mainly for Peril and I have a plan for that. + +https://github.com/danger/peril/issues/159 - https://github.com/danger/peril/issues/159 +I would like to move the main parts of Danger JS to also work like `danger process`, so I'll +be continuing to work as a alpha for a bit more. One interesting side-effect of this could be that +I can remove `schedule` from the DSL. I've not tested it yet though. Turns out this change is _real_ +hard to write tests for. I've made #394 for that. - I would like to move the main parts of Danger JS to also work like `danger process`, so I'll - be continuing to work as a alpha for a bit more. One interesting side-effect of this could be that - I can remove `schedule` from the DSL. I've not tested it yet though. Turns out this change is _real_ - hard to write tests for. I've made #394 for that. +./[@orta][] ### 2.0.0-alpha.18 - 19 -- Moves internal methods away from Sync to avoid problems when running in Peril - ashfurrow -- Passes through non-zero exit codes from `danger process` runs - ashfurrow +- Moves internal methods away from Sync to avoid problems when running in Peril - [@ashfurrow][] +- Passes through non-zero exit codes from `danger process` runs - [@ashfurrow][] ### 2.0.0-alpha.17 @@ -48,10 +52,10 @@ Some UX fixes: -- Don't show warnings about not setting a commit status (unless in verbose) - orta -- Delete duplicate Danger message, due to fast Peril edits - orta -- Show Peril in the commit status if inside Peril, not just Danger - orta -- [internal] Tightened the typings on the commands, and abstracted them to share some code - orta +- Don't show warnings about not setting a commit status (unless in verbose) - [@orta][] +- Delete duplicate Danger message, due to fast Peril edits - [@orta][] +- Show Peril in the commit status if inside Peril, not just Danger - [@orta][] +- [internal] Tightened the typings on the commands, and abstracted them to share some code - [@orta][] ### 2.0.0-alpha.15 @@ -59,23 +63,23 @@ Some UX fixes: ### 2.0.0-alpha.14 -- Adds a blank project generated in travis 8 to test no-babel or TS integration - orta -- Improvements to `danger process` logging, and build fails correctly #363 - orta +- Adds a blank project generated in travis 8 to test no-babel or TS integration - [@orta][] +- Improvements to `danger process` logging, and build fails correctly #363 - [@orta][] ### 2.0.0-alpha.13 -- Improve the error handling around the babel API - #357 - orta -- Move back to the original URLs for diffs, instead of relying on PR metadata - orta -- Updates the types for `schedule` to be more accepting of what it actually takes - orta +- Improve the error handling around the babel API - #357 - [@orta][] +- Move back to the original URLs for diffs, instead of relying on PR metadata - [@orta][] +- Updates the types for `schedule` to be more accepting of what it actually takes - [@orta][] ### 2.0.0-alpha.12 - Fixed #348 invalid json response body error on generating a diff - felipesabino -- Potential fix for ^ that works with Peril also - orta +- Potential fix for ^ that works with Peril also - [@orta][] ### 2.0.0-alpha.11 -* Doh, makes the `danger process` command actually available via the CLI - orta +* Doh, makes the `danger process` command actually available via the CLI - [@orta][] ### 2.0.0-alpha.10 @@ -106,7 +110,7 @@ Some UX fixes: Which is basically Ruby Danger in ~10LOC. Lols. - This is the first release of the command, it's pretty untested, but [it does work][swift-first-pr]. - orta + This is the first release of the command, it's pretty untested, but [it does work][swift-first-pr]. - [@orta][] [danger-swift]: https://github.com/danger/danger-swift [swift-json]: https://github.com/danger/danger-swift/blob/master/fixtures/eidolon_609.json @@ -122,26 +126,26 @@ Some UX fixes: internal infra which is pretty awesome. All TS tests passed. Babel 7 is still in alpha, but so is Danger 2.0 - so I'm happy to keep Danger in a pretty long alpha, till at least Babel 7 is in beta. - It also still supports using TypeScript via the "`typescript"` module, if you have that installed. - orta + It also still supports using TypeScript via the "`typescript"` module, if you have that installed. - [@orta][] -* `danger.github.thisPR` now uses the PR's head, not base - orta +* `danger.github.thisPR` now uses the PR's head, not base - [@orta][] ### 2.0.0-alpha.8 -* Uses the GitHub `diff_url` instead of the `diff` version header, as it conflicted with Peril - orta +* Uses the GitHub `diff_url` instead of the `diff` version header, as it conflicted with Peril - [@orta][] * Handle exceptions in Dangerfile and report them as failures in Danger results - macklinu ### 2.0.0-alpha.6-7 -* Expose a Promise object to the external GitHub API - orta +* Expose a Promise object to the external GitHub API - [@orta][] ### 2.0.0-alpha.4-5 -* Allow running a dangerfile entirely from memory using the `Executor` API - orta +* Allow running a dangerfile entirely from memory using the `Executor` API - [@orta][] ### 2.0.0-alpha.2-3 -* Removes the `jest-*` dependencies - orta +* Removes the `jest-*` dependencies - [@orta][] ### 2.0.0-alpha.1 @@ -177,21 +181,21 @@ Some UX fixes: ### 1.2.0 -- Exposes an internal API for reading a file from a GitHub repo as `danger.github.utils.fileContents` - orta +- Exposes an internal API for reading a file from a GitHub repo as `danger.github.utils.fileContents` - [@orta][] Ideally this is what you should be using in plugins to read files, it's what Danger uses throughout the codebase internally. This means that your plugin/dangerfile doesn't need to rely on running on the CI when instead it could run via the GitHub API. -- Update prettier - orta +- Update prettier - [@orta][] - Removes dtslint as a dependency - sapegin/orta ### 1.1.0 - Support retrive paginated pull request commit list - kwonoj - Add support for VSTS CI - mlabrum -- Remove the DSL duplication on the `danger` export, it wasn't needed or used. - orta -- Update to TypeScript 2.4.x - orta +- Remove the DSL duplication on the `danger` export, it wasn't needed or used. - [@orta][] +- Update to TypeScript 2.4.x - [@orta][] - Rename github test static_file to remove `:` from the filename to fix a checkout issue on windows - mlabrum ### 1.0.0 @@ -202,7 +206,7 @@ and now it's 30th June 2017. It's awesome to look back through the CHANGELOG and You can find out a lot more about the 1.0, and Danger's history on my [Artsy blog post on the Danger 1.0](https://artsy.github.io/blog/2017/06/30/danger-one-oh-again/). -- Adds inline docs for all CI providers - orta +- Adds inline docs for all CI providers - [@orta][] ### 0.21.1 @@ -213,14 +217,14 @@ You can find out a lot more about the 1.0, and Danger's history on my [Artsy blo ### 0.21.0 -- Posts status reports for passing/failing builds, if the account for danger has access - orta -- Adds prettier to the codebase - orta -- Converts a bunch of Danger's dangerfile into a plugin - [danger-plugin-yarn](https://github.com/orta/danger-plugin-yarn) - orta +- Posts status reports for passing/failing builds, if the account for danger has access - [@orta][] +- Adds prettier to the codebase - [@orta][] +- Converts a bunch of Danger's dangerfile into a plugin - [danger-plugin-yarn](https://github.com/orta/danger-plugin-yarn) - [@orta][] This is my first non-trivial plugin, based on infrastructure from @macklinu. Plugins are looking great, you can get some info at . -- Docs updates for the website - orta +- Docs updates for the website - [@orta][] ### 0.20.0 @@ -233,7 +237,7 @@ Plugins are looking great, you can get some info at `danger.github.pr`, I've also created interfaces for them - orta -- `warn`, `message`, `markdown` are all ported over to DangerJS - orta -- Shows a HTML table for Danger message - orta -- Now offers a Flow-typed definition file, it's not shipped to their repo yet, you can make it by `npm run export-flowtype` - orta -- Started turning this into a real project by adding tests - orta +- `danger.pr` -> `danger.github.pr`, I've also created interfaces for them - [@orta][] +- `warn`, `message`, `markdown` are all ported over to DangerJS - [@orta][] +- Shows a HTML table for Danger message - [@orta][] +- Now offers a Flow-typed definition file, it's not shipped to their repo yet, you can make it by `npm run export-flowtype` - [@orta][] +- Started turning this into a real project by adding tests - [@orta][] ### 0.0.5-0.0.10 -- Changes some files casing, added some logs, a bit of error reporting, and verifying everything works through npm - orta +- Changes some files casing, added some logs, a bit of error reporting, and verifying everything works through npm - [@orta][] ### 0.0.4 -- Danger edit an existing post, and delete it when it's not relevant - orta +- Danger edit an existing post, and delete it when it's not relevant - [@orta][] ### 0.0.3 -- Danger will post a comment on a GitHub PR with any Fails - orta +- Danger will post a comment on a GitHub PR with any Fails - [@orta][] ### 0.0.2 @@ -679,11 +683,13 @@ if (!hasChangelog) { That should do ya. I think. This doesn't support babel, and I haven't explored using other modules etc, so... -./ +./[@orta][] ### 0.0.1 -Not usable for others, only stubs of classes etc. - orta +Not usable for others, only stubs of classes etc. - [@orta][] [danger-swift]: https://github.com/danger/danger-swift#danger-swift [danger-go]: https://github.com/bdotdub/danger-go +[@orta]: https://github.com/orta +[@ashfurrow]: https://github.com/ashfurrow diff --git a/docs/tutorials/typescript.html.md b/docs/tutorials/typescript.html.md index 5fd097d1d..d993b7e6f 100644 --- a/docs/tutorials/typescript.html.md +++ b/docs/tutorials/typescript.html.md @@ -8,22 +8,5 @@ blurb: Specifics on using Danger with TypeScript. ### TypeScript -Danger is built in TypeScript, so we have great editor support as a consumer. If you are using Jest for testing, -then the only thing you need to do is change your Dangerfile to be `dangerfile.ts` and Danger will pick it up. - -### TypeScript without Jest - -You'll need to take the following steps for danger to evaluate your `dangerfile.ts`: - -- Install the `ts-jest` package - `yarn add ts-jest --dev` -- Add the following `jest` section to your `package.json` - -```json -{ - "jest": { - "transform": { - ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" - } - } -} -``` +Danger is built in TypeScript, so we have great editor support as a consumer. If you have typescript inside your +`package.json` and use `.ts` as a file extension Danger will pre-compile your TypeScript file. diff --git a/docs/usage/danger-process.md b/docs/usage/danger-process.html.md similarity index 67% rename from docs/usage/danger-process.md rename to docs/usage/danger-process.html.md index 51beedf07..bb7ecfc4b 100644 --- a/docs/usage/danger-process.md +++ b/docs/usage/danger-process.html.md @@ -8,7 +8,8 @@ blurb: How to use `danger process` to create a Danger runner for any language. ## Danger Process -In version 2.0.0 and above, Danger comes with a new command: `danger process`. This command should have all the same parameters as `danger` and is meant to be an optional replacement. It's idea is that the responsibilities of Danger can +In version 2.0.0 and above, Danger comes with a new command: `danger process`. This command should have all the same +parameters as `danger` and is meant to be an optional replacement. It's idea is that the responsibilities of Danger can be split into three steps: * Dangerfile DSL setup. @@ -16,8 +17,8 @@ be split into three steps: * Handling the results of the Dangerfile run. Danger JS will handle the first and the last steps, and another process will handle the second. This means most of the -really tricky work stays inside Danger, and the other process can only has to worry about translating the DSL into something -that feels natural in the environment of your app. +really tricky work stays inside Danger, and the other process can only has to worry about translating the DSL into +something that feels natural in the environment of your app. ### Implementing a Danger Process Runner @@ -30,7 +31,7 @@ You can preview the DSL which will be sent to your process via `danger pr` with danger pr https://github.com/danger/danger-js/pull/395 --js ``` -This shows you DSL as a JavaScript object - this is easier to read and syntax highlighted, if you'd like a data fixture however, use `--json`: +This shows you DSL as a JavaScript object - this is easier to read and syntax highlighted. If you'd like a data fixture, use `--json`: ```sh danger pr https://github.com/danger/danger-js/pull/395 --json > danger-js-395.dsl.json @@ -38,7 +39,9 @@ danger pr https://github.com/danger/danger-js/pull/395 --json > danger-js-395.ds This will work for any open repo, and if you've set up your local shell to include `DANGER_GITHUB_API_TOKEN` then you can use this with any private repository too. The JSON schema is documented in Danger JS's types as [DangerJSONDSLType][]. 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 sanitze that before commiting it to the repo. +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 sanitze that before commiting 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 listening for a JSON response in this format: @@ -52,8 +55,9 @@ listening for a JSON response in this format: } ``` -Note: `"markdowns"` is a string array, everything else is an object with message. When Danger supports inline messages, -then `"file"` and `"line"` will also be supported in the violation. +_Note:_ `"markdowns"` is a string array, everything else is an object with message. I think this will change eventually. +When Danger supports inline messages, then `"file"` and `"line"` will also be supported in the violation. +_Note:_ I'd like to add some sort of versioning to this. ### Some Examples @@ -75,24 +79,28 @@ require 'json' STDOUT.write(results.to_json) ``` -As Ruby is duck-typed, it doesn't need any infrastructure. You can parse the incoming JSON into an object, then work with the -standard library to provide a Dangerfile environment. If you saved this file as `dangerfile.rb`, and `chmod +x dangerfile.rb` then you can run `danger process 'dangerfile.rb`. +As Ruby is duck-typed, it doesn't need any infrastructure. You can parse the incoming JSON into an object, then work +with the standard library to provide a Dangerfile environment. If you saved this file as `dangerfile.rb`, and +`chmod +x dangerfile.rb` then you can run `danger process 'dangerfile.rb`. Let's look at something a bit more complex. [Danger Swift][danger-swift]. Danger Swift aims to act more like a peer to Danger JS/Ruby, and so it is a two step process. The first process' job is to evaluate a user's Dangerfile instead of the rule evaluation happening inside the initial process. -Which means the code a user of Danger Swift only has to handle the DSL, and not the message receiving/sending to Danger JS. +Which means the code _a user of Danger Swift_ writes has to handle the DSL, and not the message receiving/sending +to Danger JS. -To annoated this, Danger Swift takes a [JSON][swift-json] document via [STDIN][swift-stdin], [compiles and evaluates][swift-eval] a [Swift file][swift-dangerfile] and then passes the results back to `danger process` via [STDOUT][swift-stdout]. +To show you how this process works, Danger Swift takes a [JSON][swift-json] document via [STDIN][swift-stdin], +[compiles and evaluates][swift-eval] a [Swift file][swift-dangerfile] and then passes the results back to +`danger process` via [STDOUT][swift-stdout]. ### Things You Probably Have To Do At least to make it shine: * Implement a few of the functions inside the Danger DSL (`sentence`, `fileLink` in particular are useful) -* Implement a GitHub API, today you can use `ENV["DANGER_GITHUB_TOKEN"]` to get the user's access token +* Implement a GitHub API, there is a settings object which includes all the github metadata needed to set it up That's probably it. You will need to provide instructions for someone with no node experience to set up Danger JS. On a Mac, that looks like: @@ -102,8 +110,9 @@ brew install node npm install -g danger ``` -It's pretty likely that your CI already has node, so it can just be `npm install -g danger`. +It's pretty likely that your CI already has node, so it can just be `npm install -g danger`. If not, look [into nvm][]. +Finally, let me ([@orta][]) know! I want to keep track of them all on the Danger Systems site :+1:. [danger-swift]: https://github.com/danger/danger-swift [swift-json]: https://github.com/danger/danger-swift/blob/master/fixtures/eidolon_609.json @@ -113,3 +122,5 @@ It's pretty likely that your CI already has node, so it can just be `npm install [swift-stdout]: https://github.com/danger/danger-swift/blob/1576e336e41698861456533463c8821675427258/Sources/Runner/main.swift#L48-L50 [swift-first-pr]: https://github.com/danger/danger-swift/pull/12 [DangerJSONDSLType]: https://github.com/danger/danger-js/blob/master/source/dsl/DangerDSL.ts +[into nvm]: https://github.com/creationix/nvm +[@orta]: https://github.com/orta