Skip to content

Add a validation for non-existent node-idΒ #337

@necky2

Description

@necky2

When a component is removed in Figma or moved to another file, the Code Connect link in our codebase becomes stale.

Currently, the publish command still succeeds without errors, even though the linked node-id no longer exists in Figma.

Example CLI output

npx @figma/code-connect connect publish --dir .

No config file found in ., proceeding with default options
Using "react" parser as package.json containing a "react" dependency was found in /Users/xxx/WebstormProjects/xxx. If this is incorrect, please check you are running Code Connect from your project root, or add a `parser` key to your config file. See https://github.com/figma/code-connect for more information.
Validating Code Connect files...
All Code Connect files are valid (9394ms)
Uploading to Figma...
Successfully uploaded to Figma, for Storybook:
-> Icon https://www.figma.com/design/xxx/xxx?node-id=xxx&m=dev
-> Button https://www.figma.com/design/xxx/xxx?node-id=xxx&m=dev
Done.

For context, When I open the "Icon" link, it opens the file on the first page and does not select any node, as it does not exist anymore. I would expect an error that the Icon could not be published.

Proposed change:

The publish script should fail (non-zero exit code) or at least emit an error/warning when any linked Figma node cannot be resolved.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions