Skip to content

Commit 3eef4cc

Browse files
committed
chore: refactor version generation script to use basename for package name extraction
1 parent 08a6288 commit 3eef4cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/generate_versions_web.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import 'dart:io' show Directory, File;
16-
import 'package:path/path.dart' show joinAll;
16+
import 'package:path/path.dart' show basename, joinAll;
1717
import 'package:yaml/yaml.dart' show YamlMap, loadYaml;
1818

1919
Future<void> main() async {
@@ -23,7 +23,7 @@ Future<void> main() async {
2323
// Find all packages with _web directories
2424
await for (final packageDir in packagesDir.list()) {
2525
if (packageDir is Directory) {
26-
final packageName = packageDir.path.split('/').last;
26+
final packageName = basename(packageDir.path);
2727
final webDir = Directory(joinAll([packageDir.path, '${packageName}_web']));
2828

2929
if (await webDir.exists()) {
@@ -77,7 +77,8 @@ Future<void> _generateVersionFile(String packageName) async {
7777
print('Processing $webPackageName version $currentVersion');
7878

7979
// Create the version file content
80-
final fileContent = '''// Copyright 2025 Google LLC
80+
final fileContent = '''
81+
// Copyright 2025 Google LLC
8182
//
8283
// Licensed under the Apache License, Version 2.0 (the "License");
8384
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)