srcbookdev / srcbook

TypeScript-centric app development platform
https://srcbook.com
Apache License 2.0
2.6k stars 101 forks source link

Adds mechanism to support managed npm install runs from within the app builder #381

Closed 1egoman closed 1 month ago

1egoman commented 1 month ago

This change adds a new context which can be used from within the app builder experience to programatically run npm install or npm install <packagename>. This builds on top of much of the existing package.json management logic originally built for srcbook notebooks. Also note that logs stream in while the npm install occurs live!

In addition, I've introduced a very barebones interface that can be used to try it out. Note that a more thought through interface is definitely the long term intention - I just wanted to get something out to get folks moving, and plan to follow up with something later here.

Finally, I've made some small tweaks to the statusbar panel to fix some rendering weirdnesses I encountered.

High level walkthrough

Screenshot 2024-10-17 at 3 56 26 PM

https://github.com/user-attachments/assets/853f93ea-7d29-4a20-9e6f-1f2a6eb6d7e6

Screenshot 2024-10-17 at 3 57 44 PM Screenshot 2024-10-17 at 3 58 25 PM
1egoman commented 1 month ago

Also worth calling out: there's nothing right now serverside to prevent two npm installs from happening concurrently. I can probably add some more client side validation to make that case impossible at least within the context of the client but I don't know how much of a real problem this actually is in practice.