Skip to content

Commit cfed2bf

Browse files
author
figma-bot
committed
Code Connect v1.3.1
1 parent 8206e0b commit cfed2bf

11 files changed

+87
-82
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Code Connect v1.3.1 (TBD)
2+
3+
## Fixed
4+
5+
- Allow .gradle files to be detected as Android/Compose projects. Thanks to @sebastienrouif for the [PR](https://github.com/figma/code-connect/pull/237)
6+
- Remove prompts patching (fixes https://github.com/figma/code-connect/issues/241)
7+
8+
## Features
9+
10+
- Added `interactiveSetupFigmaFileUrl` to the interactive setup, allowing you to specify the Figma file to use for connecting components in your `figma.config.json` file.
11+
- Rename `--include-raw-templates` flag to `--include-template-files`. Further details of this feature can be found in the [documentation](https://www.figma.com/code-connect-docs/no-parser/).
12+
13+
### SwiftUI
14+
- Updated `swift-syntax` to point to the new URL. Thanks to @pontusJPaf for the [PR](https://github.com/figma/code-connect/pull/239).
15+
116
# Code Connect v1.3.0 (28th January 2025)
217

318
## Features

Package.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ let package = Package(
88
name: "Figma",
99
platforms: [
1010
.iOS(.v15),
11-
.macOS(.v13)
11+
.macOS(.v13),
1212
],
1313
products: [
1414
.library(name: "Figma", targets: ["Figma"]),
15-
.executable(name: "figma-swift", targets: ["CodeConnectCLI"])
15+
.executable(name: "figma-swift", targets: ["CodeConnectCLI"]),
1616
],
1717
dependencies: [
18-
.package(url: "https://github.com/apple/swift-syntax", "510.0.3"..."600.0.0"),
18+
.package(url: "https://github.com/swiftlang/swift-syntax", "510.0.3"..."600.0.1"),
1919
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
2020
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.3"),
2121
],
@@ -28,7 +28,7 @@ let package = Package(
2828
name: "CodeConnectCLI",
2929
dependencies: [
3030
.product(name: "ArgumentParser", package: "swift-argument-parser"),
31-
.target(name: "CodeConnectParser")
31+
.target(name: "CodeConnectParser"),
3232
],
3333
path: "swiftui/cli"
3434
),
@@ -39,7 +39,7 @@ let package = Package(
3939
.product(name: "SwiftParser", package: "swift-syntax"),
4040
.product(name: "SwiftFormat", package: "SwiftFormat"),
4141
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
42-
.target(name: "Figma")
42+
.target(name: "Figma"),
4343
],
4444
path: "swiftui/lib"
4545
),
@@ -48,12 +48,12 @@ let package = Package(
4848
dependencies: [
4949
.product(name: "SwiftSyntax", package: "swift-syntax"),
5050
.target(name: "CodeConnectParser"),
51-
.target(name: "Figma")
51+
.target(name: "Figma"),
5252
],
5353
path: "swiftui/Tests/CodeConnectParserTest",
5454
resources: [
55-
.copy("Samples.figma.test"),
55+
.copy("Samples.figma.test")
5656
]
57-
)
57+
),
5858
]
5959
)

cli/package.json

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@figma/code-connect",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "A tool for connecting your design system components in code with your design system in Figma",
55
"keywords": [],
66
"author": "Figma",
@@ -29,8 +29,7 @@
2929
"figma": "bin/figma"
3030
},
3131
"files": [
32-
"dist/**/*",
33-
"patches/**/*"
32+
"dist/**/*"
3433
],
3534
"engines": {
3635
"node": ">=18"
@@ -41,7 +40,7 @@
4140
"build:web": "pnpm build",
4241
"build:webpack": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" webpack --mode production",
4342
"test": "npm run test:no-coverage -- --coverage",
44-
"test:no-coverage": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-deprecation\" npx jest",
43+
"test:no-coverage": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-deprecation --max-old-space-size=10240\" npx jest --logHeapUsage --workerIdleMemoryLimit=1.5G",
4544
"test:fast": "npm run test -- --testPathIgnorePatterns=template_rendering.test.ts --testPathIgnorePatterns=e2e_parse_command_swift.test.ts --testPathIgnorePatterns=e2e_wizard_swift.test.ts",
4645
"test:ci": "npm run test:non-mac -- --runInBand",
4746
"test:wizard": "npm run test -- --runInBand --testPathPattern=e2e_wizard_react.test.ts --testPathPattern=e2e_wizard_swift.test.ts",
@@ -59,11 +58,15 @@
5958
"bundle:cli:win": "npm run bundle:cli -- -o bundle-cli/figma-win --target node18-win-x64",
6059
"publish:npm": "npm install && npm run build && npm run bundle:npm-readme:prepare && npm publish --access public; npm run bundle:npm-readme:restore",
6160
"typecheck": "tsc --noEmit -p tsconfig-typecheck.json",
62-
"benchmarking:run": "npx tsx ./src/connect/wizard/__test__/prop_mapping/prop_mapping_benchmarking.ts",
63-
"postinstall": "patch-package"
61+
"benchmarking:run": "npx tsx ./src/connect/wizard/__test__/prop_mapping/prop_mapping_benchmarking.ts"
6462
},
6563
"devDependencies": {
64+
"@babel/core": "7.26.0",
65+
"@babel/generator": "7.26.2",
66+
"@babel/parser": "7.26.0",
67+
"@babel/types": "7.26.0",
6668

69+
"@storybook/csf-tools": "^8.4.7",
6770
"@types/cross-spawn": "^6.0.6",
6871
"@types/jest": "^29.5.13",
6972
"@types/jsdom": "^21.1.7",
@@ -74,6 +77,7 @@
7477
"@types/react": "18.0.26",
7578
"cross-env": "^7.0.3",
7679
"jest": "^29.7.0",
80+
"patch-package": "^8.0.0",
7781
"pkg": "^5.8.1",
7882
"react": "18.2.0",
7983
"ts-jest": "^29.2.5",
@@ -83,12 +87,7 @@
8387
"webpack-cli": "^5.1.4"
8488
},
8589
"dependencies": {
86-
"@babel/core": "7.26.0",
87-
"@babel/generator": "7.26.2",
88-
"@babel/parser": "7.26.0",
89-
"@babel/types": "7.26.0",
9090

91-
"@storybook/csf-tools": "^8.4.7",
9291
"boxen": "5.1.1",
9392
"chalk": "^4.1.2",
9493
"commander": "^11.1.0",
@@ -103,7 +102,6 @@
103102
"minimatch": "^9.0.3",
104103
"ora": "^5.4.1",
105104
"parse5": "^7.1.2",
106-
"patch-package": "^8.0.0",
107105
"prettier": "^2.8.8",
108106
"prompts": "^2.4.2",
109107
"strip-ansi": "^6.0.0",

cli/patches/@types+prompts+2.4.9.patch

-12
This file was deleted.

cli/patches/prompts+2.4.2.patch

-14
This file was deleted.

cli/src/commands/connect.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function addConnectCommandToProgram(program: commander.Command) {
8787
)
8888
.option('--skip-validation', 'skip validation of Code Connect docs')
8989
.option('-l --label <label>', 'label to apply to the published files')
90-
.option('--include-raw-templates', 'flag to include any raw figma.template.js files')
90+
.option('--include-template-files', 'flag to include any figma.template.js files')
9191
.option(
9292
'-b --batch-size <batch_size>',
9393
'optional batch size (in number of documents) to use when uploading. Use this if you hit "request too large" errors. See README for more information.',
@@ -106,7 +106,7 @@ export function addConnectCommandToProgram(program: commander.Command) {
106106
'specify the node to unpublish. This will unpublish for both React and Storybook.',
107107
)
108108
.option('-l --label <label>', 'label to unpublish for')
109-
.option('--include-raw-templates', 'flag to include any raw figma.template.js files')
109+
.option('--include-template-files', 'flag to include any figma.template.js files')
110110
.action(withUpdateCheck(handleUnpublish))
111111

112112
addBaseCommand(
@@ -115,7 +115,7 @@ export function addConnectCommandToProgram(program: commander.Command) {
115115
'Run Code Connect locally to find any files that have figma connections, then converts them to JSON and outputs to stdout.',
116116
)
117117
.option('-l --label <label>', 'label to apply to the parsed files')
118-
.option('--include-raw-templates', 'flag to include any raw figma.template.js files')
118+
.option('--include-template-files', 'flag to include any figma.template.js files')
119119
.action(withUpdateCheck(handleParse))
120120

121121
addBaseCommand(
@@ -209,7 +209,7 @@ export function parseRawFile(filePath: string, label: string | undefined): CodeC
209209
}
210210

211211
export async function getCodeConnectObjects(
212-
cmd: BaseCommand & { label?: string; includeRawTemplates?: boolean },
212+
cmd: BaseCommand & { label?: string; includeTemplateFiles?: boolean },
213213
projectInfo: ProjectInfo,
214214
silent = false,
215215
): Promise<CodeConnectJSON[]> {
@@ -275,7 +275,7 @@ export async function getCodeConnectObjects(
275275
}
276276
}
277277

278-
if (cmd.includeRawTemplates) {
278+
if (cmd.includeTemplateFiles) {
279279
const rawTemplateFiles = projectInfo.files.filter((f: string) =>
280280
f.endsWith('.figma.template.js'),
281281
)

cli/src/connect/__test__/e2e/e2e_parse_command_raw.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('e2e test for `parse` command (raw)', () => {
1010
const testPath = path.join(__dirname, 'e2e_parse_command/raw')
1111

1212
const result = await promisify(exec)(
13-
`npx tsx ../../../cli connect parse --skip-update-check --dir ${testPath} --include-raw-templates`,
13+
`npx tsx ../../../cli connect parse --skip-update-check --dir ${testPath} --include-template-files`,
1414
{
1515
cwd: __dirname,
1616
},

cli/src/connect/__test__/e2e/test_wizard_e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ export function testWizardE2e(testCase: {
7878
? `{
7979
"codeConnect": {
8080
"include": ${JSON.stringify(testCase.expectedIncludeGlobs)},
81-
"label": "${testCase.expectedLabel}"
81+
"label": "${testCase.expectedLabel}",
82+
"interactiveSetupFigmaFileUrl": "https://www.figma.com/design/abc123/my-design-system"
8283
}
8384
}
8485
`

cli/src/connect/project.ts

+11
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export type BaseCodeConnectConfig = {
6464
* Label to use for the uploaded code examples
6565
*/
6666
label?: string
67+
68+
/**
69+
* The URL of the Figma file to use during the interactive setup wizard for connecting code components to Figma components.
70+
*/
71+
interactiveSetupFigmaFileUrl?: string
6772
}
6873

6974
export type CodeConnectExecutableParserConfig = BaseCodeConnectConfig & {
@@ -202,6 +207,12 @@ function determineParserFromProject(dir: string): CodeConnectParser | undefined
202207
)
203208
parser = 'compose'
204209
return findUp.stop
210+
} else if (globSync([`${currentDir}/build.gradle`]).length > 0) {
211+
showParserMessage(
212+
`Using "compose" parser as a file matching build.gradle was found in ${currentDir}`,
213+
)
214+
parser = 'compose'
215+
return findUp.stop
205216
}
206217
}
207218
},

cli/src/connect/wizard/helpers.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ export async function createCodeConnectConfig({
7272
dir,
7373
componentDirectory,
7474
config,
75+
figmaUrl,
7576
}: {
7677
dir: string
7778
componentDirectory: string | null
7879
config: CodeConnectConfig
80+
figmaUrl: string
7981
}) {
8082
const label = DEFAULT_LABEL_PER_PARSER[config.parser as CodeConnectParser]
8183
const includesGlob = getIncludesGlob({ dir, componentDirectory, config })
@@ -84,12 +86,14 @@ export async function createCodeConnectConfig({
8486
? `{
8587
"codeConnect": {
8688
"include": ["${includesGlob}"],
87-
"label": "${label}"
88-
}
89+
"label": "${label}",
90+
"interactiveSetupFigmaFileUrl": "${figmaUrl}",
91+
}
8992
}`
9093
: `{
9194
"codeConnect": {
92-
"include": ["${includesGlob}"]
95+
"include": ["${includesGlob}"],
96+
"interactiveSetupFigmaFileUrl": "${figmaUrl}",
9397
}
9498
}`
9599

0 commit comments

Comments
 (0)