conventional_commit 0.4.3 copy "conventional_commit: ^0.4.3" to clipboard
conventional_commit: ^0.4.3 copied to clipboard

outdated

Parse a git commit message using the Conventional Commits specification.

example/conventional_commit.dart

// ignore_for_file: avoid_print
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.tryParse(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.

  // Note this api may be removed in future.
  print(parsedCommit.semverReleaseType);
  // : SemverReleaseType.major

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

  print(parsedCommit.isMergeCommit);
  // : false

  // Note this api may be removed in future.
  print(parsedCommit.isVersionableCommit);
  // : true
}
17
likes
0
pub points
60%
popularity

Publisher

verified publisherinvertase.io

Parse a git commit message using the Conventional Commits specification.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on conventional_commit