Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomas-figma committed Apr 16, 2024
0 parents commit 8e3161e
Show file tree
Hide file tree
Showing 129 changed files with 15,832 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.env
figma.config.json
.DS_Store
node_modules
dist/
src/components
src/bindings.ts
test-files
coverage
bundle/
.build/
.swiftpm/
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

Thank you for your interest in contributing to this project! However, we are currently not accepting any PRs at this time. We are in the early stages of the development of Code Connect and not ready to accept external contributions through PRs.

## How can you contribute?

Although we are not accepting PRs, there are still ways you can contribute to the project:

1. **Testing**: Help us by testing Code Connect in your codebase and reporting any bugs or issues you encounter.
2. **Feedback**: Provide feedback on the existing features and API and suggest improvements or new ideas.

## Contact

If you have any questions please reach out to us through the project's issue tracker.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Figma

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"pins" : [
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "46989693916f56d1186bd59ac15124caef896560",
"version" : "1.3.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
}
},
{
"identity" : "swiftformat",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "9e5d0d588ab6e271fe9887ec3dde21d544d4b080",
"version" : "0.53.5"
}
}
],
"version" : 2
}
59 changes: 59 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import CompilerPluginSupport
import PackageDescription

let package = Package(
name: "Figma",
platforms: [
.iOS(.v15),
.macOS(.v13)
],
products: [
.library(name: "Figma", targets: ["Figma"]),
.executable(name: "figma-swift", targets: ["CodeConnectCLI"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", from: "509.1.1"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.49.0"),
],
targets: [
.target(
name: "Figma",
path: "swiftui/sdk"
),
.executableTarget(
name: "CodeConnectCLI",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.target(name: "CodeConnectParser")
],
path: "swiftui/cli"
),
.target(
name: "CodeConnectParser",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftFormat", package: "SwiftFormat"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.target(name: "Figma")
],
path: "swiftui/lib"
),
.testTarget(
name: "CodeConnectParserTest",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.target(name: "CodeConnectParser"),
.target(name: "Figma")
],
path: "swiftui/Tests/CodeConnectParserTest",
resources: [
.copy("Button.figma.test"),
]
)
]
)
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Code Connect

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.

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, Storybook and SwiftUI.

![image](https://static.figma.com/uploads/1886c9dbc6742f3eeaba7c0b4d6276a44aac0cb7.png)

> [!NOTE]
> Code Connect is available on Organization and Enterprise plans and requires a full Design or Dev Mode seat to use. Code Connect is currently in beta, so you can expect this feature to change. You may also experience bugs or performance issues during this time.
## Installation

To learn how to implement Code Connect for your platform, please navigate to the platform-specific API usage and documentation.

- [React](react/README.md)
- [SwiftUI](swiftui/README.md)
58 changes: 58 additions & 0 deletions react/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("//bazel/js:defs.bzl", "ts_project")

npm_link_all_packages(name = "node_modules")

ts_project(
name = "ts",
srcs = glob(
[
"src/**/*.ts",
],
exclude = [
"src/**/__test__/**",
],
),
tsconfig = "tsconfig.json",
deps = [
":node_modules/@types",
":node_modules/axios",
":node_modules/chalk",
":node_modules/commander",
":node_modules/glob",
":node_modules/lodash",
":node_modules/minimatch",
":node_modules/prettier",
":node_modules/typescript",
],
)

copy_to_directory(
name = "dist",
srcs = [
":ts",
":ts_typecheck",
],
replace_prefixes = {
"src/": "/",
},
)

write_source_files(
name = "build_dist",
files = {"dist": "dist"},
visibility = ["//web:__pkg__"],
)

npm_package(
name = "npm_package",
srcs = [
"package.json",
":dist",
],
package = "@figma/code-connect",
visibility = ["//visibility:public"],
)

0 comments on commit 8e3161e

Please sign in to comment.