File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 22
33function parse_args() {
44 locale=" en" # Default locale
5+ out_dir=" " # Default empty, meaning no custom output directory
56
67 while [[ " $# " -gt 0 ]]; do
78 case " $1 " in
89 -l|--locale)
910 locale=" $2 "
1011 shift 2
1112 ;;
13+ --out-dir)
14+ out_dir=" $2 "
15+ shift 2
16+ ;;
1217 -h|--help)
13- echo " Usage: $0 [-l locale]"
18+ echo " Usage: $0 [-l locale] [--out-dir path] "
1419 echo " "
1520 echo " Options:"
1621 echo " -l, --locale Locale to build docs for (default: en)."
22+ echo " --out-dir Specify output directory for the build."
1723 echo " -h, --help Display this help message."
1824 exit 0
1925 ;;
@@ -29,11 +35,26 @@ main() {
2935 parse_args " $@ "
3036
3137 echo " Building Docusaurus with locale: en (currently required)"
32- GENERATE_SOURCEMAP=false docusaurus build --locale en
38+ build_command=" GENERATE_SOURCEMAP=false docusaurus build --locale en"
39+
40+ # Append output directory if provided
41+ if [[ -n " $out_dir " ]]; then
42+ build_command+=" --out-dir $out_dir /en"
43+ fi
44+
45+ # Execute the build command for English
46+ eval " $build_command "
3347
3448 if [[ " $locale " != " en" ]]; then
3549 echo " Building Docusaurus with additional locale: $locale "
36- GENERATE_SOURCEMAP=false docusaurus build --locale " $locale "
50+ build_command=" GENERATE_SOURCEMAP=false docusaurus build --locale $locale "
51+
52+ if [[ -n " $out_dir " ]]; then
53+ build_command+=" --out-dir $out_dir /$locale "
54+ fi
55+
56+ # Execute the build command for the additional locale
57+ eval " $build_command "
3758 fi
3859}
3960
You can’t perform that action at this time.
0 commit comments