Last active
April 4, 2018 14:17
-
-
Save zacharyabresch/93ea97f74d5e53485ff25dd2b07116cc to your computer and use it in GitHub Desktop.
A one-line terminal command for JS projects. Includes `webpack`, `babel`, `jest`, `eslint`. Great for scratch coding, katas, proof of concepts, etc.
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
#!/bin/bash | |
yarn init -y && yarn add --dev babel-core webpack webpack-cli jest-cli babel-jest babel-loader prettier pretty-quick husky babel-preset-env babel-preset-react eslint eslint-config-prettier eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react && echo '{ "presets": ["env", "react"] }' >> .babelrc && echo 'module.exports = { env: { jest: true }, extends: ["airbnb", "prettier"] };' >> .eslintrc.js && mkdir src && touch src/index.test.js src/index.js && touch README.md && sed -ie -E 's/("license": ".*",)/\1"scripts": { "start": "webpack --mode development", "test": "jest --watchAll" },/g' ./package.json && ./node_modules/.bin/prettier --write ./package.json && subl -an . |
Using this as a terminal command:
- Download the source code and put it somewhere (i.e.
~/scripts/newj.sh
) - Make it exectuable:
chmod u+x ~/scripts/newj.sh
- Run it where you want to initialize your project:
cd cool-project/ && ~/scripts/newj.sh
- Pro tip: Add this line to your
.bash_profile
and get a new CLI tool!alias newj='~/scripts/newj.sh'
then just usenewj
where ever, whenever!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace
subl -an .
with your editor's command for opening a directory.