diff --git a/README.md b/README.md index e9444b768..ad6876836 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ Danger on Node, wonder what's going on? see [VISION.md](VISION.md) ### Get started? -This is like, kinda early. If you can take a bit of heat, it's usable in production as of 0.0.4. - -Bah, there's something wrong with the deploy. So for now, it's not working as an imported module. [See this PR](https://github.com/artsy/emission/pull/385). +This is like, kinda early. If you can take a bit of heat, it's usable in production as of 0.0.10. Note: There is basically no error reporting ATM. ### Early Adopters @@ -27,12 +25,12 @@ Then add a run command to your `Package.json` "danger": "danger" ``` -Then add a Dangerfile.js with some rules: +Then create a `dangerfile.js` in the project root with some rules: ```js import { danger, fail } from "danger" -// warn on changes in Package.json and not in shrinkwrap +// Make sure there are changelog entries const hasChangelog = danger.git.modified_files.includes("changelog.md") if (!hasChangelog) { fail("No Changelog changes!") diff --git a/changelog.md b/changelog.md index 17e1cf48d..553bc2cb3 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ // Add your own contribution below +### 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 + ### 0.0.4 * Danger edit an existing post, and delete it when it's not relevant - orta diff --git a/package.json b/package.json index f5d3aa946..caccfa368 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "danger", - "version": "0.0.4", + "version": "0.0.10", "description": "Automate your culture", "main": "distribution/danger.js", "bin": { @@ -19,6 +19,7 @@ "flow": "flow; test $? -eq 0 -o $? -eq 2", "lint": "eslint ./source", "fix": "eslint ./source --fix", + "prepublish": "npm run build", "build": "babel source --out-dir distribution --source-maps", "buildwatch": "babel source --watch --out-dir distribution", "link": "npm run build ; chmod +x distribution/commands/danger.js ; npm link" diff --git a/source/ci_source/fake.js b/source/ci_source/Fake.js similarity index 100% rename from source/ci_source/fake.js rename to source/ci_source/Fake.js diff --git a/source/ci_source/travis.js b/source/ci_source/Travis.js similarity index 100% rename from source/ci_source/travis.js rename to source/ci_source/Travis.js diff --git a/source/ci_source/_tests/_travis.test.js b/source/ci_source/_tests/_travis.test.js index 9ff4987e4..1d161cab7 100644 --- a/source/ci_source/_tests/_travis.test.js +++ b/source/ci_source/_tests/_travis.test.js @@ -1,4 +1,4 @@ -import Travis from "../travis.js" +import Travis from "../Travis" const correctEnv = { "HAS_JOSH_K_SEAL_OF_APPROVAL": "true", diff --git a/source/ci_source/ci_source.js b/source/ci_source/ci_source.js index d746b6f1e..1dea4cab7 100644 --- a/source/ci_source/ci_source.js +++ b/source/ci_source/ci_source.js @@ -35,8 +35,8 @@ export interface CISource { name: string } -import Travis from "./travis" -import Fake from "./fake" +import Travis from "./Travis" +import Fake from "./Fake" /** * Gets a CI Source form the current environment, by asking all known diff --git a/source/platforms/github.js b/source/platforms/GitHub.js similarity index 100% rename from source/platforms/github.js rename to source/platforms/GitHub.js diff --git a/source/platforms/platform.js b/source/platforms/platform.js index 94c1d3262..4b45c7278 100644 --- a/source/platforms/platform.js +++ b/source/platforms/platform.js @@ -60,7 +60,7 @@ export interface Platform { // async editComment: (comment: Comment, newBody: string) => Promise; // } -import { GitHub } from "./github" +import { GitHub } from "./GitHub" /** * Pulls out a platform for Danger to communicate on based on the environment diff --git a/source/runner/Dangerfile.js b/source/runner/Dangerfile.js index 68eca2461..d37af3666 100644 --- a/source/runner/Dangerfile.js +++ b/source/runner/Dangerfile.js @@ -50,17 +50,29 @@ export default class Dangerfile { const context: any = { fail, console, + require, danger: this.dsl } - script.runInNewContext(context) + console.log("Running Script") + try { + script.runInNewContext(context) + } + catch (e) { + console.log(e.toString()) + } + return results } readFile(path: String): Promise { return new Promise((resolve: any, reject: any) => { fs.readFile(path, "utf8", (err: Error, data: string) => { - if (err) { return reject(err) } + if (err) { + console.error("Error: " + err.message) + process.exitCode = 1 + return reject(err) + } resolve(data) }) }) diff --git a/source/runner/Executor.js b/source/runner/Executor.js index 3d650e1d5..8d7d70260 100644 --- a/source/runner/Executor.js +++ b/source/runner/Executor.js @@ -17,9 +17,12 @@ export default class Executor { async run() { const git = await this.platform.getReviewDiff() const pr = await this.platform.getReviewInfo() + console.log("Got github deets") + const dsl = new DangerDSL(pr, git) const dangerfile = new Dangerfile(dsl) const results = await dangerfile.run("dangerfile.js") + console.log("Got results") if (results.fails.length) { process.exitCode = 1