Setup whole new project using a Single Command (Bin Scripts)

Ashish Shakya
2 min readJun 8, 2021

So every time a new developer joins the team, you often get to hear, “Hey myan the project is not running. Did I miss something?”

This thing is pretty normal because sometimes we tend to miss part of the installation process and then the project does not boot up properly.

This is where the bin scripts come in handy.

So what I simply do is, I just create a directory named bin in the root directory. It then includes all the scripts depending on the actions. Such as ./bin/init.sh , ./bin/update.sh , ./bin/deploy.sh etc. These scripts file contains various codebase for common tasks in the project.

Let's see some of the examples.

init.sh

The above init.shscript file contains a codebase that we execute every single time we clone the Laravel repository. So whenever a new developer joins the team, they simply need to clone the repo and execute ./bin.init.sh command from the project’s root directory. It then run all the necessary command to boot up the application.

update.sh

Similarly, the aboveupdate.sh script contains the codebase which is required during updates in the application. So whenever there is the installation of new packages, or there are any new migrations, other team members can simply execute ./bin/update.sh command from the project’s root directory to get updates.

Last but not the least, all you need to do is to make this script files executable by running chmod +x <filename.sh> command.

Advantages:

  • Easier onboarding when entering a new codebase
  • Fewer chances of missing setups.
  • Junior developers will discover the steps for onboarding.

Reference:

https://youtu.be/enTb2E4vEos?t=805

--

--