Skip to content

Commit bc84f3d

Browse files
fix target generation
1 parent 2d70bb7 commit bc84f3d

10 files changed

Lines changed: 4 additions & 226501 deletions

File tree

packages/ui-extensions/docs/surfaces/checkout/build-docs-targets-json.mjs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import {
1111
const __filename = fileURLToPath(import.meta.url);
1212
const __dirname = path.dirname(__filename);
1313

14-
// Find the generated_docs_data.json file to determine output location
14+
// Find the generated_docs_data_v2.json file to determine output location
1515
function findGeneratedDocsPath() {
1616
const generatedDir = path.join(__dirname, 'generated');
1717

18-
// Look for generated_docs_data.json recursively
1918
function findFile(dir) {
2019
const files = fs.readdirSync(dir);
2120
for (const file of files) {
@@ -24,7 +23,7 @@ function findGeneratedDocsPath() {
2423
if (stat.isDirectory()) {
2524
const result = findFile(fullPath);
2625
if (result) return result;
27-
} else if (file === 'generated_docs_data.json') {
26+
} else if (file === 'generated_docs_data_v2.json') {
2827
return path.dirname(fullPath);
2928
}
3029
}
@@ -35,28 +34,10 @@ function findGeneratedDocsPath() {
3534
return docsPath || generatedDir; // Fallback to generated root if not found
3635
}
3736

38-
// Accept an API version argument (e.g. 2026-04-rc) to output targets.json into
39-
// a versioned directory matching the customer-account pattern.
40-
// Falls back to the directory containing generated_docs_data.json if not provided.
41-
const apiVersion = process.argv[2];
42-
43-
function resolveOutputPath() {
44-
if (apiVersion) {
45-
return path.join(
46-
__dirname,
47-
'generated',
48-
'checkout_ui_extensions',
49-
apiVersion,
50-
'targets.json',
51-
);
52-
}
53-
return path.join(findGeneratedDocsPath(), 'targets.json');
54-
}
55-
5637
// Configuration for checkout surface
5738
const config = {
5839
basePath: path.join(__dirname, '../../../src/surfaces/checkout'),
59-
outputPath: resolveOutputPath(),
40+
outputPath: path.join(findGeneratedDocsPath(), 'targets.json'),
6041
componentTypesPath: null,
6142
hasComponentTypes: false,
6243
};

packages/ui-extensions/docs/surfaces/checkout/build-docs.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if [ $sed_exit -ne 0 ]; then
8787
fi
8888

8989
# Generate targets.json (extension targets + APIs + components mapping)
90-
node ./$DOCS_PATH/build-docs-targets-json.mjs $API_VERSION
90+
node ./$DOCS_PATH/build-docs-targets-json.mjs
9191
targets_exit=$?
9292
if [ $targets_exit -ne 0 ]; then
9393
fail_and_exit $targets_exit
@@ -106,12 +106,6 @@ if [ -d $SHOPIFY_DEV_PATH ]; then
106106
mkdir -p $SHOPIFY_DEV_DEST
107107
cp ./$DOCS_PATH/generated/* $SHOPIFY_DEV_DEST
108108

109-
# Also copy the versioned targets.json generated by build-docs-targets-json.mjs
110-
VERSIONED_TARGETS=./$DOCS_PATH/generated/checkout_ui_extensions/$API_VERSION/targets.json
111-
if [ -f "$VERSIONED_TARGETS" ]; then
112-
cp "$VERSIONED_TARGETS" $SHOPIFY_DEV_DEST/targets.json
113-
fi
114-
115109
# Replace 'latest' with the exact API version in relative doc links
116110
run_sed \
117111
"s/\/docs\/api\/checkout-ui-extensions\/latest/\/docs\/api\/checkout-ui-extensions\/$API_VERSION/gi" \

0 commit comments

Comments
 (0)