preface

The motive of writing this blog is very simple, that is, I am idle on the weekend, I climbed the name of all files in the js project of the top 1000 stars on Github, to see what big guys like to name files and directories, I follow to learn two tricks to appear I am more professional.

Attention is JS project ah, if you engage in Java to engage in PHP, also follow the learning or bad will be taken to heaven.

The statistical results

Excluding. Babelrc, package.json,.github and the like, we get 93,117 filenames.

I then count filenames only once for names that appear multiple times in the same project. In other words, the most frequent names are no more than 1,000 out of 1,000 items.

I can’t write it down here, so you can click here and see all of the results, and I’ve drawn a picture of it so you can feel it

Somewhat surprisingly, test was the most common with 565, followed by SRC with 556

SRC is the source code, test is the test, and js, CSS, and img are all pretty straightforward.

But there are also a number of less intuitive names that proliferate in these projects, like Legacy, benchmarks, fixtures, and more.

Commonly used name

Here is a list of common names, not in order of frequency, but in very common forms

  • SRC, source code, mostly SRC

  • The test, __tests__ test file, is also often used with __test__, which is the default test file directory for Facebook’s jest framework

  • Docs document

  • Lib library file, short for library

  • Dist is used to put packaged and compiled files. It should be short for Distribution

  • Build, scripts Build scripts

  • Utils, Tools, helpers code

  • Controllers, views, Middlewares, Models MVC corresponds to Models, views, controllers, and middlewares

  • The router routing

  • Server is used to hold server-side code

  • Adapters adapters are a common design pattern: github.com/hubotio/hub…

  • Legacy is generally used to put code that is compatible with historical versions or older browsers: github.com/julianshapi…

  • Config Configuration file

  • A benchmarks test, also called a benchmark or performance test. Used to test performance changes in the version

  • Unit, spec Unit tests, usually in the test directory

  • E2e Peer tests are performed in the test directory

  • Assets, vendor resources, are usually used to store images or CSS files

  • Static Static resources

  • Examples, examples, demo

  • Component components

  • The plugins plugin

  • Bin command script, often used by command line tools: github.com/vuejs/vue-c…

  • Common file

  • NPM packages Many projects use NPM packages to reduce the size of the NPM. NPM packages are usually used to store different packages: github.com/babel/babel…

  • Misc, MISCELLANEOUS abbreviation chestnut: github.com/babel/babel…

  • Core core files: github.com/mrdoob/thre…

There are a lot of them, more than 500 in all, and I won’t explain them one by one, but if you are interested, you can click on the statistical results

The latter

In fact, most file names can be seen from the name of the meaning, but some are conventional abbreviations. More interesting is the analysis of variable and function names, which I will do next time by crawling down the contents of all js files for these projects.

The blog will be first published on Github, looking forward to the subsequent students to click a star oh

My blog github.com/hujiulong/b…