Skip to content

Commit 32fe22e

Browse files
authored
Revise contributing guidelines for SolidStart
1 parent 21faeb2 commit 32fe22e

1 file changed

Lines changed: 107 additions & 67 deletions

File tree

CONTRIBUTING.md

Lines changed: 107 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,144 @@
11
# Contributing
22

3-
- **Node.js**: Version 22 or higher
4-
- Use a Node.js version manager compatible with `.node-version` ([asdf-vm](https://asdf-vm.com) is a great option for macOS/Linux users)
5-
- Use pnpm package manager
3+
Thank you for your interest in contributing to **SolidStart**! We welcome contributions including bug fixes, feature enhancements, documentation improvements, and more.
4+
5+
## Prerequisites
6+
7+
- **Node.js**: Use the version specified in `.nvmrc`, install [nvm](https://github.com/nvm-sh/nvm) to manage Node versions easily
8+
- **Pnpm**: Install globally via `npm install -g pnpm`
9+
- **Git**: Ensure Git is installed for cloning and managing the repository
610

711
## Setup
812

9-
```bash
10-
# Clone the SolidStart repository
11-
git clone https://github.com/solidjs/solid-start.git
12-
```
13+
1. Clone the repository
1314

14-
```bash
15-
# Install pnpm as the package manager
16-
npm install -g pnpm
17-
```
15+
```bash
16+
git clone https://github.com/solidjs/solid-start.git
17+
cd solid-start
18+
```
1819

19-
```bash
20-
# Install all monorepo dependencies
21-
pnpm install
22-
```
20+
2. Enable the correct pnpm version specified in package.json
2321

24-
```bash
25-
# Build dependencies
26-
pnpm run build:all
27-
```
22+
```bash
23+
corepack enable
24+
```
2825

29-
## Testing Changes
26+
3. Install dependencies
3027

31-
1. Modify the codebase as needed.
32-
2. Run an example project to verify your changes work as expected:
28+
```bash
29+
pnpm install
30+
```
3331

34-
```bash
35-
# Run an example (e.g. hackernews)
36-
pnpm --filter example-hackernews run dev
37-
```
32+
4. Build all packages and the landing page
33+
```bash
34+
pnpm run build:all
35+
```
3836

39-
3. Run tests
37+
If you encounter issues (e.g. missing `node_modules`), clean the workspace
4038

4139
```bash
42-
# Setup Playwright
43-
pnpm run install:playwright
40+
pnpm run clean:all
4441
```
4542

46-
```bash
47-
# Run all tests
48-
pnpm run test:all
49-
```
43+
Then reinstall dependencies and rebuild.
5044

51-
```bash
52-
# Show test report
53-
pnpm run show:test-report
54-
```
45+
## Monorepo Structure
5546

56-
## Monorepo Configuration
47+
SolidStart is a pnpm-based monorepo with nested workspaces. Key directories include
5748

58-
If you are using SolidStart within a monorepo that takes advantage of the `package.json` `"workspaces"` property (e.g. [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces)) with hoisted dependencies (the default for Yarn), you must include `@solidjs/start` within the optional `"nohoist"` (for Yarn v1) or configure hoisting limits (for Yarn v2 or higher) to ensure dependencies are correctly placed.
49+
- **`packages/start`**: The core `@solidjs/start` package.
50+
- **`packages/landing-page`**: The official landing page.
51+
- **`examples/`**: Example projects for testing (a nested workspace; see details below).
52+
- **`packages/tests`**: Unit and end-to-end (E2E) tests using Vitest and Cypress.
5953

60-
- _In the following, "workspace root" refers to the root of your repository, while "project root" refers to the root of a child package within your repository._
54+
Use pnpm filters (e.g. `pnpm --filter @solidjs/start ...`) to target specific packages.
55+
The `examples/` directory is a separate workspace with its own `pnpm-workspace.yaml` and `pnpm-lock.yaml`.
6156

62-
### Yarn v1 (nohoist)
57+
## Developing and Testing Changes
6358

64-
For example, if specifying `"nohoist"` options from the workspace root (i.e., for all packages):
59+
1. Make your changes in the relevant package (e.g. `packages/start`)
6560

66-
```jsonc
67-
// in workspace root
68-
{
69-
"workspaces": {
70-
"packages": [
71-
/* ... */
72-
],
73-
"nohoist": ["**/@solidjs/start"]
74-
}
75-
}
76-
```
61+
2. Rebuild affected packages
7762

78-
If specifying `"nohoist"` options for a specific package using `@solidjs/start`:
63+
```bash
64+
pnpm run packages:build
65+
```
7966

80-
```jsonc
81-
// in project root of a workspace child
82-
{
83-
"workspaces": {
84-
"nohoist": ["@solidjs/start"]
85-
}
86-
}
87-
```
67+
For a full rebuild: `pnpm run build:all`
68+
69+
3. Test your changes
70+
71+
- For examples
72+
```bash
73+
cd examples
74+
pnpm install
75+
pnpm --filter example-hackernews run dev # Runs the HackerNews example
76+
```
77+
- For the landing page (from the root directory)
78+
```bash
79+
pnpm run lp:dev
80+
```
81+
82+
4. Clean builds if needed
83+
```bash
84+
pnpm run packages:clean # Cleans packages' node_modules and dist folders
85+
pnpm run lp:clean # Cleans the landing page
86+
pnpm run clean:root # Cleans root-level caches
87+
```
88+
89+
## Running Tests
90+
91+
Tests are located in `packages/tests`, using Vitest for unit tests and Cypress for E2E tests.
92+
93+
1. Install the Cypress binary (required only once)
94+
95+
```bash
96+
pnpm --filter tests exec cypress install
97+
```
8898

89-
Regardless of where you specify the `nohoist` option, you also need to include `@solidjs/start` as a `devDependency` in the child `package.json`.
99+
2. For unit tests that check build artifacts, build the test app first
90100

91-
The reason why this is necessary is because `@solidjs/start` creates an `index.html` file within your project which expects to load a script located in `/node_modules/@solidjs/start/runtime/entry.jsx` (where `/` is the path of your project root). By default, if you hoist the `@solidjs/start` dependency into the workspace root, then that script will not be available within the package's `node_modules` folder.
101+
```bash
102+
pnpm --filter tests run build
103+
```
92104

93-
### Yarn v2 or Higher
105+
3. Run unit tests
94106

95-
The `nohoist` option is no longer available in Yarn v2+. In this case, we can use the `installConfig` property in the `package.json` (either workspace package or a specific project package) to make sure our dependencies are not hoisted:
107+
```bash
108+
pnpm --filter tests run unit
109+
```
110+
111+
- CI mode (run once): `pnpm --filter tests run unit:ci`
112+
- UI mode: `pnpm --filter tests run unit:ui`
113+
114+
4. Run E2E tests
115+
116+
```bash
117+
pnpm --filter tests run e2e:run
118+
```
119+
120+
- Interactive mode: `pnpm --filter tests run e2e:open`
121+
- With dev server: `pnpm --filter tests run e2e`
122+
123+
5. Clean test artifacts
124+
```bash
125+
pnpm run clean:test
126+
```
127+
128+
## Using SolidStart in Your Own Monorepo
129+
130+
When integrating `@solidjs/start` into your own monorepo (e.g. using Yarn workspaces), configure dependency hoisting to ensure proper resolution. This helps runtime components (e.g. `client/index.tsx`) resolve correctly in generated files like `index.html`.
131+
132+
### Yarn v2+
133+
134+
In the project root's `package.json`
96135
97136
```jsonc
98-
// in project root of a workspace child
99137
{
100138
"installConfig": {
101139
"hoistingLimits": "dependencies"
102140
}
103141
}
104142
```
143+
144+
For pnpm monorepos, define workspaces in `pnpm-workspace.yaml`. If you encounter resolution issues (e.g. missing modules like `h3` from Vinxi), add `shamefully-hoist=true` to your `.npmrc` file. Test for duplicates and adjust configurations as necessary.

0 commit comments

Comments
 (0)