35
35
echo " If you need to update the 'unstable' version, run this command again without the '$API_VERSION ' parameter."
36
36
fi
37
37
38
+ # Read tsconfig.ab.docs.json and extract include/exclude patterns
39
+ # Find all .doc.ts files in SRC_PATH
40
+ FIND_CMD=" find ./$SRC_PATH -name '*.doc.ts'"
41
+
42
+ # Store original files for restoration
43
+ declare -a MODIFIED_FILES
44
+
45
+ echo " Replacing JSX/tsx references..."
46
+ while IFS= read -r file; do
47
+ if grep -q " JSX\|\.tsx" " $file " ; then
48
+ cp " $file " " $file .bak"
49
+ MODIFIED_FILES+=(" $file " )
50
+ run_sed ' s/JSX/HTML/g' " $file "
51
+ run_sed ' s/\.tsx/\.html/g' " $file "
52
+ fi
53
+ done < <( eval " $FIND_CMD " )
54
+
55
+
38
56
COMPILE_DOCS=" yarn tsc --project $DOCS_PATH /tsconfig.ab.docs.json --moduleResolution node --target esNext --module CommonJS && yarn generate-docs --overridePath ./$DOCS_PATH /typeOverride.json --input ./$DOCS_PATH /reference ./$SRC_PATH --typesInput ./$SRC_PATH --output ./$DOCS_PATH /generated"
39
57
# COMPILE_STATIC_PAGES="yarn tsc $DOCS_PATH/staticPages/*.doc.ts --moduleResolution node --target esNext --module CommonJS && yarn generate-docs --isLandingPage --input ./$DOCS_PATH/staticPages --output ./$DOCS_PATH/generated"
40
58
@@ -46,6 +64,13 @@ run_sed "s/typeof globalThis.HTMLElement/any/" $COMPONENTS_TS
46
64
eval $COMPILE_DOCS
47
65
build_exit=$?
48
66
67
+ # Restore original files
68
+ for file in " ${MODIFIED_FILES[@]} " ; do
69
+ if [ -f " $file .bak" ]; then
70
+ mv " $file .bak" " $file "
71
+ fi
72
+ done
73
+
49
74
# Remove .doc.js files
50
75
find ./ -name ' *.doc*.js' -exec rm -r {} \;
51
76
# Remove components.ts as it's no longer needed
58
83
# Make sure https://shopify.dev URLs are relative so they work in Spin.
59
84
# See https://github.com/Shopify/generate-docs/issues/181
60
85
run_sed ' s/https:\/\/shopify.dev//gi' ./$DOCS_PATH /generated/generated_docs_data.json
86
+
87
+
61
88
sed_exit=$?
62
89
if [ $sed_exit -ne 0 ]; then
63
90
fail_and_exit $sed_exit
0 commit comments