DEV Community

Discussion on: How to create a basic npx command-line library

Collapse
 
9zemian5 profile image
Oleksandr Demian

Hi Kumar. I've done a similar thing a while ago for Svelte: link. It works the same way as create-react-app: you run npx svelte3-app (+ some params) and it will prepare the project for you.

It is very simple under the hood. It uses degit to clone svelte starter project from github to your local machine, installs the dependencies and you are ready to work with Svelte. Obviously, it is far from create-react-app, but it is a good starting point. For some more advanced things, you will have to write custom scripts.

So in general I think you need to prepare your template project (one or more based on different variants), download it (from github or whatever), and eventually manage some post download tasks (like updating package.json, rewriting some configs based on user input etc).

Hope this will serve you as a starting point.