Do not create empty BUILD files in packages that do not contain any TS.

In a previous change, we changed taze not to track whether it made
changes to the BUILD file, but rather just make the changes and compare
the BUILD file(s) for equality after the fact. That change had a bug
where it'd always create a (potentially empty) BUILD file, even if non
previously existed and the package does not contain any TypeScript.

This change fixes the problem by treating a newly created empty BUILD
file as equivalent to no BUILD file at all, and not writing the file in
that case.

PiperOrigin-RevId: 222072180
diff --git a/ts_auto_deps/updater/updater.go b/ts_auto_deps/updater/updater.go
index 01f85a6..3a41b10 100644
--- a/ts_auto_deps/updater/updater.go
+++ b/ts_auto_deps/updater/updater.go
@@ -445,13 +445,18 @@
 	platform.Infof("Formatted %s: %s\n", path, ri)
 	newContent := build.Format(bld)
 	oldContent, err := platform.ReadFile(ctx, path)
-	if err != nil && !os.IsNotExist(err) {
-		return false, err
-	} else if err == nil {
-		// i.e. not a not exist error => compare contents, only update if changed.
-		if bytes.Equal(oldContent, newContent) {
+	if err != nil {
+		if !os.IsNotExist(err) {
+			return false, err
+		} else if len(newContent) == 0 {
+			// The BUILD file does not exist, and the newly created file has no content.
+			// Treat this as equivalent, and do not create a new BUILD file.
 			return false, nil
 		}
+		// Fall through to write a new file.
+	} else if bytes.Equal(oldContent, newContent) {
+		// Compare contents, only update if changed.
+		return false, nil
 	}
 	if err := upd.updateFile(ctx, path, string(newContent)); err != nil {
 		return false, fmt.Errorf("failed to update %q: %v", path, err)