conventional_commit 0.3.0+1
conventional_commit: ^0.3.0+1 copied to clipboard

Parse a git commit message using the Conventional Commits specification.



A library for parsing conventional git commit messages.


Parse a git commit message into a Conventional Commit format.

Example #

import 'package:conventional_commit/conventional_commit.dart';

const commitMessageExample = '''
feat(cool): An exciting new feature.

A body describing this commit in more detail.

The body in this example is multi-line.

BREAKING CHANGE: This is a breaking change because of X Y Z.

Co-authored-by: @Salakar
Refs #123 #456
''';

void main() {
  final parsedCommit = ConventionalCommit.parse(commitMessageExample);

  print(parsedCommit.description);
  // : An exciting new feature.

  print(parsedCommit.body);
  // : A body describing this commit in more detail.
  // :
  // : The body in this example is multi-line.

  print(parsedCommit.type);
  // : feat

  print(parsedCommit.scopes);
  // : ['cool']

  print(parsedCommit.isBreakingChange);
  // : true

  print(parsedCommit.breakingChangeDescription);
  // : This is a breaking change because of X Y Z.

  print(parsedCommit.semverReleaseType);
  // : SemverReleaseType.major

  print(parsedCommit.footers);
  // : ['Co-authored-by: @Salakar', 'Refs #123 #456']

  print(parsedCommit.isMergeCommit);
  // : false

  print(parsedCommit.isVersionableCommit);
  // : true
}

License #


Built and maintained with 💛 by Invertase.

Chat on Discord Follow on Twitter


4
likes
110
pub points
54%
popularity

Publisher

invertase.io

Parse a git commit message using the Conventional Commits specification.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

More

Packages that depend on conventional_commit