Skip to content

Instantly share code, notes, and snippets.

@diversemix
Last active February 21, 2022 14:08
Show Gist options
  • Save diversemix/45b83aa0eebde140891ed5a0b9a2ce81 to your computer and use it in GitHub Desktop.
Save diversemix/45b83aa0eebde140891ed5a0b9a2ce81 to your computer and use it in GitHub Desktop.
Create new node project
#!/bin/bash
#
# Takes one argument - the name of the package
#
mkdir $1
cd $1
npm init -y
echo 'console.log("hello");'>> index.js
cat package.json |jq --argjson scripts '{"start": "node ./index.js"}' '.scripts += $scripts' > new_package.json
cp package.json old_package.json
mv new_package.json package.json
npm i
npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment