Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "conventional-commits-parser in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'conventional-commits-parser' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

function shouldSkipCommit(logLine, mode) {
  const parsedCommit = parser.sync(logLine.message, parserOpts);
  return (parsedCommit.type === 'feat' && mode === 'patch') || // feature commit
    parsedCommit.notes.find((note) => note.title === 'BREAKING CHANGE') || // breaking change commit
    (parsedCommit.type === 'chore' && parsedCommit.subject === 'Publish'); // Publish (version-rev) commit
}
module.exports = ({ commit: { author, message }, sha }) => {
  const parserOptions = {
    // 預設的 headerPattern 是 /^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\: (.*)$/
    // 但我們的 scope 有斜線的需求,例如:fix(controllers/auth): oauth login failed
    // 固修改 headerPattern 支援斜線(/)。
    headerPattern: /^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$/
  }
  const conventionalCommit = conventionalCommitsParser.sync(message, parserOptions)

  return {
    conventionalCommit,
    sha,
    author
  }
}
test('notes: undefined note', (t) => {
  let commit = ':bug: fix(chat): broadcast $destroy event on scope destruction (by @kazupon)\n'
    + '\n'
    + 'TODO:\n'
    + 'this is note ...'
  let parsed = parser.sync(commit, options)
  t.deepEqual(parsed.notes, [])
})
test('basic', (t) => {
  let commit = ':bug: fix(chat): broadcast $destroy event on scope destruction (by @kazupon)\n'
    + '\n'
    + 'this is the body\n'
    + '\n'
    + 'NOTE:\n'
    + 'this is the note\n'
    + '\n'
    + 'Closes #1'
  let parsed = parser.sync(commit, options)
  t.is(parsed.footer, 'NOTE:\nthis is the note\n\nCloses #1')
})
.map((commit) => {
      const node = parser.sync(commit);

      node.breaking = reBreaking.test(node.body || node.footer);

      return node;
    });
.map(commit => {
        const parsedCommit = parseCommit(
          execSync(
            `git log ${commit.hash} -n1 --pretty=format:'%B'`
          ).toString(),
          {
            mergePattern: /^Merge pull request #(\d+) from (.*)$/,
            mergeCorrespondence: ["id", "source"],
            noteKeywords: [
              "BREAKING CHANGE",
              "ISSUES CLOSED",
              "AFFECTS PACKAGES"
            ]
          }
        );
        if (!parsedCommit.type || !parsedCommit.scope) {
          return;
        }
function parseCommit(commit) {
  const metaEndIdx = commit.indexOf('\n');
  const meta = commit
    .slice(0, metaEndIdx)
    .trim()
    .split(' ');
  const message = commit.slice(metaEndIdx + 1);

  const sha = meta.shift();
  const parentSha = meta.shift() || null;

  const data = commitParser.sync(message, {
    issuePrefixes: ['#', 'https?://[\\w\\.-/]*[-/]+'],
  });
  const prMatch = message.match(PR_MERGE_PATTERN);
  if (prMatch) {
    const prId = prMatch[1];
    data.type = 'pr';
    data.pullId = prId;
    const mergeRef = data.references.find(ref => {
      return ref.issue === prId;
    });
    if (!mergeRef) {
      throw new Error(`Couldn't find reference to merge of PR #${prId}`);
    }
    Object.assign(mergeRef, {
      action: 'Merges',
      owner: prMatch[2],
.map((commit) => {
      const node = parser.sync(commit);

      node.breaking = reBreaking.test(node.body || node.footer);

      return node;
    });
module.exports = (rawCommit, config) => {
  try {
    return parser(rawCommit, config);
  } catch (err) {
    throw new SemanticReleaseError(`Error in conventional-changelog-parser: ${err.message}`, err.code);
  }
};
.then(commits => commits.map(commit => {
          commit.message = conventionalCommitsParser.sync(commit.message);
          commit.message.hash = commit.hash;
          return commit.message;
        }))
        .then(commits => commits.filter(commit => commit.scope === packageDir))

Is your System Free of Underlying Vulnerabilities?
Find Out Now