Skip to content

Commit 018b53c

Browse files
r3econRafal Sroka
and
Rafal Sroka
authored
Enhance Error Messaging, Fix README Typos, and Improve Markdown Formatting (#257)
* Improve error description and include more troubleshooting information * Fix typos * Update readme --------- Co-authored-by: Rafal Sroka <rafal.sroka@srf.com>
1 parent 1f8d8f7 commit 018b53c

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Examples/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ The UI-Kit of the example project in Figma:
1212

1313
### Example iOS project
1414

15-
There are 2 example iOS projects in `Example` and `ExampleSwiftUI` directories which demostrates how to use figma-export with UIKit and SwiftUI.
15+
There are 2 example iOS projects in `Example` and `ExampleSwiftUI` directories which demonstrates how to use figma-export with UIKit and SwiftUI.
1616

1717
<img src="../images/figma.png" />
1818

1919
**How to setup iOS project**
2020
1. Open `Example/fastlane/.env` file.
2121
2. Change FIGMA_PERSONAL_TOKEN to your personal Figma token.
2222
3. Go to `Example` folder.
23-
4. Run the following command in Termanal to install cocoapods and fastlane: `bundle install`
24-
5. Run the following command in Termanal to install figma-export: `bundle exec pod install`
23+
4. Run the following command in Terminal to install CocoaPods and Fastlane: `bundle install`
24+
5. Run the following command in Terminal to install figma-export: `bundle exec pod install`
2525

2626
**How to export resources from figma**
2727
* To export colors run: `bundle exec fastlane export_colors`
@@ -39,7 +39,7 @@ There is an example Android Studio project in `AndroidExample` directory which d
3939

4040
### Example Android Jetpack Compose project
4141

42-
There is an example Android Studio project in `AndroidComposeExample` directory which demostrates how to use `figma-export` configured for Jetpack Compose.
42+
There is an example Android Studio project in `AndroidComposeExample` directory which demonstrates how to use `figma-export` configured for Jetpack Compose.
4343

4444
You can find the generated code for compose in the package `com.redmadrobot.androidcomposeexample.ui.figmaexport`
4545

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ Additionally, the following Swift file will be created to use colors from the co
8585
static var backgroundVideo: UIColor { return UIColor(named: #function)! }
8686
...
8787
}
88-
8988
```
9089

9190
For SwiftUI the following Swift file will be created to use colors from the code.
@@ -99,7 +98,6 @@ For SwiftUI the following Swift file will be created to use colors from the code
9998
static var backgroundVideo: Color { return Color(#function) }
10099
...
101100
}
102-
103101
```
104102

105103
If you set option `useColorAssets: False` in the configuration file, then will be generated code like this:
@@ -221,6 +219,7 @@ Example of these files:
221219

222220
Colors will be exported to `values/colors.xml` and `values-night/colors.xml` files.
223221
For Jetpack Compose, following code will be generated, if configured:
222+
224223
```kotlin
225224
package com.redmadrobot.androidcomposeexample.ui.figmaexport
226225

@@ -234,6 +233,7 @@ fun Colors.backgroundPrimary(): Color = colorResource(id = R.color.background_pr
234233
```
235234

236235
Icons will be exported to `drawable` directory as vector xml files. For Jetpack Compose, following code will be generated, if configured:
236+
237237
```kotlin
238238
package com.redmadrobot.androidcomposeexample.ui.figmaexport
239239

@@ -260,6 +260,7 @@ Vector images will be exported to `drawable` and `drawable-night` directories as
260260
Raster images will be exported to `drawable-???dpi` and `drawable-night-???dpi` directories as `png` or `webp` files.
261261

262262
Typography will be exported to `values/typography.xml`. For Jetpack Compose, following code will be generated, if configured:
263+
263264
```kotlin
264265
package com.redmadrobot.androidcomposeexample.ui.figmaexport
265266

@@ -290,16 +291,20 @@ object Typography {
290291
[Download](https://github.com/RedMadRobot/figma-export/releases) the latest release and read [Usage](#usage)
291292

292293
### Homebrew
293-
```
294+
295+
```bash
294296
brew install RedMadRobot/formulae/figma-export
295297
```
298+
296299
If you want to export raster images in WebP format install [cwebp](https://developers.google.com/speed/webp/docs/using) command line utility.
297-
```
300+
301+
```bash
298302
brew install webp
299303
```
300304

301305
### CocoaPods + Fastlane
302306
Add the following line to your Podfile:
307+
303308
```ruby
304309
pod 'FigmaExport'
305310
```
@@ -308,6 +313,7 @@ This will download the FigmaExport binaries and dependencies in `Pods/` during y
308313
`pod install` execution and will allow you to invoke it via `Pods/FigmaExport/Release/figma-export` in your Fastfile.
309314

310315
Add the following line to your Fastfile:
316+
311317
```ruby
312318
lane :sync_colors do
313319
Dir.chdir("../") do
@@ -321,6 +327,7 @@ Don't forget to place figma-export.yaml file at the root of the project director
321327
Run `fastlane sync_colors` to run FigmaExport.
322328

323329
## Usage
330+
324331
1. Open `Terminal.app`
325332
2. Go (cd) to the folder with `figma-export` binary file
326333
3. Run `figma-export`
@@ -413,7 +420,8 @@ Example of `figma-export.yaml` file for iOS project — [Examples/Example/figma-
413420
Example of `figma-export.yaml` file for Android project — [Examples/AndroidExample/figma-export.yaml](./Examples/AndroidExample/figma-export.yaml)
414421

415422
Generate `figma-export.yaml` config file using one of the following command:
416-
```
423+
424+
```bash
417425
figma-export init --platform android
418426
figma-export init --platform ios
419427
```

Sources/FigmaAPI/Model/FigmaClientError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct FigmaClientError: Decodable, LocalizedError {
77
var errorDescription: String? {
88
switch err {
99
case "Not found":
10-
return "Figma file not found. Check lightFileId and darkFileId (if you project supports dark mode) in the yaml config file."
10+
return "Figma file not found. Check lightFileId and darkFileId (if your project supports dark mode) in the yaml config file. Also verify that your personal access token is valid and hasn't expired."
1111
default:
1212
return "Figma API: \(err)"
1313
}

0 commit comments

Comments
 (0)