docs: remove duplicate parsed tag items (#10676)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-12-19 19:33:23 +02:00
1 parent 024c55d995
commit 8650e6178e
5 files changed
+31 -19

No files matched your search

+2 -1
View File
@@ -10,7 +10,8 @@
"start:monorepo": "yarn start -p 3003", "start:monorepo": "yarn start -p 3003",
"lint": "next lint --fix", "lint": "next lint --fix",
"lint:content": "eslint --no-config-lookup -c .content.eslintrc.mjs app/**/*.mdx --fix", "lint:content": "eslint --no-config-lookup -c .content.eslintrc.mjs app/**/*.mdx --fix",
"prep": "node ./scripts/prepare.mjs" "prep": "node ./scripts/prepare.mjs",
"prep:turbo": "npx turbo run prep"
}, },
"dependencies": { "dependencies": {
"@mdx-js/loader": "^3.1.0", "@mdx-js/loader": "^3.1.0",
+2 -1
View File
@@ -17,7 +17,8 @@
"dev": "turbo run dev:monorepo", "dev": "turbo run dev:monorepo",
"lint": "turbo run lint", "lint": "turbo run lint",
"lint:content": "turbo run lint:content", "lint:content": "turbo run lint:content",
"watch": "turbo run watch" "watch": "turbo run watch",
"prep": "turbo run prep"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
@@ -2,7 +2,7 @@ import { getTagItems } from "tags"
import { Tag } from "types" import { Tag } from "types"
export const parseTags = (tagNames: string): Tag => { export const parseTags = (tagNames: string): Tag => {
const parsedTags: Tag = [] const parsedTags: Map<string, string> = new Map()
tagNames.split(",").forEach((tagName) => { tagNames.split(",").forEach((tagName) => {
const intersectingTags = getIntersectionTags(tagName) const intersectingTags = getIntersectionTags(tagName)
@@ -10,10 +10,15 @@ export const parseTags = (tagNames: string): Tag => {
return return
} }
parsedTags.push(...intersectingTags) intersectingTags.forEach((tag) => {
parsedTags.set(tag.path, tag.title)
})
}) })
return parsedTags return Array.from(parsedTags).map(([path, title]) => ({
title,
path,
}))
} }
const getIntersectionTags = (tags: string): Tag => { const getIntersectionTags = (tags: string): Tag => {
+14 -14
View File
@@ -1,18 +1,18 @@
export * from "./product.js" export * from "./product.js"
export * from "./storefront.js"
export * from "./order.js"
export * from "./payment.js"
export * from "./cart.js"
export * from "./fulfillment.js"
export * from "./stripe.js"
export * from "./customer.js"
export * from "./product-category.js"
export * from "./auth.js"
export * from "./inventory.js"
export * from "./product-collection.js"
export * from "./api-key.js"
export * from "./region.js"
export * from "./publishable-api-key.js"
export * from "./tax.js" export * from "./tax.js"
export * from "./pricing.js" export * from "./pricing.js"
export * from "./payment.js"
export * from "./cart.js"
export * from "./order.js"
export * from "./customer.js"
export * from "./fulfillment.js"
export * from "./product-category.js"
export * from "./storefront.js"
export * from "./query.js" export * from "./query.js"
export * from "./stripe.js"
export * from "./region.js"
export * from "./api-key.js"
export * from "./product-collection.js"
export * from "./inventory.js"
export * from "./publishable-api-key.js"
export * from "./auth.js"
+5
View File
@@ -12,6 +12,11 @@
"dist/**" "dist/**"
] ]
}, },
"prep": {
"dependsOn": [
"^tags#build"
]
},
"start:monorepo": { "start:monorepo": {
"dependsOn": [ "dependsOn": [
"^build-scripts#build", "^build-scripts#build",