Skip to main content

Command Palette

Search for a command to run...

Bootstrap your next project with npm init

Updated
Bootstrap your next project with npm init
N

HI there 馃憢

I'm Nir Adler, and I'm a Developer, Hacker and a Maker, you can start with me a conversation on any technical subject out there, you will find me interesting.

With the latest npm versions, you can trigger npx with npm init.

Try it out with:

npm init react-app

Basically behind the scene, npm init will run npx create-react-app

Based on that knowledge, let鈥檚 create a bootstrapper package and deploy it to the npm registry.

The bootstrapper I decided to create is for open-source projects.

Features:

  • Run git init

  • Create license file

  • Create git ignore file

  • Create CODE_OF_CONDUCT.md

  • Run npm init -y

  • Add initial git commit.

The code: ( github)

Let鈥檚 pick a name for our package, we learned we need to prefix the name with create- and we are going to create package for open source project so the obvious name is going to be create-open-source.

For those who didn鈥檛 try to publish packages to the npm registry, you should sign up on npmjs.com and try npm publish in your project folder, make sure the name is unique.

Now let鈥檚 try it out:

mkdir new-project 
cd new-project 
npm init open-source

Originally published at https://niradler.com on April 16, 2019.

More from this blog

P

Piece by Piece

46 posts

Hi 馃憢, let me share a story with you. I don't want to overwhelm you, so I'm serving this story piece by piece.