Skip to content

Commit 42945d2

Browse files
committed
Bash gymnastics
1 parent 5dfa7d2 commit 42945d2

File tree

8 files changed

+33
-264
lines changed

8 files changed

+33
-264
lines changed

packages/ui-extensions/docs/surfaces/admin/build-ab-docs.sh

+27
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ else
3535
echo "If you need to update the 'unstable' version, run this command again without the '$API_VERSION' parameter."
3636
fi
3737

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+
3856
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"
3957
# 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"
4058

@@ -46,6 +64,13 @@ run_sed "s/typeof globalThis.HTMLElement/any/" $COMPONENTS_TS
4664
eval $COMPILE_DOCS
4765
build_exit=$?
4866

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+
4974
# Remove .doc.js files
5075
find ./ -name '*.doc*.js' -exec rm -r {} \;
5176
# Remove components.ts as it's no longer needed
@@ -58,6 +83,8 @@ fi
5883
# Make sure https://shopify.dev URLs are relative so they work in Spin.
5984
# See https://github.com/Shopify/generate-docs/issues/181
6085
run_sed 's/https:\/\/shopify.dev//gi' ./$DOCS_PATH/generated/generated_docs_data.json
86+
87+
6188
sed_exit=$?
6289
if [ $sed_exit -ne 0 ]; then
6390
fail_and_exit $sed_exit
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<s-link href="app://baz">Link to app path</s-link>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<s-link href="https://www.shopify.ca/climate/sustainability-fund">
2+
Sustainability fund
3+
</s-link>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<s-link href="/baz">Link relative to current path</s-link>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<s-link href="shopify://admin/orders">Shop's orders</s-link>;

packages/ui-extensions/src/surfaces/admin/components/copy.js

-101
This file was deleted.

packages/ui-extensions/src/surfaces/admin/components/create.js

-78
This file was deleted.

packages/ui-extensions/src/surfaces/admin/components/wrap.js

-85
This file was deleted.

0 commit comments

Comments
 (0)