Skip to content

Commit

Permalink
Merge pull request #12 from Updater/analyze-commits-log-result
Browse files Browse the repository at this point in the history
feat(analyze-commits): log number of commits passing package filter
  • Loading branch information
pmowrer authored Dec 13, 2017
2 parents 25c3b63 + 33bccdc commit 00f6ca4
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/analyze-commits.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
const { pipeP } = require('ramda');
const commitAnalyzer = require('@semantic-release/commit-analyzer');
const readPkg = require('read-pkg');
const { filterCommits } = require('./options-transforms');
const onlyPackageCommits = require('./only-package-commits');

// Async version of Ramda's `tap`
const tapA = fn => async x => {
await fn(x);
return x;
};

const logFilteredCommitCount = logger => async ({ commits }) => {
const { name } = await readPkg();

logger.log(
'Found %s commits for package %s since last release',
commits.length,
name
);
};

async function analyzeCommits(pluginConf, options) {
const { logger } = options;

return commitAnalyzer(
pluginConf,
await filterCommits(onlyPackageCommits)(options)
await pipeP(
filterCommits(onlyPackageCommits),
tapA(logFilteredCommitCount(logger))
)(options)
);
}

Expand Down

0 comments on commit 00f6ca4

Please sign in to comment.