1

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!

2 Answers 2

1

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.

1
  • 1
    Thank you Maxim for your detailed answer!
    – Yifan Ai
    May 30, 2021 at 13:03
1

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.

1
  • 1
    Thank you August for your detailed answer!
    – Yifan Ai
    Dec 15, 2020 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.