Skip to content

Commit 76c9fcc

Browse files
author
figma-bot
committed
Code Connect v1.0.6
1 parent 40bc9f6 commit 76c9fcc

File tree

15 files changed

+63
-1899
lines changed

15 files changed

+63
-1899
lines changed

CHANGELOG.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
# Code Connect v1.0.6 (21st August 2024)
2+
3+
## Fixed
4+
5+
### React
6+
- Fixed issue where props with special characters such as hyphens would not render properly. (https://github.com/figma/code-connect/issues/116)
7+
8+
## Features
9+
10+
11+
### React
12+
- figma.enum now supports floating point numbers
13+
14+
### Compose
15+
- Update the dependency for Code Connect to use Kotlin 2.0 libraries
16+
17+
118
# Code Connect v1.0.5 (13th August 2024)
219

3-
## Fixed
20+
## Fixed
421

522
### React
623
- Fixed an issue around creation of Code Connect files from the CLI assistant (fixes https://github.com/figma/code-connect/issues/125)

cli/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ In addition to the [general configuration](../README.md#general-configuration) f
116116
```jsonp
117117
{
118118
"codeConnect": {
119+
"parser": "react",
119120
"include": [],
120121
"exclude": ["test/**", "docs/**", "build/**"],
121122
"importPaths": {
@@ -246,7 +247,6 @@ export function ButtonExample({ label, disabled, type }) {
246247
247248
The `figma` import contains helpers for mapping all sorts of properties from design to code. They work for simple mappings where only the naming differs between Figma and code, as well as more complex mappings where the type differs. See the below reference for all the helpers that exist and the ways you can use them to connect Figma and code components using Code Connect.
248249
249-
250250
### figma.connect
251251
252252
`figma.connect()` has two signatures for connecting components.
@@ -288,16 +288,15 @@ figma.boolean('Has Icon', {
288288
true: <Icon />,
289289
false: <Spacer />,
290290
})
291-
292291
```
293292
294293
In some cases, you only want to render a certain prop if it matches some value in Figma. You can do this either by passing a partial mapping object, or setting the value to `undefined`.
295294
296295
```tsx
297296
// Don't render the prop if 'Has label' in figma is `false`
298-
figma.boolean("Has label", {
299-
true: figma.string("Label"),
300-
false: undefined
297+
figma.boolean('Has label', {
298+
true: figma.string('Label'),
299+
false: undefined,
301300
})
302301
```
303302
@@ -325,7 +324,7 @@ figma.enum('Variant', { Disabled: true })
325324
figma.connect(Modal, 'https://...', {
326325
props: {
327326
cancelButton: figma.enum('Type', {
328-
'Cancellable': <CancelButton />
327+
Cancellable: <CancelButton />,
329328
}),
330329
// ...
331330
},
@@ -402,10 +401,10 @@ It's common for components in Figma to have child instances that aren't bound to
402401
To illustrate this, consider the layer hierarchy in a component vs an instance of that component:
403402
404403
Button (Component)
405-
Icon (Instance) -- "Icon" is the original name of the layer, this is what you should pass to `figma.children()`
404+
Icon (Instance) -- "Icon" is the original name of the layer, this is what you should pass to `figma.children()`
406405
407406
Button (Instance)
408-
RenamedIcon (Instance) -- here the instance layer was renamed, which won't break the mapping since we're not using this name
407+
RenamedIcon (Instance) -- here the instance layer was renamed, which won't break the mapping since we're not using this name
409408
410409
Note that the nested instance also must be connected separately.
411410
@@ -421,7 +420,7 @@ figma.children(['Tab 1', 'Tab 2'])
421420
422421
### Wildcard match
423422
424-
`figma.children()` can be used with a single wildcard '*' character, to partially match names or to render any nested child. Wildcards cannot be used with the array argument. Matches are case sensitive.
423+
`figma.children()` can be used with a single wildcard '\*' character, to partially match names or to render any nested child. Wildcards cannot be used with the array argument. Matches are case sensitive.
425424
426425
```tsx
427426
// map any (all) child instances
@@ -478,6 +477,7 @@ figma.connect("https://...", {
478477
```
479478
480479
In Dev Mode this will display as:
480+
481481
```
482482
<button className="btn-base btn-large btn-disabled" />
483483
```

cli/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@figma/code-connect",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "A tool for connecting your design system components in code with your design system in Figma",
55
"keywords": [],
66
"author": "Figma",
@@ -66,7 +66,7 @@
6666
"@babel/types": "^7.24.7",
6767

6868
"@storybook/csf-tools": "^7.6.7",
69-
"axios": "^1.6.0",
69+
"axios": "^1.7.4",
7070
"boxen": "5.1.1",
7171
"chalk": "^4.1.2",
7272
"commander": "^11.1.0",

cli/src/cli.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
import * as commander from 'commander'
44
import { addConnectCommandToProgram } from './commands/connect'
55
import { updateCli } from './common/updates'
6+
import { maybePrefillWizardQuestionsForTesting } from './connect/wizard/helpers'
67

78
require('dotenv').config()
89

910
async function run() {
11+
maybePrefillWizardQuestionsForTesting()
1012

1113
const program = new commander.Command().version(require('./../package.json').version)
1214
program.enablePositionalOptions()

cli/src/connect/wizard/__test__/autolinking/autolinking.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { FigmaRestApi } from '../../../figma_rest_api'
22
import { autoLinkComponents, getBestMatchingExportWithinFile } from '../../autolinking'
3-
import polarisReact from './test_cases/polaris_react'
4-
import vitaminWeb from './test_cases/vitamin_web'
53

6-
const TEST_CASES = [vitaminWeb, polarisReact]
4+
5+
const TEST_CASES = [
6+
]
77

88
describe('autolinking', () => {
99
TEST_CASES.forEach((testCase) => {

0 commit comments

Comments
 (0)