npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Moving scripts into their own packages

I have a few serialport cli scripts and I want to break them out into scoped @serialport/packages but I’d like to somehow bring them into the package I’m splitting them out of.

Specifically

serialport-list
serialport-term

All exist in the serialport package. I did figure out I could move them to

@serialport/term
@serialport/list

And then this will work

npx @serialport/term

But how can do I expose them in the serialport package if I move them?


What do you mean by “expose”?

Why does npx @serialport/term not work for you?


I guess I want them to ship in SerialPort too so people who just upgrade can still run it.


Then add the packages as dependencies. Then they can call npx @serialport/term and it will execute them without needing to download.


I guess this will have to be a breaking change. :thinking:


You could write a thing wrapper script which imports the library from the command package and runs that …