Skip to content

Commit e946be8

Browse files
chore(intenral-docs): add icons doc (#4215)
* chore(intenral-docs): add icons doc * chore(internal-docs): backend development * chore(internal-docs): update backend docs * chore(internal-docs): fix typo --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 82d9d42 commit e946be8

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

internal-docs/engineering/developing-locally.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [Working on components](#working-on-components)
1414
- [Working on the docs site](#working-on-the-docs-site)
1515
- [Working on Remix (Theme Designer)](#working-on-remix-theme-designer)
16+
- [Working on Backend](#working-on-backend)
1617

1718
## Prerequisites
1819

@@ -300,3 +301,72 @@ Then run:
300301
```bash
301302
yarn start:theme-designer
302303
```
304+
305+
## Working on Website Backend
306+
307+
This section covers how to setup the Supabase backend and configuring additional environment variables. This will enable development of AI assistant and generation scripts such as [generate-embeddings.ts](../../packages/paste-website/scripts/search/generate-embeddings.ts)
308+
309+
### Prerequisites
310+
311+
You will need docker or a similar service in order to start the local supabase instance.
312+
313+
### Environment
314+
315+
To run the backend and develop all functionality of the website you will need to add additional variable in the `.env` file previously configured
316+
317+
**Note**: access can be granted internally to OpenAI via the Service portal
318+
319+
<table>
320+
<tr>
321+
<td>OPENAI_API_KEY
322+
</td>
323+
<td>The token used to interact with OpenAI
324+
</td>
325+
</tr>
326+
<tr>
327+
<td>OPENAI_API_SECRET
328+
</td>
329+
<td>The secret provided by OpenAI
330+
</td>
331+
</tr>
332+
<tr>
333+
<td>OPENAI_ASSISTANT_ID
334+
</td>
335+
<td>The assistant id for the OpenAI project
336+
</td>
337+
</tr>
338+
<tr>
339+
<td>SUPABASE_URL
340+
</td>
341+
<td>The url of the supabase backend you want to use. For local development is should map to <strong>http://127.0.0.1:54321</strong>
342+
</td>
343+
</tr>
344+
<tr>
345+
<td>SUPABASE_KEY
346+
</td>
347+
<td>This will be generated and output from the start command in `/apps/backend`. It can also be retrieved by running `npx supabase status` in the directory.
348+
</td>
349+
</tr>
350+
<tr>
351+
<td>GH_SERVICE_ACC_DISCUSSIONS_TOKEN
352+
</td>
353+
<td>Used for embeddings script, must be a token with read access to Paste repo discussions.
354+
</td>
355+
</tr>
356+
<tr>
357+
<td>ROLLBAR_ACCESS_TOKEN
358+
</td>
359+
<td>A dummy value can be used for local development e.g. "MOCK_TOKEN"
360+
</td>
361+
</tr>
362+
</table>
363+
364+
### Running Supabase
365+
366+
Supabase is the data storage layer used by the application. We use it to store messages with the Paste AI Assistant and also storing embeddings used by our search functionality for pages and GitHub discussions.
367+
368+
With Docker or a similar service running, you can start supabase by running `start:backend:dev`. This will output details of the envirnment such as auth tokens used to connect to the APIs and URLs of the frontent and services.
369+
370+
You should be able to access the UI at http://localhost:54323.
371+
372+
Migrations should be applied by default. If there are no tables on startup run the `db:reset` command in the `apps/backend` directory.

internal-docs/engineering/icons.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Icons
2+
3+
- [Icons](#icons)
4+
- [Adding Icons](#adding-icons)
5+
- [Generating Icons](#generating-icons)
6+
7+
Our icons are converted from SVG to React components at compile time using our own “svg-to-react” library: [https://github.com/twilio-labs/svg-to-react](https://github.com/twilio-labs/svg-to-react)
8+
9+
## Adding Icons
10+
11+
The process for adding icons is very simple thanks to our naming conventions and conversion library.
12+
13+
Any new SVG assets must be copied into the [svg](../../packages/paste-icons/svg/) folder. We often see the `viewBox` attribute missing so be sure the top level element has the following:
14+
15+
```html
16+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
17+
```
18+
19+
## Generating Icons
20+
21+
To generate newly added icons you can use the command `yarn convert:icons:new` from the root of the repo. This will create the new React components and appends the "Icon" string to the component name.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"generate:embeddings:refresh": "yarn nx run @twilio-paste/website:generate:embeddings:refresh",
5252
"generate:db-types": "yarn nx run @twilio-paste/backend:generate:db-types",
5353
"generate:website-data": "yarn workspace @twilio-paste/website fetch:data",
54+
"convert:icons:new": "yarn workspace @twilio-paste/icons convert-new",
5455
"pre-push": "concurrently \"yarn:lint\" \"yarn:test\" \"yarn:format\" \"yarn:type-check\"",
5556
"prerelease": "yarn build && yarn generate:website-data && yarn lint && yarn test",
5657
"release": "yarn changeset publish",

0 commit comments

Comments
 (0)