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

Figma Connect Failing #214

Open
kahlillalji-ah opened this issue Nov 22, 2024 · 2 comments
Open

Figma Connect Failing #214

kahlillalji-ah opened this issue Nov 22, 2024 · 2 comments

Comments

@kahlillalji-ah
Copy link

Please provide:

  • Code Connect CLI version [use npx figma -V if using React, or figma -V otherwise, to get the version of your CLI]
    1.2.2

  • Operating system
    Sonoma 14.7.1

  • Code Connect file, Figma design and/or relevant code snippet that could help us get more context

This is the error I'm getting when running swift run -c release --verbose figma-swift

/Users/kahlil/Desktop/swift-design-system/.build/checkouts/code-connect/swiftui/lib/CodeConnectTemplateWriter.swift:227:101: error: binary operator '??' cannot be applied to operands of type '(output: String, changes: [Formatter.Change])?' and 'String'
        let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement())) ?? code.trimmedDescriptionRemovingReturnStatement()
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kahlil/Desktop/swift-design-system/.build/checkouts/code-connect/swiftui/lib/CodeConnectTemplateWriter.swift:249:35: error: cannot infer contextual base in reference to member 'whitespacesAndNewlines'
        ).trimmingCharacters(in: .whitespacesAndNewlines)

I'm doing this because figma connect create returns this

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v18.18.0
@slees-figma
Copy link

Hey @kahlillalji-ah! Thanks for the detailed report. Would you mind running npx figma connect create --verbose and sharing the output?

I'm not able to repro this error in a swift project on my end, so if the above doesn't surface anything it might be best for you to raise a support ticket so we can investigate in your file further.

@somedd
Copy link

somedd commented Nov 28, 2024

@slees-figma I also encountered the same compile error, and I think it should be modified as follows🙏🏻 cc. @kahlillalji-ah
in CodeConnectTemplateWriter.swift 227L

  • as-is:
    let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement())) ?? code.trimmedDescriptionRemovingReturnStatement()
  • to-be:
    let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement()).output) ?? code.trimmedDescriptionRemovingReturnStatement()

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

No branches or pull requests

4 participants