博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vue.js 贡献指南(翻译)
阅读量:6309 次
发布时间:2019-06-22

本文共 9086 字,大约阅读时间需要 30 分钟。

Vue.js Contributing Guide(vue.js g贡献指南)

Hi! I’m really excited that you are interested in contributing to Vue.js. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.

嗨! 我很高兴你有兴趣为Vue.js做贡献。 在提交您的贡献之前,请务必花点时间阅读以下指南。

Code of Conduct  行为守则

Issue Reporting Guidelines  问题报告指南

Pull Request Guidelines  PR指南

Development Setup  开发设置

Project Structure  项目结构

Issue Reporting Guidelines

Always use https://new-issue.vuejs.org/ to create new issues.

总是使用 https://new-issue.vuejs.org/ 来创建新的问题

Pull Request Guidelines

The master branch is basically just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against the master branch.

master分支基本上只是最新稳定版本的快照。 所有开发都应该在专门的分支中完成。不要向主分支提交PR。

Checkout a topic branch from the relevant branch, e.g. dev, and merge back against that branch.

从相关分支中签出主题分支,例如 dev,并合并回该分支。

Work in the src folder and DO NOT checkin dist in the commits.

在SRC文件夹中工作,不要在提交中签入DIST。

It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.

当处理PR时,可以进行多次小型提交 - 我们将让GitHub在合并之前自动压缩它。

Make sure npm test passes. (see development setup)  确保 npm test 通过。

If adding new feature: 如果添加新功能:

  Add accompanying test case.  添加随同的测试用例。

  Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.

提供令人信服的理由来添加此功能。 理想情况下,您应首先打开一个建议问题,并在处理之前将其置于绿灯。

If fixing a bug: 如果修复一个bug:

