npm init using
Want to download a git repository to use as a starting point for your own Node.js app but you don’t want to clone the repository?
npm init using <github-account>/<starter-project-name> <my-project>
What that will do is download the specified repository into the
my-project directory on your local machine.
Then, you can just:
cd my-project npm install
And you’re off!
For example, to start using the Site.js starter template for Vite + Svelte, do:
npm init using small-tech/site-vite-svelte my-site
How it works
Under the hood, this uses a tiged, a community-maintained forked of degit (see what they did there?) that I then subsequently forked and renamed to create-using.
npm init works,
npm init something gets translated to
npx create-something, which in turn downloads and runs the
create-something module from npm, which is supposed to, well, create something.
In this case,
tiged) downloads and extracts the tarball of the referenced git repository on GitHub (other hosts are also supported) to the local directory you specify.
So, basically it’s a little hack so we can have more expressive syntax.
If you don’t care for such things, you can do exactly the same thing using
npx tiged small-tech/site-vite-svelte my-site
Personally, I’d rather remember
npm init using but you do whatever floats your boat. Heck, you can even go old-skool and just clone the repository using git like some sort of cavaman! 😛️