How to use commitizen - 3 common examples

To help you get started, we’ve selected a few commitizen 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 spotify / web-scripts / packages / web-scripts / src / Tasks / CommitTasks.ts View on Github external
export function commitTask(task: CommitTaskDesc): void {
  dbg('running commitizen commit');

  // use this to get the resolved path to the root of the commitizen directory
  const cliPath = require
    .resolve('commitizen/package.json')
    .replace('package.json', '');

  return czBootstrap(
    {
      cliPath,
      config: {
        path: task.path,
      },
    },
    // this gets the arguments in the right positions to
    // satisfy commitizen, which strips the first two
    // (assumes that they're `['node', 'git-cz']`)
    [null, ...task.restOptions],
  );
}
github pixeloven / pixeloven / packages / pixeloven / cz-simplified-changelog / src / index.ts View on Github external
/* tslint:disable no-any */
/**
 * https://github.com/commitizen/cz-conventional-changelog
 */
import engine from "./engine";
import { Options } from "./types";

import { configLoader } from "commitizen";

/**
 * @todo Remove and replace with our own version
 */
import conventionalCommitTypes from "conventional-commit-types";

const config = configLoader.load();
const defaultOptions: Options = {
    defaultBody: process.env.CZ_BODY || config.defaultBody,
    defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,
    defaultType: process.env.CZ_TYPE || config.defaultType,
    maxHeaderWidth:
        (process.env.CZ_MAX_HEADER_WIDTH &&
            parseInt(process.env.CZ_MAX_HEADER_WIDTH, 10)) ||
        config.maxHeaderWidth ||
        100,
    maxLineWidth:
        (process.env.CZ_MAX_LINE_WIDTH &&
            parseInt(process.env.CZ_MAX_LINE_WIDTH, 10)) ||
        config.maxLineWidth ||
        100,
    types: conventionalCommitTypes.types,
};
github SUI-Components / sui / packages / sui-mono / bin / sui-mono-commit.js View on Github external
async function initCommit() {
  const {hasFiles: hasStagedFiles} = await getDiffedFiles({checkIfStaged: true})
  if (hasStagedFiles === false) {
    console.log('No files added to staging! Did you forget to run git add?\n')
    const modified = await getDiffedFiles()
    if (modified.hasFiles) {
      console.log('Showing the files that you could add:')
      console.log(modified.files)
    }
    return
  }

  bootstrap({
    debug: false,
    cliPath: path.join(process.cwd(), 'node_modules/commitizen'),
    config: {
      path: require.resolve('@s-ui/cz')
    }
  })
}

commitizen

Git commit, but play nice with conventions.

MIT
Latest version published 3 months ago

Package Health Score

84 / 100
Full package analysis