lukehaas / RunJS

RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.
https://runjs.app
2.01k stars 43 forks source link

[Feature request] install packages from other registries, or https CDN sources #570

Open ortonomy opened 11 months ago

ortonomy commented 11 months ago

Motivation

Love RunJS and the node package support. It's really useful and saves me a lot of time to have to create my own little node project with TS support every time I just want a REPL to test code...

But....

Recently SheetJS / xlsx took a really weird decision to publish an update ONLY on their CDN as a tarball https://docs.sheetjs.com/docs/getting-started/installation/nodejs

image

So now, I can't install the latest version in RunJS

Idea

Thanks for listening!

lukehaas commented 11 months ago

Thanks, @ortonomy. I've previously looked into this. However, I encountered issues during the build step of a lot of common packages. Some can be installed without issues this way, usually, the ones that include dist files. But the lack of reliability around building packages made me not ship this as a feature. I might take a second look someday as it's certainly something that would be good to support.

ortonomy commented 11 months ago

Thanks for responding so fast @lukehaas .

How do you manage the package under the hood? In a package JSON? Could it be something you put behind an "Experimental" feature wall or "HERE BE DRAGONS - UNSUPPORTED FEATURE" kind of thing? Seems yarn, npm, and pnpm are all capable of handling this (at least from sheetJS's instructions)

Come on, gimme access 😄 Let me fiddle with that package.json file

lukehaas commented 11 months ago

It uses NPM to install and manage the packages. You could cd'ing into the RunJS app support directory, which is where the package.json is and try manually installing packages from github there.

ortonomy commented 11 months ago

Thank you! I'll let you know how it goes :D

oculus42 commented 10 months ago

Manual install from ~/Library/Application Support/runjs works for me.

Notes on my experience: Creating the npm config .npmrc file in that folder can cause some problems for the RunJS package lookup GUI. I set up an npm proxy (non-ssl) and was unable to lookup/install packages with a global, insecure registry set. I did not experience lookup issues for the nom global registry when using a scoped registry entry, but I was unable to lookup packages from that scope/registry.

None of that is surprising, but if someone places a .npmrc file in the folder they should expect it to cause headaches.