Skip to content

Commit bfc8aa7

Browse files
docs: contributing.md (#549)
* init * skeleton and sveltekit reference * workflow and preparing * 1st draft * Update CONTRIBUTING.md Co-authored-by: Manuel <[email protected]> * docs: update based on feedback * docs: changelog added * docs: added change set directions for sv and svelte-migrate only * docs: removed cd to packages in specific tests * docs: reworded project test explanation * docs: Integration testing explanation * docs: updated headings for readability and grammar * docs: second round fixes * docs: added debug test starting point * docs: added debug test starting point - edited * docs: added running individual tests * docs: added running individual tests - edited * update: redundant example removed. Removed specified js --------- Co-authored-by: Manuel <[email protected]>
1 parent e0e8b0a commit bfc8aa7

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

CONTRIBUTING.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# SV Contributing Guide
2+
3+
## Workflow
4+
5+
We follow the standard fork-based workflow:
6+
7+
1. **Fork** this repository to your GitHub account.
8+
2. **Clone** your fork locally.
9+
3. **Create a new branch** for your change:
10+
`git checkout -b your-feature-name`
11+
4. **Commit and push** your changes to your branch.
12+
5. **Open a pull request** from your branch to the `main` branch of this repository.
13+
14+
Please keep your pull requests focused to feature or issue. Focused smaller changes are easier to review and faster to merge.
15+
16+
## Preparing
17+
This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.io/). You can [install pnpm](https://pnpm.io/installation) with:
18+
19+
```bash
20+
npm i -g pnpm
21+
```
22+
23+
For running certain packages and tests locally you will need to install [docker](https://docs.docker.com/get-started/get-docker).
24+
Linux users, you will have to ensure 'sudo' is not required. See [docker post install](https://docs.docker.com/engine/install/linux-postinstall/)
25+
26+
`pnpm` commands run in the project's root directory will run on all sub-projects. You can checkout the code and install the dependencies with:
27+
28+
```bash
29+
cd cli
30+
pnpm install
31+
```
32+
33+
## Build and run
34+
To build the project and all packages. Run the 'build' script:
35+
36+
```bash
37+
# from root of project
38+
pnpm build
39+
```
40+
This outputs into /packages/PACKAGE/dist/.
41+
42+
Run the 'cli' package:
43+
```bash
44+
pnpm sv
45+
```
46+
47+
Run build with watch mode:
48+
```bash
49+
pnpm dev
50+
```
51+
52+
## Testing
53+
54+
For each add-on we have integration tests setup. These install the deps, build the app, run the dev server and then run a few small snippets against the add-on to see if the changes introduced by the add-on are working as expected.
55+
56+
Run all tests:
57+
```bash
58+
# from root of project
59+
pnpm test
60+
```
61+
62+
Run tests with vitest ui:
63+
```bash
64+
# from root of project
65+
pnpm test:ui
66+
```
67+
68+
Run package specific tests by specifying a project flag to the package and running the test command. Eg:
69+
```bash
70+
pnpm test --project core # addons / create / migrate / etc.
71+
```
72+
73+
To run a individual test. `cd` into the package. Run the local `test` script to that package, with a path arg to the individual peice you want tested. Eg:
74+
```bash
75+
pnpm test [path-to-test]
76+
```
77+
78+
To debug a failing test. A good starting point is to `cd` into the failing tests dir. Proceed to `build` it. Then `preview` it. From here you will have increased information to help in the debug process. Eg:
79+
```bash
80+
# Each test is a standalone app
81+
cd .test-output/addons/[addon-test]/[test-id]
82+
pnpm build
83+
pnpm preview
84+
```
85+
86+
## Style Guide
87+
88+
### Coding style
89+
90+
There are a few guidelines we follow:
91+
92+
- Ensure `pnpm lint` and `pnpm check` pass. You can run `pnpm format` to format the code
93+
- linting
94+
```bash
95+
# from root of project
96+
pnpm lint
97+
```
98+
- formatting
99+
```bash
100+
# from root of project
101+
pnpm format
102+
```
103+
- type checking
104+
```bash
105+
# from root of project
106+
pnpm check
107+
```
108+
109+
## svelte-migrate
110+
To run svelte-migrate locally:
111+
```bash
112+
# from root of project
113+
node ./packages/migrate/bin.js
114+
```
115+
116+
## Generating changelogs
117+
Only publish a change set if it is in 'sv' or 'svelte-migrate' as all other packages are bundled.
118+
For changes to be reflected in package changelogs:
119+
```bash
120+
# from root of project
121+
pnpm changeset:publish
122+
```

0 commit comments

Comments
 (0)