Skip to content

Instantly share code, notes, and snippets.

@claudiobusatto
Last active December 23, 2019 12:29
Show Gist options
  • Save claudiobusatto/5a9b8dcb286a0355a8ee7c20d7da23d1 to your computer and use it in GitHub Desktop.
Save claudiobusatto/5a9b8dcb286a0355a8ee7c20d7da23d1 to your computer and use it in GitHub Desktop.
Function to scaffold node projects faster
# This gist is based on https://philna.sh/blog/2019/01/10/how-to-start-a-node-js-project/
# 1. Configure your npm
npm set init.author.name "Your name"
npm set init.author.email "[email protected]"
npm set init.author.url "https://your-url.com"
npm set init.license "MIT"
npm set init.version "1.0.0"
# 2. Include this function to your bash_profile, e.g. ~/.zshrc
function create-node {
mkdir $1 && cd $1
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"
}
# 3. Source it
source ~/.zshrc
# 4. Start using the new function to create your node apps!
create-node app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment