Skip to content

Commit b96d7aa

Browse files
authored
chore: fix some broken links after repo move (#40)
1 parent 03b4821 commit b96d7aa

File tree

9 files changed

+147
-11
lines changed

9 files changed

+147
-11
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ body:
7373
label: Validations
7474
description: Before submitting the issue, please make sure you do the following
7575
options:
76-
- label: Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
76+
- label: Follow our [Code of Conduct](https://github.com/vitejs/vite-plugin-react/blob/main/CODE_OF_CONDUCT.md)
7777
required: true
78-
- label: Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
78+
- label: Read the [Contributing Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md).
7979
required: true
8080
- label: Read the [docs](https://vitejs.dev/guide).
8181
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ contact_links:
44
url: https://chat.vitejs.dev
55
about: Ask questions and discuss with other Vite users in real time.
66
- name: Questions & Discussions
7-
url: https://github.com/vitejs/vite/discussions
7+
url: https://github.com/vitejs/vite-plugin-react/discussions
88
about: Use GitHub discussions for message-board style questions and discussions.

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ body:
3737
label: Validations
3838
description: Before submitting the issue, please make sure you do the following
3939
options:
40-
- label: Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
40+
- label: Follow our [Code of Conduct](https://github.com/vitejs/vite-plugin-react/blob/main/CODE_OF_CONDUCT.md)
4141
required: true
42-
- label: Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
42+
- label: Read the [Contributing Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md).
4343
required: true
4444
- label: Read the [docs](https://vitejs.dev/guide).
4545
required: true

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
### Before submitting the PR, please make sure you do the following
2121

22-
- [ ] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
23-
- [ ] Read the [Pull Request Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md#pull-request-guidelines) and follow the [Commit Convention](https://github.com/vitejs/vite/blob/main/.github/commit-convention.md).
22+
- [ ] Read the [Contributing Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md).
23+
- [ ] Read the [Pull Request Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md#pull-request-guidelines) and follow the [Commit Convention](https://github.com/vitejs/vite/blob/main/.github/commit-convention.md).
2424
- [ ] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
2525
- [ ] Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`).
2626
- [ ] Ideally, include relevant tests that fail without this PR but pass with it.

.github/workflows/lock-closed-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
#issue-comment: |
2020
# This issue has been locked since it has been closed for more than 14 days.
2121
#
22-
# If you have found a concrete bug or regression related to it, please open a new [bug report](https://github.com/vitejs/vite/issues/new/choose) with a reproduction against the latest Vite version. If you have any other comments you should join the chat at [Vite Land](https://chat.vitejs.dev) or create a new [discussion](https://github.com/vitejs/vite/discussions).
22+
# If you have found a concrete bug or regression related to it, please open a new [bug report](https://github.com/vitejs/vite-plugin-react/issues/new/choose) with a reproduction against the latest Vite version. If you have any other comments you should join the chat at [Vite Land](https://chat.vitejs.dev) or create a new [discussion](https://github.com/vitejs/vite/discussions).
2323
issue-lock-reason: ""
2424
process-only: "issues"

.github/workflows/release-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
with:
3737
tag_name: ${{ github.ref }}
3838
body: |
39-
Please refer to [CHANGELOG.md](https://github.com/vitejs/vite/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details.
39+
Please refer to [CHANGELOG.md](https://github.com/vitejs/vite-plugin-react/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details.

CONTRIBUTING.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Contributing Guide
2+
3+
Hi! We're really excited that you're interested in contributing to Vite! Before submitting your contribution, please read through the following guide.
4+
5+
## Repo Setup
6+
7+
This repo is a monorepo using pnpm workspaces. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/).
8+
9+
> Vite uses pnpm v7. If you are working on multiple projects with different versions of pnpm, it's recommended to enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`.
10+
11+
## Pull Request Guidelines
12+
13+
- Checkout a topic branch from a base branch (e.g. `main`), and merge back against that branch.
14+
15+
- If adding a new feature:
16+
17+
- Add accompanying test case.
18+
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first, and have it approved before working on it.
19+
20+
- If fixing a bug:
21+
22+
- 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. `fix: update entities encoding/decoding (fix #3899)`).
23+
- Provide a detailed description of the bug in the PR. Live demo preferred.
24+
- Add appropriate test coverage if applicable.
25+
26+
- It's OK to have multiple small commits as you work on the PR. GitHub can automatically squash them before merging.
27+
28+
- Make sure tests pass!
29+
30+
- Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).
31+
32+
- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).
33+
34+
## Running Tests
35+
36+
### Integration Tests
37+
38+
Each package under `playground/` contains a `__tests__` directory. The tests are run using [Vitest](https://vitest.dev/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `vitest.config.e2e.ts` and `playground/vitest*` files.
39+
40+
Before running the tests, make sure that you built the plugin. On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to resolve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also, you may want to [set git `core.symlinks` to `true` to resolve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242).
41+
42+
Each integration test can be run under either dev server mode or build mode.
43+
44+
- `pnpm test` by default runs every integration test in both serve and build mode.
45+
46+
- `pnpm run test-serve` runs tests only under serve mode.
47+
48+
- `pnpm run test-build` runs tests only under build mode.
49+
50+
- `pnpm run test-serve [match]` or `pnpm run test-build [match]` runs tests in specific packages that match the given filter.
51+
52+
Note package matching is not available for the `pnpm test` script, which always runs all tests.
53+
54+
### Test Env and Helpers
55+
56+
Inside playground tests, you can import the `page` object from `~utils`, which is a Playwright [`Page`](https://playwright.dev/docs/api/class-page) instance that has already navigated to the served page of the current playground. So, writing a test is as simple as:
57+
58+
```js
59+
import { page } from '~utils'
60+
61+
test('should work', async () => {
62+
expect(await page.textContent('.foo')).toMatch('foo')
63+
})
64+
```
65+
66+
Some common test helpers (e.g. `testDir`, `isBuild`, or `editFile`) are also available in the utils. Source code is located at `playground/test-utils.ts`.
67+
68+
Note: The test build environment uses a [different default set of Vite config](https://github.com/vitejs/vite-plugin-react/blob/main/playground/vitestSetup.ts#L102-L122) to skip transpilation during tests to make it faster. This may produce a different result compared to the default production build.
69+
70+
### Extending the Test Suite
71+
72+
To add new tests, you should find a related playground to the fix or feature (or create a new one). As an example, static assets loading is tested in the [assets playground](https://github.com/vitejs/vite/tree/main/playground/assets). In this Vite app, there is a test for `?raw` imports with [a section defined in the `index.html` for it](https://github.com/vitejs/vite/blob/main/playground/assets/index.html#L121):
73+
74+
```html
75+
<h2>?raw import</h2>
76+
<code class="raw"></code>
77+
```
78+
79+
This will be modified [with the result of a file import](https://github.com/vitejs/vite/blob/main/playground/assets/index.html#L151):
80+
81+
```js
82+
import rawSvg from './nested/fragment.svg?raw'
83+
text('.raw', rawSvg)
84+
```
85+
86+
...where the `text` util is defined as:
87+
88+
```js
89+
function text(el, text) {
90+
document.querySelector(el).textContent = text
91+
}
92+
```
93+
94+
In the [spec tests](https://github.com/vitejs/vite/blob/main/playground/assets/__tests__/assets.spec.ts#L180), the modifications to the DOM listed above are used to test this feature:
95+
96+
```js
97+
test('?raw import', async () => {
98+
expect(await page.textContent('.raw')).toMatch('SVG')
99+
})
100+
```
101+
102+
## Debugging
103+
104+
To use breakpoints and explore code execution, you can use the ["Run and Debug"](https://code.visualstudio.com/docs/editor/debugging) feature from VS Code.
105+
106+
1. Add a `debugger` statement where you want to stop the code execution.
107+
108+
2. Click the "Run and Debug" icon in the activity bar of the editor, which opens the [_Run and Debug view_](https://code.visualstudio.com/docs/editor/debugging#_run-and-debug-view).
109+
110+
3. Click the "JavaScript Debug Terminal" button in the _Run and Debug view_, which opens a terminal in VS Code.
111+
112+
4. From that terminal, go to `playground/xxx`, and run `pnpm run dev`.
113+
114+
5. The execution will stop at the `debugger` statement, and you can use the [Debug toolbar](https://code.visualstudio.com/docs/editor/debugging#_debug-actions) to continue, step over, and restart the process...
115+
116+
### Debugging Errors in Vitest Tests Using Playwright (Chromium)
117+
118+
Some errors are masked and hidden away because of the layers of abstraction and sandboxed nature added by Vitest, Playwright, and Chromium. In order to see what's actually going wrong and the contents of the devtools console in those instances, follow this setup:
119+
120+
1. Add a `debugger` statement to the `playground/vitestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits.
121+
122+
2. Run the tests with the `debug-serve` script command, which will enable remote debugging: `pnpm run debug-serve react-sourcemap`.
123+
124+
3. Wait for inspector devtools to open in your browser and the debugger to attach.
125+
126+
4. In the sources panel in the right column, click the play button to resume execution, and allow the tests to run, which will open a Chromium instance.
127+
128+
5. Focusing the Chromium instance, you can open the browser devtools and inspect the console there to find the underlying problems.
129+
130+
6. To close everything, just stop the test process back in your terminal.
131+
132+
## Note on Test Dependencies
133+
134+
In many test cases, we need to mock dependencies using `link:` and `file:` protocols. `pnpm` treats `link:` as symlinks and `file:` as hardlinks. To test dependencies as if they were copied into `node_modules`, use the `file:` protocol. Otherwise, use the `link:` protocol.
135+
136+
For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package name. This will avoid possible issues like false-positive alerts.

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@vitejs/vite-playground",
2+
"name": "@vitejs/vite-plugin-react-playground",
33
"private": true,
44
"version": "1.0.0",
55
"devDependencies": {

scripts/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async function main(): Promise<void> {
114114
} else {
115115
console.log(
116116
colors.green(
117-
'\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite/actions/workflows/publish.yml',
117+
'\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite-plugin-react/actions/workflows/publish.yml',
118118
),
119119
)
120120
}

0 commit comments

Comments
 (0)