Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'Examples',
' $ conventional-commits-detector',
' $ conventional-commits-detector 10'
],
pkg: pkg
});
let input = cli.input[0];
let sampleCount;
let commits = [];
if (input) {
sampleCount = parseInt(input, 10);
}
gitRawCommits({
from: sampleCount ? 'HEAD~' + sampleCount : null
})
.on('error', (err) => {
console.error(err.message);
process.exit(1);
})
.pipe(through((data, enc, cb) => {
commits.push(data.toString());
cb();
}, () => {
let convention = conventionalCommitsDetector(commits);
console.log(convention);
}));
return new Promise((resolve, reject) => {
gitRawCommits({ format: '%B%n-hash-%n%H', from: tag })
.pipe(commitsParser())
.pipe(concat(function (data) {
const commits = commitsFilter(data)
if (!commits || !commits.length) {
reject(null)
} else {
resolve(commits)
}
}))
})
}
return new Promise((resolve, reject) => {
gitRawCommits({ format: '%B%n-hash-%n%H', from: tag })
.pipe(commitsParser())
.pipe(concat(function (data) {
const commits = commitsFilter(data)
if (!commits || !commits.length) {
reject(null)
} else {
resolve(commits)
}
}))
})
}
return new Promise((resolve, reject) => {
const data = [];
gitRawCommits(options, {cwd: opts.cwd})
.on('data', chunk => data.push(chunk.toString('utf-8')))
.on('error', reject)
.on('end', () => {
resolve(data);
});
});
}