privatenumber / link

🔗 A better `npm link`
197 stars 8 forks source link

Expose link functionality as API #20

Open mmunte-impeo opened 7 months ago

mmunte-impeo commented 7 months ago

Feature request

Link is a great tool. Been using it for some time now. It would be great to be able to use it not only as CLI tool, but as API. For some more complex workflows, this could be very handy.

Motivations

My current project has grown complex. TSC compile is taking too long. I will rework it to use rebuild for the transpiration and bundling - which is blazing fast. In parallel, TSC can do type checking. Esbuild can be very easily automated from code, like can the Typescript compiler. it would make sense to just call "link" as function, instead of having to call it as CLI process.

Just a small change to the library would be needed... to export the symlinkPackage function in addition to the CLI

Alternatives

No response

Additional context

No response

Contributions

privatenumber commented 7 months ago

Great idea!

What do you think of this API? Where cwd defaults to the current project but you can pass in a different project path.

import { linkPackage } from 'link'

await linkPackage(sourcePackagePath, cwd?)

How much would you be willing to sponsor?