Skip to content

Commit

Permalink
Merge branch 'master' into proxy-support
Browse files Browse the repository at this point in the history
  • Loading branch information
steprescott authored Oct 18, 2018
2 parents b20437f + 149713d commit 3a5e156
Show file tree
Hide file tree
Showing 27 changed files with 658 additions and 185 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jspm_packages
# Optional REPL history
.node_repl_history

distribution
distribution
brew-distribution
flow-typed
env/development.env

Expand Down
35 changes: 18 additions & 17 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
source
**/_tests
flow-typed
.babelrc
.editorconfig
.flowconfig
.jest
.vscode
docs
*.yml
*.lock
.flowconfig
.editorconfig
.babelrc
scripts
*.yml
**/_tests
brew-distribution
coverage
dangerfile.circle.js
dangerfile.flow.js
dangerfile.lite.ts
dangerfile.ts
docs
env
flow-typed
jsconfig.json
coverage
.jest
types
tsconfig
scripts
source
test-results.json
test.json
yarn-error.log
dangerfile.circle.js
dangerfile.flow.js
dangerfile.lite.ts
tests.json
tsconfig
tsconfig.json
tsconfig.production.json
tslint.json
types
wallaby.js
yarn-error.log
10 changes: 10 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"github": {
"release": true,
"assets": "brew-distribution/*.zip"
},
"buildCommand": "yarn package",
"src": {
"afterReleaseCommand": "VERSION=${version} scripts/create-homebrew-tap-pr.sh"
}
}
164 changes: 81 additions & 83 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,92 @@ language: node_js
cache:
yarn: true
directories:
- node_modules
- .jest/cache
- node_modules
- .jest/cache

matrix:
include:
# Normal CI test runs :D
- node_js: '6'
- node_js: '10'

- node_js: '8'
after_script:
- rm -rf node_modules/@types/babel-*
- rm -rf node_modules/@types/babylon
- echo "Testing that the Danger d.ts file lints"
- yarn docs
- yarn add dtslint@0.1.2
- yarn dts-lint
- echo "Testing Flow definition file"
- yarn build:flow-types
- yarn flow check

# Checks every example dangerfile can run in `danger runner`.
- node_js: '8.4'
script:
- yarn build
- node scripts/run-fixtures.js

# Does the real danger run
- node_js: '9'
script:
- yarn jest --outputFile test-results.json --json --runInBand
- yarn run link

# If the PR is odd then run using issue commenting, else use checks
# - |
# if [ $(($TRAVIS_PULL_REQUEST % 2)) -eq 0 ];
# then
# echo "This is the real `danger ci` run on this repo, using issues";
# DEBUG="*" danger ci --verbose;
# else
# echo "This is the real `danger ci` run on this repo, using github checks with a custom app";
# DEBUG="*" DANGER_GITHUB_APP_ID=12482 danger ci --verbose;
#
# echo "This is the real `danger ci` run on this repo, using github checks with the danger app";
# DEBUG="*" DANGER_JS_APP_INSTALL_ID=177994 danger ci --verbose;
# fi

- DEBUG="*" DANGER_GITHUB_APP_ID=12482 danger ci --verbose;

- echo "Validating that danger pr works as expected"
- DEBUG="*" danger pr https://github.com/danger/danger-js/pull/465 --dangerfile dangerfile.circle.js --verbose

- echo "Grabbing master so that danger-local can use it for comparison"
- git checkout -t origin/master || true
- '[ ! -z $TRAVIS_PULL_REQUEST ] && DEBUG="*" danger local --dangerfile source/platforms/git/_tests/local_dangerfile_example.ts || echo "Skipping Danger Local for non PR run"'



# Create some fake projects at runtime
- node_js: '7'
script:
- echo "This is only for Integration tests on two blank projects"
- yarn build
- mkdir danger_blank_test
- cd danger_blank_test
- yarn init --yes
- yarn add file:..
- echo "warn('I warned you')" > dangerfile.js
- echo "Testing a blank Dangerfile on an empty project"
- DEBUG="*" yarn danger run --text-only
- cd ..
- rm -rf danger_blank_test