If you are resolving a special issue, add (fix #xxxx[,#xxx]) (#xxxx is the issue id) in your PR title for a better release log, e.g. update entities encoding/decoding (fix #3899).

如果要解决一个特定的 issue,请在PR标题中添加(fix#xxx[,#xxx])(#xxxx是问题id)以便获得更好的发布日志,例如 update entities encoding/decoding (fix #3899)。

    Provide detailed description of the bug in the PR. Live demo preferred.

在PR中提供bug的详细说明。 最好有demo。

    Add appropriate test coverage if applicable.

如果适用,添加适当的测试范围

Development Setup

You will need Node.js version 6+ and Java Runtime Environment (needed for running Selenium server during e2e tests).

你需要 node.js 6 以上版本,和Java运行时环境(在E2E测试期间运行 Selenium server 所需的环境)。

After cloning the repo, run:  克隆后运行:

$ npm install # or yarn install

Committing Changes  提交更改

Commit messages should follow the commit message convention so that changelogs can be automatically generated. Commit messages will be automatically validated upon commit. If you are not familiar with the commit message convention, you can use npm run commit instead of git commit, which provides an interactive CLI for generating proper commit messages.

提交消息应该遵循提交消息约定,以便能够自动生成更改日志。提交消息将在提交时自动验证。如果您不熟悉提交消息约定,可以使用 npm run commit 代替 git commit,该命令提供了一个交互式CLI,用于生成适当的提交消息。

Commonly used NPM scripts  常用的NPM脚本

# watch and auto re-build dist/vue.js$ npm run dev# watch and auto re-run unit tests in Chrome$ npm run dev:test# build all dist files, including npm packages $ npm run build # run the full test suite, include linting / type checking $ npm test

There are some other scripts available in the scripts section of the package.json file.

package.json文件的 scripts 选项中提供了一些其他的可选脚本。

The default test script will do the following: lint with ESLint -> type check with Flow -> unit tests with coverage -> e2e tests. Please make sure to have this pass successfully before submitting a PR. Although the same tests will be run against your PR on the CI server, it is better to have it working locally beforehand.

默认测试脚本将执行以下操作:lint with ESLint  - > type check with Flow  - > unit tests with coverage  - > e2e tests。 在提交PR之前,请确保成功通过此通行证。 虽然将在CI服务器上针对您的PR运行相同的测试,但最好让它事先在本地工作。

Project Structure

scripts: contains build-related scripts and configuration files. In most cases you don't need to touch them. However, it would be helpful to familiarize yourself with the following files:

包含与构建相关的脚本和配置文件。在大多数情况下,你不需要接触它们。但是,熟悉下列文件会有帮助:

scripts/alias.js: module import aliases used across all source code and tests.

在所有源代码和测试中使用的模块导入别名。

scripts/config.js: contains the build configurations for all files found in dist/. Check this file if you want to find out the entry source file for a dist file.

包含在 dist 文件夹中所有文件的构建配置。 如果想要找出一个dist文件的的入口源文件,请从这个文件查找。

dist: contains built files for distribution. Note this directory is only updated when a release happens; they do not reflect the latest changes in development branches.

See dist/README.md for more details on dist files.

包含用于分发的构建文件。 请注意,此目录仅在发布时更新; 它们没有反映开发分支的最新变化。

有关dist文件的更多详细信息,请参阅dist / README.md。

flow: contains type declarations for Flow. These declarations are loaded globally and you will see them used in type annotations in normal source code.

包含Flow的类型声明。这些声明是全局加载的,您将看到它们在普通源代码中的类型注释中使用。

packages: contains vue-server-renderer and vue-template-compiler, which are distributed as separate NPM packages. They are automatically generated from the source code and always have the same version with the main vue package.

包含vue-server-renderer和vue-template-compiler,它们作为单独的NPM包分发。 它们是从源代码自动生成的,并且始终与主vue包具有相同的版本。

test: contains all tests. The unit tests are written with Jasmine and run with Karma. The e2e tests are written for and run with Nightwatch.js.

包含所有测试。 单元测试用Jasmine编写并与Karma一起运行。 e2e测试是为Nightwatch.js编写并运行的。

src: contains the source code, obviously. The codebase is written in ES2015 with Flow type annotations.

显然包含源代码。 代码库是使用ES2015编写并用Flow类型注释的。

compiler: contains code for the template-to-render-function compiler.

包含 template-to-render-function 编译器的代码。

The compiler consists of a parser (converts template strings to element ASTs), an optimizer (detects static trees for vdom render optimization), and a code generator (generate render function code from element ASTs). Note the codegen directly generates code strings from the element AST - it's done this way for smaller code size because the compiler is shipped to the browser in the standalone build.

编译器包括一个解析器(将模板字符串转换为元素AST),一个优化器(检测用于vdom渲染优化的静态树)和一个代码生成器(从元素AST生成渲染函数代码)。 请注意,codegen直接从元素AST生成代码字符串 - 它以较小的代码大小完成,因为在独立构建中,编译器被传送给浏览器。

core: contains universal, platform-agnostic runtime code.

包含通用的,与平台无关的运行时代码。

The Vue 2.0 core is platform-agnostic - which means code inside core should be able to run in any JavaScript environment, be it the browser, Node.js, or an embedded JavaScript runtime in native applications.

Vue 2.0核心代码与平台无关 - 这意味着内核中的代码应该能够在任何JavaScript环境中运行,无论是浏览器,Node.js还是本机应用程序中的嵌入式JavaScript运行时。

observer: contains code related to the reactivity system.

包含与响应性系统相关的代码。

vdom: contains code related to vdom element creation and patching.

包含与vdom元素创建和修补相关的代码。

instance: contains Vue instance constructor and prototype methods.

包含Vue实例构造函数和原型方法。

global-api: as the name suggests.  顾名思义。

components: universal abstract components. Currently keep-alive is the only one.

通用抽象组件。 目前只有keep-alive。

server: contains code related to server-side rendering.

包含服务器端渲染的相关代码。

platforms: contains platform-specific code.

包含特定平台的代码。

Entry files for dist builds are located in their respective platform directory.

dist构建的入口文件位于各自的平台目录中。

Each platform module contains three parts: compilerruntime and server, corresponding to the three directories above. Each part contains platform-specific modules/utilities which are then imported and injected to the core counterparts in platform-specific entry files. For example, the code implementing the logic behind v-bind:class is in platforms/web/runtime/modules/class.js - which is imported in entries/web-runtime.jsand used to create the browser-specific vdom patching function.

每个平台模块包含三个部分:编译器,运行时和服务端,对应于上面的三个目录。 每个部分都包含特定于平台的模块/实用程序,然后将其导入并注入特定于平台的核心对应部分的入口文件中。 例如,实现v-bind:class背后的逻辑的代码位于platforms / web / runtime / modules / class.js中 - 它在entries / web-runtime.js中导入,用于创建针对浏览器的vdom修补函数。

sfc: contains single-file component (*.vue files) parsing logic. This is used in the vue-template-compilerpackage.

包含单文件组件(*.vue文件)解析逻辑。这在 vue-template-compiler 包中使用。

shared: contains utilities shared across the entire codebase.

包含在整个代码库中共享的实用程序。

types: contains TypeScript type definitions

包含TypeScript类型定义

test: type definitions tests

类型定义测试

Financial Contribution 财务贡献

As a pure community-driven project without major corporate backing, we also welcome financial contributions via Patreon or OpenCollective.

作为一个纯粹的社区驱动项目,没有大的企业支持,我们也欢迎通过 Patreon 或 OpenCollective 进行财务贡献。

Become a backer or sponsor on Patreon  在 Patreon 成为支持者或赞助者

Become a backer or sponsor on OpenCollective  在 OpenCollective 成为支持者或赞助者

What's the difference between Patreon and OpenCollective?  

Patreon 和 OpenCollective 之间有什么不同?

Funds donated via Patreon go directly to support Evan You's full-time work on Vue.js. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform.

通过Patreon捐赠的资金直接用于支持 Evan You 在Vue.js的全职工作。 通过 OpenCollective 捐赠的资金以透明的费用进行管理,将用于补偿核心团队成员的工作和费用或赞助社区活动。 您的姓名/徽标将通过在任一平台上捐赠获得适当的认可和曝光。

转载于:https://www.cnblogs.com/nightstarsky/p/10098514.html

你可能感兴趣的文章
configure: error: in `/root/httpd-2.2.11/srclib/apr': c
查看>>
CentOS7搭建Kubernetes-dashboard管理服务
查看>>
buildroot下查找外部编译器通过ext-toolchain-wrapper调用的参数
查看>>
MySQL Replication 主主配置详细说明
查看>>
Linux的任务调度
查看>>
在Android studio中添加jar包方法如下
查看>>
iframe 在ie下面总是弹出新窗口解决方法
查看>>
分享10款漂亮实用的CSS3按钮
查看>>
安装nginx 常见错误及 解决方法
查看>>
Gorun8电子商城
查看>>
在之前链表的基础上改良的链表
查看>>
android编译系统makefile(Android.mk)写法
查看>>
MD5源代码C++
查看>>
Eclipse 添加 Ibator
查看>>
Linux中变量$#,$@,$0,$1,$2,$*,$$,$?的含义
查看>>
Python编程语言
查看>>
十四、转到 linux
查看>>
Got error 241 'Invalid schema
查看>>
ReferenceError: event is not defined
查看>>
男人要内在美,更要外在美
查看>>