Skip to content

Commit

Permalink
docs: 📝 Give details on how to perform the migration to the new format
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeRougieux committed Nov 16, 2023
1 parent 289f186 commit 7be2a65
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@

To resolve this, you can either rename the golden files manually or regenerate them.

To ease the migration, we provide a script that will rename your goldens files to the new format:
```bash
#!/bin/bash

# Function to rename files in directories named "preview"
rename_files_in_preview() {
# Find directories named "preview"
find . -type d -name "preview" | while read -r dir; do
echo "Processing directory: $dir"
# Find files within these directories
find "$dir" -type f | while read -r file; do
# New filename by replacing ':' with '-'
new_name=$(echo "$file" | sed 's/:/-/g')
if [ "$file" != "$new_name" ]; then
mv "$file" "$new_name"
echo "Renamed $file to $new_name"
fi
done
done
}

# Call the function
rename_files_in_preview()
```

You can add the script in a `.sh` file and run it from your project root directory.

## 0.4.1

* fix: Update broken link on README.md
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,36 @@ void main() {
}
```

## Migration to 0.5.x
The 0.5.0 version introduces a new default file name for goldens that doesn't use characters unsupported by Windows file system.

To ease the migration, we provide a script that will rename your goldens files to the new format:
```bash
#!/bin/bash

# Function to rename files in directories named "preview"
rename_files_in_preview() {
# Find directories named "preview"
find . -type d -name "preview" | while read -r dir; do
echo "Processing directory: $dir"
# Find files within these directories
find "$dir" -type f | while read -r file; do
# New filename by replacing ':' with '-'
new_name=$(echo "$file" | sed 's/:/-/g')
if [ "$file" != "$new_name" ]; then
mv "$file" "$new_name"
echo "Renamed $file to $new_name"
fi
done
done
}

# Call the function
rename_files_in_preview()
```

You can add the script in a `.sh` file and run it from your project root directory.

## Additional information

This package is still in early stage of development.
Expand Down

0 comments on commit 7be2a65

Please sign in to comment.