Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Metadata Generation with "Used By" Tracking #774

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

monuelo
Copy link
Member

@monuelo monuelo commented Aug 15, 2024

Description

This PR enhances the metadata generation process by introducing a usedBy field to track where each saved block is utilized across the project

Key Changes:

usedBy Tracking: Added logic to identify and record references between saved blocks, updating the metadata with this information.

Example (from blocks.json):

{
  "/.deco/blocks/Footer.json": {
    "blockType": "sections",
    "__resolveType": "site/sections/Footer.tsx",
    "usedBy": [
      "/.deco/blocks/pages-test-3c04f2690620.json",
      "/.deco/blocks/pages-home-5afd25174424.json",
      "/.deco/blocks/pages-testing-a5c1b57018a9.json"
    ]
  }
}

@monuelo monuelo requested a review from tlgimenes August 15, 2024 16:26
if (key === "__resolveType" && typeof value === "string" && !isRoot) {
const blockName = value.split("/").pop();
if (blockName) {
const blockPath = Array.from(blocks.keys()).find((path) =>
Copy link
Contributor

@tlgimenes tlgimenes Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isso aqui nao é lento nao? criar um array dos e fazer um find para cada prop de cada block, ainda mais recursivamente assim?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants