Skip to content

Commit 2404b36

Browse files
author
figma-bot
committed
Code Connect v1.4.3
1 parent 0b62c1f commit 2404b36

24 files changed

Lines changed: 587 additions & 186 deletions

File tree

CHANGELOG.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# Code Connect v1.4.3 (1st April 2026)
2+
3+
## Fixed
4+
5+
### Template files
6+
7+
- Fixed `getBoolean()` returning `undefined` instead of `false` when a boolean property is set to `false` in a template file.
8+
- Fixed some TS discrepancies in the `figma.*` API in template files
9+
- Some fixes for the migration script
10+
11+
### Swift & Compose
12+
13+
- Fixed args inconsistency in Swift and Compose helpers that could cause errors during template rendering.
14+
15+
## Features
16+
17+
### CLI
18+
19+
- Added `--file` (`-f`) option to `parse`, `publish`, and `unpublish` commands to process a single Code Connect file instead of the entire project (e.g. `figma connect parse --file=src/Button.figma.tsx`).
20+
21+
### Template files
22+
23+
- The `migrate` command now outputs TypeScript (`.figma.ts`) files by default. Pass `--javascript` to output JavaScript (`.figma.js`) files instead.
24+
- The `migrate` command now outputs `import figma from "figma"` (ESM syntax) when using the `--typescript` flag
25+
- The `migrate` command now removes `__props` metadata blocks by default. Pass `--include-props` to preserve them.
26+
- Storybook connections can now be migrated by the template migration script
27+
128
# Code Connect v1.4.2 (16th March 2026)
229

330
## Fixed
@@ -26,7 +53,7 @@
2653
- Type-only imports (`import type`) are supported
2754
- Other module imports are not yet supported
2855
- To enable types for the `figma` API, add `"@figma/code-connect/figma-types"` to the `types` array in your `tsconfig.json`.
29-
- JavaScript files are the default output of the `migrate` command. Can pass `--typescript` to output TypeScript (`.figma.ts`) files instead.
56+
- TypeScript files are the default output of the `migrate` command. Can pass `--javascript` to output JavaScript (`.figma.js`) files instead.
3057

3158
# Code Connect v1.4.1 (20th February 2026)
3259

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Code Connect is a tool for connecting your design system components in code with your design system in Figma. When using Code Connect, Figma's Dev Mode will display true-to-production code snippets from your design system instead of autogenerated code examples. In addition to connecting component definitions, Code Connect also supports mapping properties from code to Figma enabling dynamic and correct examples. This can be useful for when you have an existing design system and are looking to drive consistent and correct adoption of that design system across design and engineering.
44

5-
Code Connect is easy to set up, easy to maintain, type-safe, and extensible. Out of the box Code Connect comes with support for React (and React Native), Storybook, HTML (e.g. Web Components, Angular and Vue), SwiftUI and Jetpack Compose.
5+
Code Connect is easy to set up, easy to maintain, type-safe, and extensible. The easiest way to get started is using **template files** — a framework-agnostic way to represent any code snippet, giving you full control over how components appear in Dev Mode. Code Connect also includes framework-specific integrations for React (and React Native), Storybook, HTML (e.g. Web Components, Angular and Vue), SwiftUI and Jetpack Compose.
66

