Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #27 from contiamo/next
Browse files Browse the repository at this point in the history
4.0.1
  • Loading branch information
Tejas Kumar authored Aug 14, 2018
2 parents 6f1b79c + 60f4947 commit f800395
Show file tree
Hide file tree
Showing 9 changed files with 1,354 additions and 7,433 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file tells Travis what's up
language: node_js
node_js:
- stable

notifications:
email: false

# This allows tests to run more efficiently without leaking memory
# More info: https://facebook.github.io/jest/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-and-or-continuous-integration-ci-server
env:
- JEST_MAX_WORKERS: 4

# When Travis gets notified of a new build, do this
script:
- yarn ci
- yarn danger ci
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Changelog](#changelog)
- [v4.0.1](#v401)
- [v4.0.0](#v400)
- [v4.0.0-9](#v400-9)
- [v3.0.3](#v303)
Expand All @@ -17,6 +18,16 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v4.0.1](https://github.com/contiamo/restful-react/compare/v4.0.0...v4.0.1)

> 14 August 2018
- Add seconds to prefer header [`#26`](https://github.com/contiamo/restful-react/pull/26)
- Infra/dx [`#24`](https://github.com/contiamo/restful-react/pull/24)
- Add Danger [`3bc4a0a`](https://github.com/contiamo/restful-react/commit/3bc4a0ac6773c0bc40490d9fea203611c1d4e520)
- Output Jest results [`ec19022`](https://github.com/contiamo/restful-react/commit/ec19022686ec64e8962dee1ee4a34d113f824296)
- Add Build Status [`5ab6f79`](https://github.com/contiamo/restful-react/commit/5ab6f79b4be5d7d97ab18090ccb94f911b0efbda)

#### [v4.0.0](https://github.com/contiamo/restful-react/compare/v4.0.0-9...v4.0.0)

> 8 August 2018
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# RESTful React

[![Build Status](https://travis-ci.org/contiamo/restful-react.svg?branch=master)](https://travis-ci.org/contiamo/restful-react)

Building React apps that interact with a backend API presents a set of questions, challenges and potential gotchas. This project aims to remove such pitfalls, and provide a pleasant developer experience when crafting such applications. It can be considered a thin wrapper around the [fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) in the form of a React component.

As an abstraction, this tool allows for greater consistency and maintainability of dynamic codebases.
Expand Down
60 changes: 60 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as child_process from "child_process";
import { danger, markdown, warn } from "danger";
import jest from "danger-plugin-jest";
import * as fs from "fs";
import { includes } from "lodash";

// Setup
const pr = danger.github.pr;
const modified = danger.git.modified_files;
const added = danger.git.created_files;

const packageChanged = includes(modified, "package.json");
const wrongLockfileChanged = includes([...modified, ...added], "package-lock.json");

if (packageChanged && wrongLockfileChanged) {
fail(
"This PR contains `package-lock.json`, but we expect a `yarn.lock` instead as yarn is the preferred package manager for this project. We should not have to maintain two lockfiles.",
);
}

// No PR is too small to warrant a paragraph or two of summary
if (pr.body.length === 0) {
fail("Please add a description to your PR.");
}

// Warn when there is a big PR
const bigPRThreshold = 500;

if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
warn(":exclamation: Big PR");
}

// Always ensure we assign someone, so that our Slackbot can do its work correctly
if (pr.assignee === null) {
fail("Please assign someone to merge this PR, and optionally include people who should review.");
}

// Show TSLint errors inline
// Yes, this is a bit lossy, we run the linter twice now, but its still a short amount of time
// Perhaps we could indicate that tslint failed somehow the first time?
// This process should always fail, so needs the `|| true` so it won't raise.
child_process.execSync(`npm run lint -- -- --format json --out tslint-errors.json || true`);

if (fs.existsSync("tslint-errors.json")) {
const tslintErrors = JSON.parse(fs.readFileSync("tslint-errors.json", "utf8")) as any[];
if (tslintErrors.length) {
const errors = tslintErrors.map(error => {
const format = error.ruleSeverity === "ERROR" ? ":no_entry_sign:" : ":warning:";
const linkToFile = danger.github.utils.fileLinks([error.name]);
return `* ${format} ${linkToFile} - ${error.ruleName} - ${error.failure}`;
});
const tslintMarkdown = `
## TSLint Issues:
${errors.join("\n")}
`;
markdown(tslintMarkdown);
}
}

jest();
Loading

0 comments on commit f800395

Please sign in to comment.