How to use git-raw-commits - 7 common examples

To help you get started, we’ve selected a few git-raw-commits examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conventional-changelog / conventional-commits-detector / bin / cli.js View on Github external
'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);
  }));
github frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / index.spec.js View on Github external
function mockNoCommits() {
  gitRawCommits.mockReset()

  gitRawCommits.mockImplementationOnce(() => {
    const stream = require('stream')
    const readable = new stream.Readable()
    readable.push(null)
    readable.emit('close')
    return readable
  })
}
github frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / index.spec.js View on Github external
function mockGroup(commits) {
  gitRawCommits.mockImplementationOnce(() => {
    const stream = require('stream')
    const readable = new stream.Readable()
    commits.forEach(commit => {
      const {
        hash, author, date, subject, body,
      } = commit
      readable.push(`\n${hash}\n${author}\n${date}\n${subject}\n${body}\n`)
    })
    readable.push(null)
    readable.emit('close')
    return readable
  })
}
github frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / index.spec.js View on Github external
function mockNoCommits() {
  gitRawCommits.mockReset()

  gitRawCommits.mockImplementationOnce(() => {
    const stream = require('stream')
    const readable = new stream.Readable()
    readable.push(null)
    readable.emit('close')
    return readable
  })
}
github northbrookjs / northbrook / src / plugin / release / check-release.js View on Github external
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)
        }
      }))
  })
}
github northbrookjs / northbrook / src / plugin / release / check-release.js View on Github external
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)
        }
      }))
  })
}
github conventional-changelog / commitlint / @commitlint / read / src / index.js View on Github external
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);
			});
	});
}

git-raw-commits

Get raw git commits out of your repository using git-log(1).

ISC
Latest version published 7 months ago

Package Health Score

87 / 100
Full package analysis