- npm install -g create-react-app
- create-react-app danger_babel_test
- cd danger_babel_test
- yarn add file:..
- echo "warn('Expect 2 warnings'); const a = async () => {warn('the other');}; schedule(a)" > dangerfile.js
- echo "Testing a blank Dangerfile on a babel CRA project"
- DEBUG="*" yarn danger ci --text-only
- cd ..
- rm -rf danger_babel_test

# Normal CI test runs :D
- node_js: "6"
- node_js: "10"

- node_js: "8"
after_script:
- rm -rf node_modules/@types/babel-*
- rm -rf node_modules/@types/babylon
- echo "Testing that the Danger d.ts file lints"
- yarn docs
- yarn add dtslint@0.1.2
- yarn dts-lint
- echo "Testing Flow definition file"
- yarn build:flow-types
- yarn flow check

# Checks every example dangerfile can run in `danger runner`.
- node_js: "8.4"
script:
- yarn build
- node scripts/run-fixtures.js

# Does the real danger run
- node_js: "9"
script:
- yarn jest --outputFile test-results.json --json --runInBand
- yarn run link

# If the PR is odd then run using issue commenting, else use checks
# - |
# if [ $(($TRAVIS_PULL_REQUEST % 2)) -eq 0 ];
# then
# echo "This is the real `danger ci` run on this repo, using issues";
# DEBUG="*" danger ci --verbose;
# else
# echo "This is the real `danger ci` run on this repo, using github checks with a custom app";
# DEBUG="*" DANGER_GITHUB_APP_ID=12482 danger ci --verbose;
#
# echo "This is the real `danger ci` run on this repo, using github checks with the danger app";
# DEBUG="*" DANGER_JS_APP_INSTALL_ID=177994 danger ci --verbose;
# fi

- DEBUG="*" DANGER_GITHUB_APP_ID=12482 danger ci --verbose;

- echo "Validating that danger pr works as expected"
- DEBUG="*" danger pr https://github.com/danger/danger-js/pull/465 --dangerfile dangerfile.circle.js --verbose

- echo "Grabbing master so that danger-local can use it for comparison"
- git checkout -t origin/master || true
- '[ ! -z $TRAVIS_PULL_REQUEST ] && DEBUG="*" danger local --dangerfile
source/platforms/git/_tests/local_dangerfile_example.ts || echo "Skipping Danger Local for non PR run"'

# Create some fake projects at runtime
- node_js: "8.12"
script:
- echo "This is only for Integration tests on two blank projects"
- yarn build
- mkdir danger_blank_test
- cd danger_blank_test
- yarn init --yes
- yarn add file:..
- echo "warn('I warned you')" > dangerfile.js
- echo "Testing a blank Dangerfile on an empty project"
- DEBUG="*" yarn danger run --text-only
- cd ..
- rm -rf danger_blank_test

- npm install -g create-react-app
- create-react-app danger_babel_test
- cd danger_babel_test
- yarn add file:..
- echo "warn('Expect 2 warnings'); const a = async () => {warn('the other');}; schedule(a)" > dangerfile.js
- echo "Testing a blank Dangerfile on a babel CRA project"
- DEBUG="*" yarn danger ci --text-only
- cd ..
- rm -rf danger_babel_test

script:
- yarn lint
- yarn add jest
- yarn jest --runInBand
- yarn lint
- yarn add jest
- yarn jest --runInBand

notifications:
slack: dangergem:9FOZou9EGBV9xO1Ol4bxRPz9
Expand Down
64 changes: 62 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,72 @@

## Master

# 4.0.1
# 4.4.9

- Fixed a bug where Danger would fail to update status when there are no failures or messages [@johansteffner][]
- Add logic for "DANGER_DISABLE_TRANSPILATION" env [@markelog][]
- Jenkins: Respect `CHANGE_URL`/`CHANGE_ID` for GitHub and BitBucket Server [@azz][]
- Docs: Guides - Update link to apollo-client dangerfile.ts example [@andykenward][]
- Fix crash that may occur when no message is set on generic event [@flovilmart][]

# 4.4.0-7

- Supports installation using Homebrew [@thii][]

# 4.3.x

- Some experimental beta builds which didn't turn out very useful

# 4.2.1

