Initializing the Project
After you’ve installed Node, the first step is to set up a new project. In your shell, navigate to a directory where you want to create a project. Then, run:
mkdir your-project-name && cd your-project-name
This will create a directory for your project (the first command) and then navigate into that new directory (the second command). If you’re new to the shell, the
&& operator can be used to run both commands, one after the other. You can chain together the
&& for as many commands as you wish.
Now that you’re inside your new project directory, you can run
npm init to initialize the new project. It will ask you for a few pieces of data such as the version number of your app, a description, etc. You can always change these things later, so don’t sweat it too much. If you’d prefer to keep everything as the default value, simply run
npm init -y.
Once this is finished, you’ll have a new file inside your directory:
devDependencies keys. These are the main objects we’ll be adding to throughout the project.
Initializing the Git Repo
The next thing you’ll do is set up a Git repo for the project. First, create a new file
.gitignore file with the following:
git init in your shell. This will initialize the Git repository. Then you can run
git add . to stage the files you’ve created so far, and
git commit -m "initial commit" to make your first commit to the project.
In the next post I’ll outline how you can set up Parcel, the build tool I used for this project, and we’ll do a gut check with React to ensure everything is working.