Yifan Ai
Yifan Ai

Reputation: 126

What name should an entry shell script (that starts frontend and backend) have?

I would like to know if there is any convention on the name of an entry shell script. With this I mean a shell script that should be run to start the program (frontend and backend). Is there some name equivalent to README.md that most developers know? Thank you in advance!

Upvotes: 2

Views: 789

Answers (2)

Maxim Mazurok
Maxim Mazurok

Reputation: 4138

I'd call it start.sh if this is my pet project.

But for enterprise projects, there's usually some CI mechanism that starts the project.

For example, if you're using Docker - your script will live in the Dockerfile, and CI will just know that it should use Dockerfile, or you'll have to instruct it using some config.

On Heroku, for example, there's a Procfile that specifies the commands that are executed by the app on startup.

Every CI is different, so one shouldn't rely only on CI scripts and expect other devs to know them. So, if I'm working on a NodeJS-based project, I will put my startup command in package.json's scripts section and name it start. Because this is a well-known convention in NodeJS world, to run npm start.

For example, I may put my full command in package.json

{
  "scripts": {
    "start": "./node_modules/vader-sentiment-cpython/install_vader.sh && ts-node api.ts"
  }
}

And then in my Heroku Procfile, I will only reference npm start, like this:

web: npm start

An added benefit is that because npm start is a convention, Heroku will try to use it by default, if I don't add Procfile at all.

Upvotes: 2

August Karlstrom
August Karlstrom

Reputation: 11377

I'm not aware of any widespread convention. Maybe main is used in some contexts but that doesn't say much about what the script does. My own convention, however, is to let entry point source code files have lower-case names while non-entry-point source files are written in PascalCase. Also for a program foo which consists of several files, my convention is to create a directory named foo and create an entry point file in this directory which is also named foo.

Upvotes: 1

Related Questions