File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ find_plop_json () {
4+ current_dir=$( pwd)
5+
6+ while [ " $current_dir " != " /" ]; do
7+ if [ -f " $current_dir /.plop.json" ]; then
8+ echo " $current_dir /.plop.json"
9+ return 0
10+ fi
11+ current_dir=$( dirname " $current_dir " )
12+ done
13+
14+ return 1 # Return 1 if not found, no print
15+ }
16+
17+ plop_json_path=$( find_plop_json)
18+
19+ # Check if .plop.json was found
20+ if [ -z " $plop_json_path " ]; then
21+ echo " Error: .plop.json not found"
22+ exit 1
23+ fi
24+
25+ plop_json_dir=$( dirname " $plop_json_path " )
26+
27+ src=$( jq -r ' .src' " $plop_json_path " )
28+ workdir=$( jq -r ' .workdir' " $plop_json_path " )
29+
30+ src_dir=" $plop_json_dir /$src "
31+ workdir_dir=" $plop_json_dir /$workdir "
32+
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 ]"
36+ exit 1
37+ fi
38+
39+ echo " Found plopfile: [$src_dir /plopfile.*]"
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+ ghcr.io/justcoded/plopjs:0.1.0
You can’t perform that action at this time.
0 commit comments