Skip to content

Commit

Permalink
docs: remove duplicate parsed tag items (medusajs#10676)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser authored and jimrarras committed Jan 28, 2025
1 parent a5bb411 commit 48ee129
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
3 changes: 2 additions & 1 deletion www/apps/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start:monorepo": "yarn start -p 3003",
"lint": "next lint --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": {
"@mdx-js/loader": "^3.1.0",
Expand Down
3 changes: 2 additions & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"dev": "turbo run dev:monorepo",
"lint": "turbo run lint",
"lint:content": "turbo run lint:content",
"watch": "turbo run watch"
"watch": "turbo run watch",
"prep": "turbo run prep"
},
"dependencies": {
"autoprefixer": "10.4.14",
Expand Down
11 changes: 8 additions & 3 deletions www/packages/build-scripts/src/utils/parse-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ import { getTagItems } from "tags"
import { Tag } from "types"

export const parseTags = (tagNames: string): Tag => {
const parsedTags: Tag = []
const parsedTags: Map<string, string> = new Map()
tagNames.split(",").forEach((tagName) => {
const intersectingTags = getIntersectionTags(tagName)

if (!intersectingTags.length) {
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 => {
Expand Down
22 changes: 11 additions & 11 deletions www/packages/tags/src/tags/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export * from "./product.js"
export * from "./storefront.js"
export * from "./order.js"
export * from "./tax.js"
export * from "./pricing.js"
export * from "./payment.js"
export * from "./cart.js"
export * from "./fulfillment.js"
export * from "./stripe.js"
export * from "./order.js"
export * from "./customer.js"
export * from "./fulfillment.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 "./storefront.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 "./tax.js"
export * from "./pricing.js"
export * from "./query.js"
export * from "./auth.js"
5 changes: 5 additions & 0 deletions www/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"dist/**"
]
},
"prep": {
"dependsOn": [
"^tags#build"
]
},
"start:monorepo": {
"dependsOn": [
"^build-scripts#build",
Expand Down

0 comments on commit 48ee129

Please sign in to comment.