You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/contributing.md
+37-29Lines changed: 37 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Hi! I'm really excited that you are interested in contributing to Vue.js. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
4
4
5
-
-[Code of Conduct](https://github.com/vuejs/vue/blob/dev/.github/CODE_OF_CONDUCT.md)
5
+
-[Code of Conduct](https://vuejs.org/about/coc.html)
@@ -28,7 +28,7 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
28
28
29
29
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
30
30
- Provide a detailed description of the bug in the PR. Live demo preferred.
31
-
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `yarn test --coverage`.
31
+
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `npm test -- --coverage`.
32
32
33
33
- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.
34
34
@@ -40,12 +40,14 @@ Hi! I'm really excited that you are interested in contributing to Vue.js. Before
40
40
41
41
## Development Setup
42
42
43
-
You will need [Node.js](http://nodejs.org)**version 10+**, and [Yarn 1.x](https://yarnpkg.com/en/docs/install).
43
+
You will need [Node.js](https://nodejs.org)**version 16+**, and [PNPM](https://pnpm.io).
44
+
45
+
We also recommend installing [ni](https://github.com/antfu/ni) to help switching between repos using different package managers. `ni` also provides the handy `nr` command which running npm scripts easier.
44
46
45
47
After cloning the repo, run:
46
48
47
49
```bash
48
-
$ yarn# install the dependencies of the project
50
+
$ pnpm i# install the dependencies of the project
49
51
```
50
52
51
53
A high level overview of tools used:
@@ -57,18 +59,20 @@ A high level overview of tools used:
57
59
58
60
## Scripts
59
61
60
-
### `yarn build`
62
+
**The examples below will be using the `nr` command from the [ni](https://github.com/antfu/ni) package.** You can also use plain `npm run`, but you will need to pass all additional arguments after the command after an extra `--`. For example, `nr build runtime --all` is equivalent to `npm run build -- runtime --all`.
63
+
64
+
### `nr build`
61
65
62
66
The `build` script builds all public packages (packages without `private: true` in their `package.json`).
63
67
64
68
Packages to build can be specified with fuzzy matching:
65
69
66
70
```bash
67
71
# build runtime-core only
68
-
yarn build runtime-core
72
+
nr build runtime-core
69
73
70
74
# build all packages matching "runtime"
71
-
yarn build runtime --all
75
+
nr build runtime --all
72
76
```
73
77
74
78
#### Build Formats
@@ -86,18 +90,18 @@ Additional formats that only apply to the main `vue` package:
86
90
-**`esm-bundler-runtime`**
87
91
-**`esm-browser-runtime`**
88
92
89
-
More details about each of these formats can be found in the [`vue` package README](https://github.com/vuejs/vue-next/blob/master/packages/vue/README.md#which-dist-file-to-use) and the [Rollup config file](https://github.com/vuejs/vue-next/blob/master/rollup.config.js).
93
+
More details about each of these formats can be found in the [`vue` package README](https://github.com/vuejs/core/blob/main/packages/vue/README.md#which-dist-file-to-use) and the [Rollup config file](https://github.com/vuejs/core/blob/main/rollup.config.js).
90
94
91
95
For example, to build `runtime-core` with the global build only:
92
96
93
97
```bash
94
-
yarn build runtime-core -f global
98
+
nr build runtime-core -f global
95
99
```
96
100
97
101
Multiple formats can be specified as a comma-separated list:
98
102
99
103
```bash
100
-
yarn build runtime-core -f esm-browser,cjs
104
+
nr build runtime-core -f esm-browser,cjs
101
105
```
102
106
103
107
#### Build with Source Maps
@@ -112,48 +116,50 @@ The `--types` or `-t` flag will generate type declarations during the build and
112
116
- Generate an API report in `<projectRoot>/temp/<packageName>.api.md`. This report contains potential warnings emitted by [api-extractor](https://api-extractor.com/).
113
117
- Generate an API model json in `<projectRoot>/temp/<packageName>.api.json`. This file can be used to generate a Markdown version of the exported APIs.
114
118
115
-
### `yarn dev`
119
+
### `nr dev`
116
120
117
121
The `dev` script bundles a target package (default: `vue`) in a specified format (default: `global`) in dev mode and watches for changes. This is useful when you want to load up a build in an HTML page for quick debugging:
- The `dev` script also supports fuzzy match for the target package, but will only match the first package matched.
129
+
-**Important:** output of the `dev` script is for development and debugging only. While it has the same runtime behavior, the generated code should never be published to npm.
130
+
131
+
- The `dev` script does not support fuzzy match - you must specify the full package name, e.g. `nr dev runtime-core`.
127
132
128
133
- The `dev` script supports specifying build format via the `-f` flag just like the `build` script.
129
134
130
135
- The `dev` script also supports the `-s` flag for generating source maps, but it will make rebuilds slower.
131
136
132
-
### `yarn dev-compiler`
137
+
- The `dev` script supports the `-i` flag for inlining all deps. This is useful when debugging `esm-bundler` builds which externalizes deps by default.
138
+
139
+
### `nr dev-compiler`
133
140
134
-
The `dev-compiler` script builds, watches and serves the [Template Explorer](https://github.com/vuejs/vue-next/tree/master/packages/template-explorer) at `http://localhost:5000`. This is extremely useful when working on the compiler.
141
+
The `dev-compiler` script builds, watches and serves the [Template Explorer](https://github.com/vuejs/core/tree/main/packages/template-explorer) at `http://localhost:5000`. This is extremely useful when working on the compiler.
135
142
136
-
### `yarn test`
143
+
### `nr test`
137
144
138
145
The `test` script simply calls the `jest` binary, so all [Jest CLI Options](https://jestjs.io/docs/en/cli) can be used. Some examples:
139
146
140
147
```bash
141
148
# run all tests
142
-
$ yarn test
143
-
144
-
# run tests in watch mode
145
-
$ yarn test --watch
149
+
$ nr test
146
150
147
151
# run all tests under the runtime-core package
148
-
$ yarntest runtime-core
152
+
$ nrtest runtime-core
149
153
150
154
# run tests in a specific file
151
-
$ yarntest fileName
155
+
$ nrtest fileName
152
156
153
157
# run a specific test in a specific file
154
-
$ yarntest fileName -t 'test name'
158
+
$ nrtest fileName -t 'test name'
155
159
```
156
160
161
+
The default `test` script includes the `--runInBand` jest flag to improve test stability, especially for the CSS transition related tests. When you are testing specific test specs, you can also run `npx jest` with flags directly to speed up tests (jest runs them in parallel by default).
162
+
157
163
## Project Structure
158
164
159
165
This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) setup which hosts a number of associated packages under the `packages` directory:
@@ -172,9 +178,11 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set
172
178
173
179
-`compiler-dom`: Compiler with additional plugins specifically targeting the browser.
174
180
181
+
-`compiler-sfc`: Lower level utilities for compiling Vue Single File Components.
182
+
175
183
-`compiler-ssr`: Compiler that produces render functions optimized for server-side rendering.
176
184
177
-
-`template-explorer`: A development tool for debugging compiler output. You can run `yarn dev template-explorer` and open its `index.html` to get a repl of template compilation based on current source code.
185
+
-`template-explorer`: A development tool for debugging compiler output. You can run `nr dev template-explorer` and open its `index.html` to get a repl of template compilation based on current source code.
178
186
179
187
A [live version](https://vue-next-template-explorer.netlify.com) of the template explorer is also available, which can be used for providing reproductions for compiler bugs. You can also pick the deployment for a specific commit from the [deploy logs](https://app.netlify.com/sites/vue-next-template-explorer/deploys).
180
188
@@ -192,9 +200,9 @@ import { h } from '@vue/runtime-core'
192
200
193
201
This is made possible via several configurations:
194
202
195
-
- For TypeScript, `compilerOptions.path` in `tsconfig.json`
203
+
- For TypeScript, `compilerOptions.paths` in `tsconfig.json`
196
204
- For Jest, `moduleNameMapper` in `jest.config.js`
197
-
- For plain Node.js, they are linked using [Yarn Workspaces](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).
205
+
- For plain Node.js, they are linked using [PNPM Workspaces](https://pnpm.io/workspaces).
198
206
199
207
### Package Dependencies
200
208
@@ -245,7 +253,7 @@ Test coverage is continuously deployed at https://vue-next-coverage.netlify.app/
245
253
246
254
This project uses [tsd](https://github.com/SamVerschueren/tsd) to test the built definition files (`*.d.ts`).
247
255
248
-
Type tests are located in the `test-dts` directory. To run the dts tests, run `yarn test-dts`. Note that the type test requires all relevant `*.d.ts` files to be built first (and the script does it for you). Once the `d.ts` files are built and up-to-date, the tests can be re-run by simply running `yarn test-dts`.
256
+
Type tests are located in the `test-dts` directory. To run the dts tests, run `nr test-dts`. Note that the type test requires all relevant `*.d.ts` files to be built first (and the script does it for you). Once the `d.ts` files are built and up-to-date, the tests can be re-run by simply running `nr test-dts`.
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of the awesome sponsors and backers listed in this file. If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
0 commit comments