Skip to content

Commit ad50a75

Browse files
author
apovkh
committed
fix: 🎨 change config
1 parent 88bd9b9 commit ad50a75

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

bin/git-plop

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ find_plop_json() {
1111
current_dir=$(dirname "$current_dir")
1212
done
1313

14-
echo "Error: .plop.json not found"
15-
return 1
14+
return 1 # Return 1 if not found, no print
1615
}
1716

1817
plop_json_path=$(find_plop_json)
1918

20-
if [ "$plop_json_path" == "Error: .plop.json not found" ]; then
21-
echo "$plop_json_path"
19+
# Check if .plop.json was found
20+
if [ -z "$plop_json_path" ]; then
21+
echo "Error: .plop.json not found"
2222
exit 1
2323
fi
2424

@@ -30,12 +30,18 @@ workdir=$(jq -r '.workdir' "$plop_json_path")
3030
src_dir="$plop_json_dir/$src"
3131
workdir_dir="$plop_json_dir/$workdir"
3232

33-
echo "Source directory: $src_dir"
34-
echo "Working directory: $workdir_dir"
35-
36-
if [ ! -f "$plop_json_dir/package.json" ]; then
37-
echo "Error: package.json not found in $plop_json_dir"
33+
# Check for package.json and plopfile in src directory
34+
if [ ! -f "$src_dir/package.json" ] || { [ ! -f "$src_dir/plopfile.js" ] && [ ! -f "$src_dir/plopfile.ts" ]; }; then
35+
echo "Unable to find plopfile at [$src_dir]"
3836
exit 1
3937
fi
4038

41-
docker run -it --rm -v "$plop_json_dir:/usr/src/app" -v "$src_dir:/usr/src/src" -v "$workdir_dir:/usr/src/modules" plop_plop:latest bash -c "npm run plop"
39+
echo "Found plopfile: [$src_dir/plopfile.js or plopfile.ts]"
40+
echo "Run plop with codebase: [$workdir_dir]"
41+
42+
# Run Docker with the updated mounts and env variable
43+
docker run -it --rm \
44+
-v "$src_dir:/plop" \
45+
-v "$workdir_dir:/codebase" \
46+
-e CODEBASE_DIR="$workdir_dir" \
47+
plop_plop:latest bash -c "npm run plop"

0 commit comments

Comments
 (0)