2

I'm quite new to GitHub and get's quite confused by all the files and folders and files extensions I have never seen before.

Just taking a look at a repository, I see for example this:

  • [FOLDER] dist
  • [FOLDER] src
  • [FOLDER] test
  • [FILE] package.json
  • [FILE] gulpfile.js
  • [FILE] bower.json

These are just some of the files, and folders I see around. What does all of this do? Do I need to use some kind of pre-made structure if I want to distribute my own code? Everyone seem to be doing it so, what happens if I do not structure my repos like this?

Is there any convention guide / style guide that I have missed?

1 Answers1

1

Directory and file structure are different for each programming language and build system. Typically, people follow these conventions:

  • dist/: distribution, which normally contains the compiled software (contains minified code)
  • src/: source, contains the source files of the software
  • build/: contains code that is not minified and not ready to be deployed for production
  • test/: contains the test files of the repository
  • package.json: describes the package (in JavaScript/npm)
  • gulpfile.js: file that acts as a manifest to define tasks in the program
  • bower.json: used to define a Bower package so you can create your own package which contains all of the dependencies for your software

You can find more about the styling conventions here and here.

EDIT: You can look up project structure for specific languages. For example, this can be helpful for a Node.js project.

Community
  • 1
  • 1
kkmonlee
  • 379
  • 2
  • 16
  • Hello! Thanks for the answer. Is there any conventions around html, php, javascript that I could try to follow? Those are the three main languages I would do projects within. If I make a plugin for WordPress or any other CMS, should I follow a convention there as well, or it's more relaxed when its more specific repositories? My main fear is creating a repo, that other people cannot use because I did not follow some sort of convention or similar. Possible that is just a non-real fear though. Thanks. – user7396671 Jan 10 '17 at 18:28
  • You shouldn't really be that worried about people not being able to use your repository. If you really want to religiously follow a convention, you could use [Google's JavaScript style guide](https://google.github.io/styleguide/javascriptguide.xml). I would recommend looking at known JavaScript/PHP/HTML/Wordpress plugin repositories and try to mimic their project structure. – kkmonlee Jan 10 '17 at 18:37