diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba2a97b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +coverage diff --git a/README.md b/README.md index 14c5434..5bd59f5 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,12 @@ to your Github repository). 1. In this new file add the following: ```javascript - const travisbot = require('pr-bot'); + const prbot = require('pr-bot'); module.exports = { botUsername: `` plugins: [ - new travisbot.plugins.Size({ + new prbot.plugins.Size({ globPattern: '**/*.js', globOptions: { ignore: [ diff --git a/package.json b/package.json index fa63b15..1fecf4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pr-bot", - "version": "0.0.18", + "version": "0.0.1", "description": "A bot to run after Travis has run it's build's and tests.", "main": "src/npm-module.js", "bin": { @@ -14,7 +14,7 @@ "type": "git", "url": "git+https://github.com/gauntface/web-devrel-bot.git" }, - "author": "gauntface", + "author": "Google Web DevRel", "license": "Apache-2.0", "bugs": { "url": "https://github.com/gauntface/web-devrel-bot/issues" diff --git a/src/controllers/bot-runner.js b/src/controllers/bot-runner.js index 1651328..133e611 100644 --- a/src/controllers/bot-runner.js +++ b/src/controllers/bot-runner.js @@ -24,7 +24,7 @@ const TMPDIR_PREFIX = `/tmp/pr-bot/`; class TravisBot { constructor({configPath} = {}) { - logHelper.setPrimaryPrefix('TravisBot 🤖'); + logHelper.setPrimaryPrefix('PR-Bot 🤖'); if (!configPath) { configPath = path.resolve('pr-bot.config.js') @@ -178,11 +178,11 @@ class TravisBot { } _logGithubState(configuration, travisEnv, githubController, pluginResults) { - let githubComment = `# Results from Plugins\n\n`; + let githubComment = ``; const pluginNames = Object.keys(pluginResults); pluginNames.forEach((pluginName) => { const result = pluginResults[pluginName]; - githubComment += `## ${pluginName}\n\n`; + githubComment += `### ${pluginName}\n\n`; if (result.markdownLog) { githubComment += result.markdownLog; } else { diff --git a/src/plugins/size.js b/src/plugins/size.js index f796767..1382147 100644 --- a/src/plugins/size.js +++ b/src/plugins/size.js @@ -252,16 +252,18 @@ class SizePlugin extends PluginInterface { newTable = 'No new files have been added.'; } - return `## Changed File Sizes + return `#### Changed File Sizes ${changedTable} -## New Files +#### New Files ${newTable} +#### All File Sizes +
-All Files +View Table ${fullTable} diff --git a/test/node/plugins/test-size.js b/test/node/plugins/test-size.js index d71e34e..742e0f4 100644 --- a/test/node/plugins/test-size.js +++ b/test/node/plugins/test-size.js @@ -85,7 +85,7 @@ new-file.txt 21 B console.log(results.markdownLog); - expect(results.markdownLog).to.equal(`## Changed File Sizes + expect(results.markdownLog).to.equal(`#### Changed File Sizes | File | Before | After | Change | | | --- | --- | --- | --- | --- | @@ -95,14 +95,16 @@ new-file.txt 21 B | minor-change.txt | 7.126 KB | 7.125 KB | -0.01% | | | stays-the-same.txt | 29 B | 50 B | +72.41% | ☠️ | -## New Files +#### New Files | File | Size | | --- | --- | | new-file.txt | 21 B | +#### All File Sizes +
-All Files +View Table | File | Before | After | Change | | | --- | --- | --- | --- | --- | @@ -146,16 +148,18 @@ No new files have been added. console.log(results.markdownLog); - expect(results.markdownLog).to.equal(`## Changed File Sizes + expect(results.markdownLog).to.equal(`#### Changed File Sizes No file sizes have changed. -## New Files +#### New Files No new files have been added. +#### All File Sizes +
-All Files +View Table | File | Before | After | Change | | | --- | --- | --- | --- | --- | diff --git a/test/node/test-travis-bot.js b/test/node/test-travis-bot.js index 3ae00bc..4624492 100644 --- a/test/node/test-travis-bot.js +++ b/test/node/test-travis-bot.js @@ -147,7 +147,7 @@ describe('bot-runner', function() { const issueStub = sinon.stub(FakeGithubController.prototype, 'postIssueComment').callsFake((input) => { expect(input).to.deep.equal({ number: '123', - comment: '# Results from Plugins\n\n## Good Plugin.\n\nThis plugin provided no markdown output.\n\n## Good Plugin 2.\n\n`Hello from good plugin.`\n\n' + comment: '### Good Plugin.\n\nThis plugin provided no markdown output.\n\n### Good Plugin 2.\n\n`Hello from good plugin.`\n\n', }); return Promise.resolve(); }); @@ -168,7 +168,7 @@ describe('bot-runner', function() { const issueStub = sinon.stub(FakeGithubController.prototype, 'postIssueComment').callsFake((input) => { expect(input).to.deep.equal({ number: '123', - comment: '# Results from Plugins\n\n## Good Plugin.\n\nThis plugin provided no markdown output.\n\n## Good Plugin 2.\n\n`Hello from good plugin.`\n\n' + comment: '### Good Plugin.\n\nThis plugin provided no markdown output.\n\n### Good Plugin 2.\n\n`Hello from good plugin.`\n\n' }); return Promise.resolve(); });