- Adds a fallback to `GITHUB_TOKEN` if it's in the ENV - orta
- There was some versioning faffing going on

# 4.1.0

- Adds the ability to send a PR from a Dangerfile easily.

```ts
import { danger } from "danger"

export default async () => {
// This is a map of file to contents for things to change in the PR
const welcomePR = {
LICENSE: "[the MIT license]",
"README.md": "[The README content]",
}

// Creates a new branch called `welcome`, from `master`. Creates a commit with
// the changes above and the message "Sets up ...". Then sends a PR to `orta/new-repo`
// with the title "Welcome to ..." and the body "Here is ...".
await danger.github.utils.createOrUpdatePR(
{
title: "Welcome to [org]",
body: "Here is your new repo template files",
owner: "orta",
repo: "new-repo",
baseBranch: "master",
newBranchName: "welcome",
commitMessage: "Sets up the welcome package",
},
welcomePR
)
}
```

OK, so this one is cool. This function will create/update an existing PR. You pass in a config object that defines;
the commit, the branch and the PR metadata and then this function will go and set all that up for you.

The second argument is a fileMap, this is an object like `{ "README.md": "[the content]" }` and it defines what files
should change in the commit. The files are completely changed to the content in the fileMap, so if you're making a
single line change - you need to submit the enfile file.

This is all based on my module
[memfs-or-file-map-to-github-branch](https://www.npmjs.com/package/memfs-or-file-map-to-github-branch) so if you need
a set of lower level APIs for PR/branch needs, `import` that and use it. - [@orta][]

# 4.0.1

- Fixed a bug where Danger would fail to update status when there are no failures or messages [@johansteffner][]
- Fixed a bug where Danger was throwing an error when removing any existing messages [@stefanbuck][]

# 4.0.0
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:10-slim

MAINTAINER Orta Therox

LABEL "com.github.actions.name"="Danger JS"
LABEL "com.github.actions.description"="Runs JavaScript/TypeScript Dangerfiles"
LABEL "com.github.actions.icon"="zap"
LABEL "com.github.actions.color"="blue"

ENTRYPOINT ["npx", "--package", "danger@beta", "--package", "typescript", "--package", "@babel/cli", "danger", "ci"]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ Following [this commit](https://github.com/danger/danger-js/commit/a26ac3b3bd4f0

- Checkout the `master` branch. Ensure your working tree is clean, and make sure you have the latest changes by running
`git pull`.
- Update `package.json` with the new version - for the sake of this example, the new version is **0.21.0**.
- Modify `changelog.md`, adding a new `### 0.21.0` heading under the `### Master` heading at the top of the file.
- Modify `changelog.md`, adding a new `# [version]` heading under the `### Master` heading at the top of the file.
- Commit both changes with the commit message **Version bump**.
- Publish - `npm publish`.
- Publish - `npm run release -- [major/patch/minor] --non-interactive`.

:ship:

Expand Down
2 changes: 1 addition & 1 deletion VISION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Danger for JS

Danger JS is a tool to creating complex per-project rules, and messages in Code Review. One of it's key aims is to be
Danger JS is a tool to creating complex per-project rules, and messages in Code Review. One of its key aims is to be
able to run on a server, and not need direct access to the filesystem to do its work.

It was started in mid-2016, and has fleshed out into a considerable set of useful tools.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/the_dangerfile.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ Some TypeScript examples:
[jest]: https://github.com/facebook/jest
[transpilation_guide]: /js/tutorials/transpilation.html
[changelog]: http://danger.systems/js/changelog.html
[apollo]: https://github.com/apollographql/apollo-client/blob/master/dangerfile.ts
[apollo]: https://github.com/apollographql/apollo-client/blob/master/config/dangerfile.ts
[bamlab]: https://github.com/bamlab/dev-standards/blob/master/dangerfile.js
1 change: 1 addition & 0 deletions env/development.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ DANGER_TEST_PR="327"
DANGER_GITHUB_API_TOKEN="123456789123456789123456789"
DANGER_VERBOSE="aye"
DANGER_VERBOSE_SHOW_TOKEN="yep"
DANGER_DISABLE_TRANSPILATION="false"
Loading

0 comments on commit 3a5e156

Please sign in to comment.