Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ This repo hosts the code for the FRCDesign Onshape App.

## Overview

The app code lives under `src/`. The app is written entirely in TypeScript and uses Hono for the backend and Vite and React for the frontend.
The app is deployed using Cloudflare Workers and uses the various Cloudflare products for the database and other aspects of the app.

This repo is intended to be run with VSCode on Linux using WSL Ubuntu.
While it should be possible to use other technologies, they aren't tested and may require additional work to get running.

The local dev environment typically needs either Google Chrome or Firefox to work correctly with Onshape.

_Other browsers, such as Brave, can have default security policies that prevent the dev environment from working with Onshape._

# Local Development Setup

First, create a new file in the root of this project named `.env` and add the following contents:
Create a new file in the root of this project named `.env` and add the following contents:

```
# Server config
Expand Down Expand Up @@ -44,7 +44,7 @@ To test Onshape app changes, you will need to create an OAuth application in the
- OAuth URL: `https://localhost:3000/auth/sign-in`
- Check the permissions `can read your profile information`, `can read your documents`, `can write to your documents`, and `can delete your documents and workspaces`.

Click Create application, then copy your OAuth app's OAuth client secret (in the popup) and OAuth client identifier into your `.env` file.
Click Create application, then copy your OAuth app's OAuth client secret (from the popup) and OAuth client identifier into your `.env` file.

Next, add the necessary Extensions to your OAuth application so you can see it in documents you open:

Expand Down Expand Up @@ -76,7 +76,7 @@ Note that Onshape has an annual limit of 2,500 API calls per Onshape account. Th

In particular, avoid loading large documents into your local environment and only force reload the database when necessary.

## Flask Credentials Setup
## HTTPS Setup

Onshape requires all apps, even temporary test apps, to use https. This creates a big headache for local development.

Expand Down Expand Up @@ -107,18 +107,19 @@ If it doesn't, you'll need to add the Certificate Authority manually. In Firefox
1. Open Firefox and go to `Settings > Certificates > View Certificates... > Authorities > Import...`
1. Navigate to the `CAROOT` path and select `rootCA.pem`.

## Frontend Setup
## VSCode Setup

First, install npm in your WSL container and add the dependencies:
Install nvm (node version manager) in your WSL container, install npm, and then install the dependencies:

```
sudo apt install npm
npm install
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.5/install.sh | bash
nvm i node
npm i
```

## Development Servers

You should now be able to run the `Launch servers` VSCode task to launch Vite.
You should now be able to run the `Launch dev` VSCode task to launch Vite.
You should then be able to launch the FRC Design App from the right panel of any Onshape Part Studio or Assembly and see the FRC Design App UI appear.

To see documents, add one or more documents and push a new app version to rebuild the search database.
Expand All @@ -127,6 +128,10 @@ To view the state of Cloudflare, type `e` in Vite to launch the local Cloudflare

# Troubleshooting

## Onshape fails to load

Double check your Action URLs configured in Onshape. You can also open Browser Dev Tools (usually F12), then open the app in Onshape and see if any errors or warnings appear in the Console or the Network tab.

## Port Taken/Not Available

Occasionally, a process will fail to fully shut down, causing problems when you next attempt to `Launch servers` since the port is already taken.
Expand Down
2 changes: 2 additions & 0 deletions drizzle/0001_tricky_rhodey.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `groups` ADD `build_issues` text DEFAULT '[]' NOT NULL;--> statement-breakpoint
ALTER TABLE `insertables` ADD `build_issues` text DEFAULT '[]' NOT NULL;
1 change: 1 addition & 0 deletions drizzle/0002_configurations_build_issues.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `configurations` ADD `build_issues` text NOT NULL DEFAULT '[]';
Loading
Loading