How to use @semantic-release/commit-analyzer - 4 common examples

To help you get started, we’ve selected a few @semantic-release/commit-analyzer 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 instructure / instructure-ui / packages / cz-lerna-changelog / lib / index.js View on Github external
let scope = '*'

        if (Array.isArray(answers.scope)) {
          scope = answers.scope.join(',')
        }

        const message = buildCommit({
          ...rest,
          body: issues + body + testplan,
          scope
        }, { breaklineChar: '|' })

        const cwd = process.cwd()

        commitAnalyzer.analyzeCommits({}, { cwd, commits: [{ hash: '', message }], logger: console })
          .then((type) => {
            /* eslint-disable no-console */
            console.info(chalk.green(`\n${getCommitTypeMessage(type)}\n`))
            console.info('\n\nCommit message:')
            console.info(chalk.blue(`\n\n${message}\n`))
            /* eslint-enable no-console */
            commit(message)
          })
          .catch((error) => {
            console.error(error)
          })
      })
      .catch((error) => {
github webiny / webiny-js / scripts / release / packages / plugins / analyzeCommits / index.js View on Github external
if (typeof pluginConfig.isRelevant === "function") {
            relevantCommits = commits.filter(commit =>
                pluginConfig.isRelevant(params.packages, commit)
            );
        }

        if (!relevantCommits.length) {
            logger.log(`No relevant commits were found!`);
            return finish();
        }

        // Store lastRelease for later use
        params["lastRelease"] = lastRelease;
        params["commits"] = relevantCommits;

        const type = await analyzeCommits(
            pluginConfig.commitAnalyzer || {},
            Object.assign({ logger, commits })
        );

        if (!type) {
            logger.info(`No relevant commits indicate a release!`);
            return finish();
        }

        let version;
        if (lastRelease.version) {
            version = semver.inc(lastRelease.version, type);
            logger.info("The next release version is %s", version);
        } else {
            version = "1.0.0";
            logger.info("There is no previous release, the next release version is %s", version);
github webiny / webiny-js / scripts / release / independent / plugins / analyzeCommits / index.js View on Github external
}

            const commits = await getCommits(lastRelease.gitHead, config.branch, logger);
            let relevantCommits = commits;

            if (typeof pluginConfig.isRelevant === "function") {
                relevantCommits = commits.filter(commit => pluginConfig.isRelevant(pkg, commit));
            }

            if (!relevantCommits.length) {
                logger.log(`No relevant commits were found for package %s`, pkg.name);
                logger.log(`======== Finished processing package ========\n\n`);
                continue;
            }

            const type = await analyzeCommits(
                pluginConfig.commitAnalyzer || {},
                Object.assign({ logger, commits: relevantCommits })
            );

            // Store relevant commits for later use
            packages[i].commits = relevantCommits;

            if (!type) {
                logger.log(`No relevant commits indicate a release!`);
                logger.log(`======== Finished processing package ========\n\n`);
                continue;
            }

            relevantCommits.length &&
                logger.log(
                    `Relevant commits:\n${"*".padStart(8)} ${relevantCommits
github webiny / webiny-js / packages-utils / webiny-semantic-release / src / plugins / analyzeCommits / index.js View on Github external
const commits = await getCommits(lastRelease.gitHead, config.branch, logger);
            const relevantCommits = getRelevantCommits(commits, pkg);

            // Store relevant commits for later use
            packages[i].commits = relevantCommits;

            // Store lastRelease for later use
            packages[i]["lastRelease"] = lastRelease;

            if (!relevantCommits.length) {
                logger.log(`No relevant commits were found for package %s`, pkg.name);
                logger.log(`======== Finished processing package ========\n\n`);
                continue;
            }

            const type = await commitAnalyzer(
                pluginConfig.analyzeCommits || {},
                Object.assign({ logger, commits: relevantCommits })
            );
            relevantCommits.length &&
                logger.log(
                    `Relevant commits:\n* ${relevantCommits.map(c => c.subject).join("\n* ")}`
                );
            let version;
            if (lastRelease.version) {
                version = semver.inc(lastRelease.version, type);
                logger.log("The next release version is %s", version);
            } else {
                version = "1.0.0";
                logger.log("There is no previous release, the next release version is %s", version);
            }
            packages[i]["nextRelease"] = {

@semantic-release/commit-analyzer

semantic-release plugin to analyze commits with conventional-changelog

MIT
Latest version published 7 months ago

Package Health Score

84 / 100
Full package analysis