Create a NodeJS project

DRY

By Michelle Torres / @nmicht

Let me tell you an story

I was learning Python and decided to build some beatiful slides

Mardown version on Github, and slides version on Github Pages with Reveal.js

Why the f.. I was repeating myself again and again?

I need a generator for my beautiful slides

I was super excited creating my project to work, when...

Copy files, copy configuration, install the same damn packages...

I was repeating myself again!!

My first approach: Override npm init command

  • You have to place the script on your local
  • The prompt is not sync ...
  • You lost all the npm init stuff

Second approach: An npm initializer

No dependencies!

  1. Create the folder for the new project
  2. Use a questionnarie to guide through the options
  3. Create a git repo
  4. Copy the structured files
  5. Create a github repository
  6. Install eslint and testing dependencies
  7. Update package.json and Readme
  8. Commit and push the initial commit

Let's do a demo!

create-nodejs-project

  • The exec, spawn and handling the stdio
  • Promosify things
  • Sync chain
  1. params
  2. unit Test
  3. default values (questionnarie -y)
  4. colors
  5. error handling
  6. licenses

Send your feedback! Open issues! Show your love!

By Michelle Torres / @nmicht