自从我第一次在许多开源项目中看到dist/目录,通常是在GitHub上,我一直在想它是什么意思。

使用dist、vendor、lib、src和许多我们经常看到的其他文件夹名称,我有时会想我应该如何命名我自己的文件夹。

如果我说错了请指正!

src:包含源。有时只有纯源代码,有时有简化版本,这取决于项目。 vendor:包含其他依赖项,如其他开源项目。 问得好,实际上离供应商很近,根据项目的不同,我们可以看到其中一个或另一个,或者两者都有…… dist:在我看来,它包含了“生产”文件,如果我们想使用这个库,就应该使用这个文件。

为什么开源如此令人困惑?有可能把事情做得更清楚吗?至少是每种语言,因为有些语言使用特定的名称。


当前回答

其实!"dist文件夹"是你用"npm run build"或"ng build"或"ng build——prod"修改源代码用于生产后的结果。

与此同时!在获得“dist文件夹”后,根据你的项目类型,可能仍然需要做一些事情✌️

其他回答

回答你的问题:

/dist表示“可分发的”,即编译后的代码/库。

文件夹结构因构建系统和编程语言而异。以下是一些标准约定:

src/: "source" files to build and develop the project. This is where the original source files are located, before being compiled into fewer files to dist/, public/ or build/. dist/: "distribution", the compiled code/library, also named public/ or build/. The files meant for production or public use are usually located here. There may be a slight difference between these three: build/: is a compiled version of your src/ but not a production-ready. dist/: is a production-ready compiled version of your code. public/: usually used as the files runs on the browser. which it may be the server-side JS and also include some HTML and CSS. 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.

减价/文本文件:

自述文件。md:用于设置、教程和项目文档的帮助文件。也使用README.txt。 许可证。Md:任何与项目有关的权利。“LICENSE”和“LICENSE.txt”是LICENSE文件名的变体,内容相同。 做贡献。如何帮助这个项目。有时这在README中有说明。md文件。

具体的(这些可能会一直持续下去):

package.json: defines libraries and dependencies for JS packages, used by Npm. package-lock.json: specific version lock for dependencies installed from package.json, used by Npm. composer.json: defines libraries and dependencies for PHP packages, used by Composer. composer.lock: specific version lock for dependencies installed from composer.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文件夹含义的问题:

dist缩写为distributable,指的是一个目录,其中存储的文件可以被其他人直接使用,而不需要编译或缩小被重用的源代码。

示例:如果我想使用某人编写的Java库的源代码,那么您需要先编译源代码才能使用它。但是如果库作者将已经编译的版本放入存储库,那么您就可以继续。这样一个已经编译的版本被保存到dist目录中。

类似的情况也适用于JavaScript模块。通常JavaScript代码在生产中使用时会被简化和混淆。因此,如果您想要发布一个JavaScript库,建议将纯源代码(而不是缩小版)放到src(源)目录中,将缩小版和模糊版放到dist(可分发版)目录中,这样其他人就可以立即获取缩小版,而不必自己缩小。

注意:有些开发人员使用像target, build或dest (destination)这样的名称来代替dist,但这些文件夹的用途是相同的。

文件夹摘要:

本:二进制文件 贡献:对项目的贡献 医生:——见1。和2。 doc / s:文档 include: headers (C/ c++) lib:库(C/ c++) man: man/manual pages (Unix/Linux)的简写,c.f. man(1) src:来源


/dist表示“可分发的”,即编译后的代码/库。 dist的缩写形式是distributable(可分发的),指的是存储文件的目录,这些文件可以被其他人直接使用,而不需要编译或缩小被重用的源代码。

其实!"dist文件夹"是你用"npm run build"或"ng build"或"ng build——prod"修改源代码用于生产后的结果。

与此同时!在获得“dist文件夹”后,根据你的项目类型,可能仍然需要做一些事情✌️