77
![image](https://static.figma.com/uploads/d98e747613e01685d6a0f9dd3e2dcd022ff289c0.png)
88

@@ -13,11 +13,11 @@ Code Connect is easy to set up, easy to maintain, type-safe, and extensible. Out
1313

1414
Use Figma’s Code Connect to make your design system easily accessible to your developers and create a shared source of truth for both the design and code elements.
1515

16-
Our Getting Started guide will walk you through the process of setting up Code Connect, using our interactive setup to automatically map components, and publishing your first components. **[Code Connect Documentation →](https://developers.figma.com/docs/code-connect/)**
16+
Our Getting Started guide will walk you through setting up Code Connect and publishing your first components using template files. **[Code Connect Documentation →](https://developers.figma.com/docs/code-connect/)**
1717

18-
Code Connect comes with support for different frameworks and languages. Our integration guides will walk you through the process of refining your components by mapping props and variants for:
18+
For framework-specific prop mapping and variant support, see the integration guides for:
1919

2020
- **[React (and React Native) →](https://www.figma.com/code-connect-docs/react)**
2121
- **[HTML (e.g. Web Components, Angular and Vue) →](https://www.figma.com/code-connect-docs/html)**
2222
- **[SwiftUI →](https://www.figma.com/code-connect-docs/swiftui)**
23-
- **[Jetpack Compose →](https://www.figma.com/code-connect-docs/compose)**.
23+
- **[Jetpack Compose →](https://www.figma.com/code-connect-docs/compose)**
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ declare module 'figma' {
5050
export interface TextHandle {
5151
readonly type: 'TEXT'
5252
readonly name: string
53+
readonly textContent: string
5354
__render__(): string
5455
}
5556

@@ -117,7 +118,7 @@ declare module 'figma' {
117118
opts?: SelectorOptions,
118119
): (InstanceHandle | ErrorHandle)[]
119120
findLayers(
120-
selectorFn: (node: InstanceHandle) => boolean,
121+
selectorFn: (node: InstanceHandle | TextHandle) => boolean,
121122
opts?: SelectorOptions,
122123
): (InstanceHandle | TextHandle | ErrorHandle)[]
123124
executeTemplate(): {
@@ -194,10 +195,16 @@ declare module 'figma' {
194195
isReactComponentArray(prop: unknown): boolean
195196
}
196197
swift: {
197-
renderChildren(children: ResultSection[], prefix: string): ResultSection[]
198+
renderChildren(
199+
children: ResultSection[] | string | undefined,
200+
prefix: string,
201+
): ResultSection[]
198202
}
199203
kotlin: {
200-
renderChildren(children: ResultSection[], prefix: string): ResultSection[]
204+
renderChildren(
205+
children: ResultSection[] | string | undefined,
206+
prefix: string,
207+
): ResultSection[]
201208
}
202209
}
203210
}

cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@figma/code-connect",
3-
"version": "1.4.2",
3+
"version": "1.4.3",
44
"description": "A tool for connecting your design system components in code with your design system in Figma",
55
"keywords": [],
66
"author": "Figma",
@@ -20,7 +20,7 @@
2020
"default": "./dist/react/index_react.js"
2121
},
2222
"./figma-types": {
23-
"types": "./figma-module.d.ts"
23+
"types": "./figma-types.d.ts"
2424
}
2525
},
2626
"repository": {
@@ -33,7 +33,7 @@
3333
},
3434
"files": [
3535
"dist/**/*",
36-
"figma-module.d.ts"
36+
"figma-types.d.ts"
3737
],
3838
"engines": {
3939
"node": ">=18"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
jest.mock('fs', () => ({ existsSync: jest.fn() }))
2+
jest.mock('../../common/logging', () => ({ exitWithError: jest.fn() }))
3+
4+
import path from 'path'
5+
import { filterProjectInfoByFile } from '../filter_project_info'
6+
7+
const { exitWithError } = jest.requireMock('../../common/logging')
8+
const { existsSync } = jest.requireMock('fs')
9+
10+
function makeProjectInfo(files: string[]) {
11+
return {
12+
absPath: '/project',
13+
files,
14+
remoteUrl: 'https://github.com/test/repo',
15+
config: {} as any,
16+
}
17+
}
18+
19+
describe('filterProjectInfoByFile', () => {
20+
beforeEach(() => jest.clearAllMocks())
21+
22+
it('returns projectInfo unchanged when --file is not specified', () => {
23+
const info = makeProjectInfo(['/a.ts', '/b.ts'])
24+
expect(filterProjectInfoByFile(info, undefined)).toBe(info)
25+
expect(existsSync).not.toHaveBeenCalled()
26+
})
27+
28+
it('returns projectInfo unchanged when file is empty string', () => {
29+
const info = makeProjectInfo(['/a.ts'])
30+
expect(filterProjectInfoByFile(info, '')).toBe(info)
31+
})
32+
33+
it('filters files to only the specified file', () => {
34+
const absFile = path.resolve('/project/a.ts')
35+
const info = makeProjectInfo([absFile, '/project/b.ts'])
36+
existsSync.mockReturnValue(true)
37+
38+
const result = filterProjectInfoByFile(info, '/project/a.ts')
39+
40+
expect(result.files).toEqual([absFile])
41+
expect(result.absPath).toBe(info.absPath)
42+
expect(result.remoteUrl).toBe(info.remoteUrl)
43+
expect(result).not.toBe(info)
44+
})
45+
46+
it('exits with error when the file does not exist on disk', () => {
47+
existsSync.mockReturnValue(false)
48+
filterProjectInfoByFile(makeProjectInfo([]), '/project/missing.ts')
49+
expect(exitWithError).toHaveBeenCalledWith(expect.stringContaining('File not found:'))
50+
})
51+
52+
it('exits with error when the file is not in the project file list', () => {
53+
existsSync.mockReturnValue(true)
54+
const absFile = path.resolve('/project/unlisted.ts')
55+
filterProjectInfoByFile(makeProjectInfo(['/other.ts']), '/project/unlisted.ts')
56+
expect(exitWithError).toHaveBeenCalledWith(
57+
expect.stringContaining(`File ${absFile} was not found in the project's file list`),
58+
)
59+
})
60+
})

0 commit comments

Comments
 (0)