INNER CODE UNIT · Dart

_changelogHeadingRegex

slang-i18n/slang · release.dart:114

final _changelogHeadingRegex = RegExp(
  r'^## \S+$',
  multiLine: true,
);

/// Replaces the changelog's first `## <version>` heading with [version].
///
/// Sub-package changelogs only point to the slang changelog, so a single
/// heading is kept up to date rather than accumulating entries.
void _setChangelogVersion(String changelogPath, String version) {
  final file = File(changelogPath);
  final content = file.readAsStringSync();
  if (!_changelogHeadingRegex.hasMatch(content)) {
    throw 'Could not find a version heading in $changelogPath';
  }
  file.writeAsStringSync(
    content.replaceFirst(_changelogHeadingRegex, '## $version'),
  );

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…