Last active
January 18, 2019 07:12
-
-
Save emmanuelnk/3d577224b27241fdfc24bdf1c512944a to your computer and use it in GitHub Desktop.
Start new npm projects easily (courtesy https://philna.sh/blog/2019/01/10/how-to-start-a-node-js-project/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first install npx (https://github.com/zkat/npx) | |
npm install -g npx | |
# set your npm defaults if you havent already | |
npm set init.author.name "Your name" | |
npm set init.author.email "your@email.com" | |
npm set init.author.url "https://your-url.com" | |
npm set init.license "MIT" | |
npm set init.version "1.0.0" | |
# open bash profile to add following function | |
nano ~/.bash_profile | |
# copy into file | |
function node-project { | |
git init | |
npx license $(npm get init.license) -o "$(npm get init.author.name)" > LICENSE | |
npx gitignore node | |
npx covgen "$(npm get init.author.email)" | |
npm init -y | |
git add -A | |
git commit -m "Initial commit" | |
} | |
source ~/.bash_profile | |
# now, whenever you want to run a new node project, just execute: | |
node-project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment