srcbookdev / srcbook

TypeScript notebook for rapid prototyping
https://srcbook.com
Apache License 2.0
2.02k stars 56 forks source link

Auto-install deps when creating a new TS Srcbook #210

Open nichochar opened 1 month ago

nichochar commented 1 month ago

Auto-Install Dependencies for New TypeScript Srcbooks

Objective

Automatically install required dependencies (tsx, typescript, @types/node) when creating a new TypeScript Srcbook, eliminating the need for the "install dependencies" toast, which needs to be clicked 100% of the time.

Current Behavior

Proposed Change

Considerations

ThePrimeJnr commented 3 weeks ago

can I work on this??

just found out srcbook today and it's just been amazing. I'd like to make some contributions

nichochar commented 2 weeks ago

Hey @destinedcodes, sounds good, I've assigned the ticket to you. If you want to discuss the implementation or have any issues on the dev side of Srcbook, we have a Discord

BeRecursive22 commented 1 week ago

@nichochar @benjreinhart

Observed an edge case with Prettier formatting:

Root cause seems to be a dependency quirk.

Fix: send an additional cell:format event right after cell:create. This handles the dependency issue.

Tested and working as expected now. Let me know if we're good to go with this or want me to push this change.

image

screen-capture (16).webm

With above approach, the "Need to install deps" toast would not make much sense since the cell is ready to be executed even before having an actual code.

Aswanth-c commented 12 hours ago

Hey I'm back in action, started working on it, feel free to assign

Consider allowing users to opt out of auto-installation

for this, I'm considering a toggle option in the settings. Let me what you think about this approach.

Aryann15 commented 11 hours ago

Hey @nichochar, Can I work on this issue?

nichochar commented 4 hours ago

for this, I'm considering a toggle option in the settings. Let me what you think about this approach.

Yes, this works, let's default it to "auto-install".

Sorry @Aryann15 I'm going to assign @Aswanth-c as he asked first and has also already contributed. There are other issues with the "good first issue" tag you can tackle!