simple git, yarn, react, mongo project checklist

mkdir foo && cd $_

git init

yarn add react

vi yarn.lock (if you’d like to see versions)

git add package.json yarn.lock

echo “/node_modules” >> .gitignore

git add .gitignore

touch README

git add README

git remote add origin git@github.som:credentials/foobar.git

git commit -m “Initial commit”

git push -u origin master

git checkout -b develop

git push -u origin develop

git checkout -b feature/foo develop

vi foo.js

git add foo.js

git commit -m “New foo file”

git rebase develop (if we believe changes have been made to origin develop, will pull those and then apply our commits)

git checkout develop

git merge feature/foo

git push

git checkout -b release/1.0 develop

git push -u origin release/1.0

git checkout -b hotfix/1.0 develop

etc.

——————

example index connecting to mongo:

require(‘dotenv’).config();

var MongoClient = require(‘mongodb’).MongoClient;

MongoClient.connect(process.env.MONGO_URI, function(err, db) {

    if (err) {

        console.log(‘Cannot connect to MongoDB!’, err);

    } else {

        console.log(‘Connected to MongoDB!’);

    }

});

(put env vars in .env file)

vi .env

MONGO_URI = mongodb://localhost:27017/foo

yarn add mongodb

yarn add dotenv

(have mongo installed and started first!):

brew install mongodb —with-openssl

brew services start mongodb

Connected to MongoDB!”

Leave a Reply

You must be logged in to post a comment.