feat(dashboard, ui): Support TypeScript in the playground#919
feat(dashboard, ui): Support TypeScript in the playground#919akitaSummer wants to merge 15 commits intolagonapp:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 10297c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@akitaSummer is attempting to deploy a commit to the Lagon Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for this PR, I'll work on #887 first (will take a bit of time, it requires a lot of work) |
|
Side note: I'm not sure if this is the right approach (we might need more changes):
This is "expected" since this approach bundles the code before uploading it, but that means we lose the original TS code. We might want to also save the original TS code and upload it alongside the bundled code, to be able to use it later (but only for deployments in the playground) |
@QuiiBz |
|
@QuiiBz |
QuiiBz
left a comment
There was a problem hiding this comment.
Thanks for this PR! Some feedback:
| }), | ||
| ...(tsCode.length > 0 | ||
| ? [ | ||
| fetch(deployment.tsCodeUrl!, { |
There was a problem hiding this comment.
I'm wondering if it makes sense to only upload the TS code when we previously had a TS code? Meaning TS is only supported when creating Functions via the dashboard, and not when creating them via the CLI (which makes sense because we can't support this)
There was a problem hiding this comment.
I understand what you're saying. Firstly, V8 can only run JS code, which means we only have two options: one is to store only TS code and transpile it to JS at runtime, but it will reduce our performance, so I don't recommend this approach. The other option is to store both TS and JS code, but it will cost us more space. I chose the latter because for users, response time is the most important factor. Also, as you mentioned, the CLI results will only support JS, and I think this is unavoidable in the current scenario. If you want to avoid this problem, the playground would have to implement a file system (such as using a webcontainer), which would involve a lot of work and is not within the scope of this PR.
There was a problem hiding this comment.
Completely agree. We could probably add a new column to the Function table that will be used to check if the function has been created using the CLI or the Dashboard. With that, we could easily only show the Playground button if the Function has been created from the Dashboard.
There was a problem hiding this comment.
Give it a try and see if it meets your requirements.
There was a problem hiding this comment.
Thanks, I'll take a look this weekend and we then should be ready to merge
There was a problem hiding this comment.
@QuiiBz How is the progress, can this pr be merged?
QuiiBz
left a comment
There was a problem hiding this comment.
I was really busy recently, apologize for the delay
| triggerer String @default("Lagon") | ||
| commit String? | ||
| isProduction Boolean @default(false) | ||
| platform String @default("CLI") |
There was a problem hiding this comment.
The platform should be set to a Function and not a Deployment
There was a problem hiding this comment.
Give it a try and see if it meets your requirements.
| <div className={cx(['group flex w-full justify-between rounded-md px-2 py-1', containerStyle])}> | ||
| <div className="flex items-start gap-4"> | ||
| <p className={cx(['w-36 whitespace-pre text-sm', dateStyle])}>{date.toLocaleString('en-US')}</p> | ||
| {date && <p className={cx(['w-36 whitespace-pre text-sm', dateStyle])}>{date.toLocaleString('en-US')}</p>} |
There was a problem hiding this comment.
| {date && <p className={cx(['w-36 whitespace-pre text-sm', dateStyle])}>{date.toLocaleString('en-US')}</p>} | |
| {date ? <p className={cx(['w-36 whitespace-pre text-sm', dateStyle])}>{date.toLocaleString('en-US')}</p> : null} |
| > | ||
| Copy | ||
| </span> | ||
| {!hiddenCopy && ( |
There was a problem hiding this comment.
Let's use a descriptive name instead of double negation:
| {!hiddenCopy && ( | |
| {showCopy ? ( |
#854