Folder structure varies by build system and programming language. Here are some standard conventions:
src/
: “source” files to build and develop the project. This is where the original source files are located, before being compiled into fewer files todist/
,public/
orbuild/
.dist/
: “distribution”, the compiled code/library, also namedpublic/
orbuild/
. The files meant for production or public use are usually located here.assets/
: static content like images, video, audio, fonts etc.lib/
: external dependencies (when included directly).test/
: the project’s tests scripts, mocks, etc.node_modules/
: includes libraries and dependencies for JS packages, used by Npm.vendor/
: includes libraries and dependencies for PHP packages, used by Composer.bin/
: files that get added to your PATH when installed.
Markdown/Text Files:
README.md
: A help file which addresses setup, tutorials, and documents the project.README.txt
is also used.LICENSE.md
: any rights given to you regarding the project.LICENSE
orLICENSE.txt
are variations of the license file name, having the same contents.CONTRIBUTING.md
: how to help out with the project. Sometimes this is addressed in theREADME.md
file.
Specific (these could go on forever):
package.json
: defines libraries and dependencies for JS packages, used by Npm.package-lock.json
: specific version lock for dependencies installed frompackage.json
, used by Npm.composer.json
: defines libraries and dependencies for PHP packages, used by Composer.composer.lock
: specific version lock for dependencies installed fromcomposer.json
, used by Composer.gulpfile.js
: used to define functions and tasks to be run with Gulp..travis.yml
: config file for the Travis CI environment..gitignore
: Specification of the files meant to be ignored by Git.
/dist
是指 “可分发的”,即编译后的代码/库。
文件夹结构因构建系统和编程语言而异。下面是一些标准的约定。
- src/: 用于构建和开发项目的 “源 “文件。这是原始源文件的位置,然后才被编译成较少的文件到 dist/, public/ 或 build/。
- dist/: “发行”,编译后的代码/库,也被命名为 public/ 或 build/。用于生产或公共使用的文件通常位于这里。
- assets/: 静态内容,如图片、视频、音频、字体等。
- lib/: 外部依赖(当直接包含时)。
- test/: 项目的测试脚本、模拟等。
- node_modules/: 包括 JS 包的库和依赖项,由 Npm 使用。
- vendor/: 包括 PHP 包的库和依赖项,由 Composer 使用。
- bin/: 安装时被添加到 PATH 中的文件。
Markdown 之类的文本文件:
- README.md: 一个帮助文件,涉及设置、教程和项目的文件。README.txt 也被使用。
- LICENSE.md: 给你的关于项目的任何权利。LICENSE 或 LICENSE.txt 是许可证文件名称的变化,具有相同的内容。
- CONTRIBUTING.md: 如何帮助该项目。有时,这在 README.md 文件中也有涉及。
具体内容(这些内容可能会一直持续下去):
- package.json: 定义 JS 包的库和依赖,由 Npm 使用。
- package-lock.json: 对从 package.json 中安装的依赖项进行特定的版本锁定,由 Npm 使用。
- composer.json: 定义了 PHP 包的库和依赖关系,被 Composer 使用。
- composer.lock: 从 composer.json 中安装的依赖关系的特定版本锁,由 Composer 使用。
- gulpfile.js: 用来定义 Gulp 运行的函数和任务。
- .travis.yml: Travis CI 环境的配置文件。
- .gitignore: 指明要被 Git 忽略的文件。