Skip to content

Commit d02ff6a

Browse files
authored
Build instructions (#132)
* updates to build instructions, readme, package.json, turbo.json and added a .node-version file. * Added details about different packages to README * added .prettierrc to trigger prettier in vscode
1 parent 17ac70d commit d02ff6a

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.12.0

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,35 @@ When finding the unknown (a `Group` or `Frame` with more than one child and no v
5252

5353
## How to build the project
5454

55-
The project is configured to be built with Webpack or Rollup. The author couldn't find a way to correctly configure Svelte in Webpack, so Rollup was added. But Rollup is a lot less stable than Webpack and crashes regularly in watch mode when editing Typescript files. So, if you are going to work with Typescript only, I recommend sticking with Webpack. If you are going to make changes in the UI, you **need** to use Rollup for now.
55+
### Package Manager
56+
57+
The project is configured for [pnpm](https://pnpm.io/). To install, see the [installation notes for pnpm](https://pnpm.io/installation).
58+
59+
### Monorepo
60+
61+
The plugin is organized as a monorepo. There are several packages:
62+
63+
- packages/backend - Contains the business logic that reads the Figma API and converts nodes
64+
- packages/plugin-ui - Contains the common UI for the plugin
65+
- packages/eslint-config-custom - Config file for ESLint
66+
- packages/tsconfig - Collection of TSConfig files used throughout the project
67+
68+
- apps/plugin - This is the actual plugin assembled from the parts in backend & plugin-ui. Within this folder it's divided between:
69+
- plugin-src - loads the backend and compiles to code.js
70+
- ui-src - loads the common plugin-ui and compiles to index.html
71+
- apps/debug - This is a debug mode plugin that is a more convenient way to see all the UI elements.
72+
73+
The plugin is built using Turbo which in turn builds the internal packages.
74+
75+
#### Commands
76+
77+
`pnpm run ...`
78+
79+
- `dev` - runs the app in dev mode
80+
- `build`
81+
- `build:watch`
82+
- `lint`
83+
- `format` - formats with prettier (warning: may edit files!)
5684

5785
## Issues
5886

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2+
"name": "figma-to-code",
23
"private": true,
4+
"packageManager": "[email protected]",
35
"scripts": {
46
"build": "turbo run build",
57
"build:watch": "turbo run build:watch",
68
"dev": "turbo run dev --concurrency 20",
79
"lint": "turbo run lint",
8-
"format": "prettier --write \"**/*.{ts,tsx,md}\""
10+
"format": "prettier --write \"**/*.{ts,tsx,css,md}\""
911
},
1012
"devDependencies": {
1113
"eslint": "^9.7.0",

turbo.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"$schema": "https://turbo.build/schema.json",
3-
"pipeline": {
3+
"tasks": {
44
"build": {
55
"outputs": [".next/**", "!.next/cache/**"]
66
},
7+
"dev": {
8+
"cache": false,
9+
"persistent": true
10+
},
11+
"lint": {
12+
"outputs": [],
13+
"dependsOn": ["^build"],
14+
"inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts", "test/**/*.tsx", ".eslintrc.js"]
15+
},
716
"type-check": {}
817
}
918
}

0 commit comments

Comments
 (0)