-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ts): ensures patches are preserved during code generation (#184)
- Loading branch information
1 parent
873447f
commit c9bfdae
Showing
5 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Preserving TypeScript patches..." | ||
generated_dir="$AKASH_TS_ROOT/src/generated" | ||
tmp_dir="$AKASH_DEVCACHE_BASE/tmp/ts" | ||
|
||
if [ ! -d "$generated_dir" ]; then | ||
echo "Directory $generated_dir does not exist. Skipping..." | ||
exit 0 | ||
fi | ||
|
||
find "$generated_dir" -type f -name "*.original.ts" | while read -r src_file; do | ||
src_file=${src_file//.original/} | ||
gen_dir=$(dirname "$src_file") | ||
gen_dir=${gen_dir//$generated_dir\//} | ||
file=$(basename "$src_file" .original.ts) | ||
mkdir -p "$tmp_dir/$gen_dir" | ||
tmp_file="$tmp_dir/$gen_dir/$file" | ||
|
||
echo "Preserving $src_file to $tmp_file" | ||
cp "$src_file" "$tmp_file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Restoring TypeScript patches..." | ||
|
||
tmp_dir="$AKASH_DEVCACHE_BASE/tmp/ts" | ||
generated_dir="$AKASH_TS_ROOT/src/generated" | ||
|
||
if [ ! -d "$tmp_dir" ]; then | ||
echo "Directory $tmp_dir does not exist. Skipping..." | ||
exit 0 | ||
fi | ||
|
||
find "$tmp_dir" -type f -name "*.ts" | while read -r src_file; do | ||
original_file_path=${src_file/$tmp_dir\//} | ||
renamed_original_file_path="${original_file_path/.ts/.original.ts}" | ||
echo "Restoring $original_file_path to $generated_dir/$original_file_path" | ||
|
||
mv "$generated_dir/$original_file_path" "$generated_dir/$renamed_original_file_path" | ||
mv "$tmp_dir/$original_file_path" "$generated_dir/$original_file_path" | ||
done | ||
|
||
rm -rf "$tmp_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters