Last active
December 20, 2018 21:08
-
-
Save Graham42/0f809cadc3460d021977e25d38bf082e to your computer and use it in GitHub Desktop.
Start a fresh nodejs 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
#!/usr/bin/env bash | |
set -e; | |
npm init -y | |
node -e "const pkg = require('./package.json'); | |
pkg.version = '0.0.0-dev' | |
pkg.license = 'MIT'; | |
pkg.scripts = pkg.scripts || {}; | |
pkg.scripts.lint = \"eslint . \"; | |
pkg.scripts['//postshrinkwrap'] = \"echo 'See issue: https://npm.community/t/some-packages-have-dist-tarball-as-http-and-not-https/285/26'\" | |
pkg.scripts.postshrinkwrap = \"npx [email protected] 'http://' 'https://' package-lock.json\" | |
require('fs').writeFileSync('package.json', JSON.stringify (pkg, null, 2), 'utf8'); | |
" | |
npx @graham42/prettier-config | |
npm install -D eslint eslint-config-prettier | |
cat <<EOF > .eslintrc.js | |
module.exports = { | |
extends: ["eslint:recommended", "prettier"], | |
env: { | |
browser: true, | |
node: true, | |
es6: true, | |
}, | |
rules: { | |
// logs are useful. | |
"no-console": "off", | |
}, | |
}; | |
EOF | |
cat <<EOF > .gitattributes | |
package-lock.json -diff | |
EOF | |
npx gitignore node | |
npm run format | |
git init | |
git add . | |
git commit -m "initial commit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment