Project Setup Tutorial

Updated on

This is a supplemental post that explains how I install the helper files in some of my tutorials.

The current helper files can be found on Github.

Installing degit

First, install degit:

npm init -g degit

The degit command downloads a Git repository without the Git versioning or branches. It’s a way to download only the repo’s files and not the .git directory.

Downloading the Helper Files

Then you can install the helper files in any project with the command below. Be careful, because --force will overwrite files with the same names if they exist. The files were named so they won’t clash with most projects, but I generally only use this command on new repos:

degit j127/project_starter --force

The main files at the time of writing this are:

After you download the files, move them from helper_files into the root of your project. Then delete the helper_files directory and also the .gitignore/README.markdown file.

If you want to create your own version of the helper files, fork the j127/project_starter repo and edit the files in your copy. Then point the command at your repo instead of mine, something like this:

degit your-github-username/project_starter --force

JavaScript and TypeScript Projects

If there is JavaScript or TypeScript in the project, I add a format script to the "scripts" section in package.json to make it easier to format my code:

"scripts": {
    "format": "prettier --write '**/*.{md,mdx,ts,js,jsx,tsx,yaml,yml,json,html,css,scss}'"
},

Then I make sure prettier.js is installed with either yarn add -D prettier or npm i -D prettier.

Once that is done, you can format all the code in your project with one of these commands:

NPM:

npm run format

Yarn:

yarn format

Python Projects

I use Poetry to manage dependencies in most of my Python projects.

This command walks through setting up a new project:

poetry init

It’s also possible to skip the questions by doing this:

poetry init --no-interaction

Then use regular Poetry commands to manage the dependencies.

Tagged with: Programming JavaScriptPython

Feedback and Comments

What did you think about this page? Do you have any questions, or is there anything that could be improved? You can leave a comment after clicking on an icon below.