-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dashboard, ui): Support TypeScript in the playground #919
base: main
Are you sure you want to change the base?
feat(dashboard, ui): Support TypeScript in the playground #919
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! Some feedback:
}), | ||
...(tsCode.length > 0 | ||
? [ | ||
fetch(deployment.tsCodeUrl!, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give it a try and see if it meets your requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll take a look this weekend and we then should be ready to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@QuiiBz How is the progress, can this pr be merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was really busy recently, apologize for the delay
@@ -143,6 +143,7 @@ model Deployment { | |||
triggerer String @default("Lagon") | |||
commit String? | |||
isProduction Boolean @default(false) | |||
platform String @default("CLI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The platform should be set to a Function
and not a Deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give it a try and see if it meets your requirements.
@@ -38,15 +39,17 @@ export const LogLine = ({ date, level = 'info', message }: LogLineProps) => { | |||
return ( | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
> | ||
Copy | ||
</span> | ||
{!hiddenCopy && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a descriptive name instead of double negation:
{!hiddenCopy && ( | |
{showCopy ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#854