Skip to content

Commit d26739b

Browse files
committed
chore: merge origin main
2 parents 670aab2 + a1878ba commit d26739b

File tree

673 files changed

+17335
-17883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

673 files changed

+17335
-17883
lines changed

.github/renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>rstackjs/renovate"],
4+
"ignoreDeps": ["@nestjs/common", "@nestjs/core", "@nestjs/platform-express"]
5+
}

.github/renovate.json5

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v5
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2121

2222
- name: Install pnpm
23-
uses: pnpm/action-setup@v4
23+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
2424
id: pnpm-install
2525

2626
- name: Set up Node.js
27-
uses: actions/setup-node@v6
27+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
2828
with:
2929
node-version-file: ".nvmrc"
3030

3131
- name: Install dependencies
3232
run: pnpm install
3333

34+
- name: Install Playwright browsers
35+
run: pnpm --filter @rstest-example/browser-locator exec playwright install --with-deps chromium
36+
3437
- name: Build Rspack
3538
run: |
3639
pnpm build:rspack
@@ -50,3 +53,6 @@ jobs:
5053
- name: Build Rsdoctor
5154
run: |
5255
pnpm build:rsdoctor
56+
57+
- name: Test Rstest
58+
run: pnpm test:rstest

.gitignore

Lines changed: 5 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,21 @@
11
# Logs
22
logs
33
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
94

105
.DS_Store
116

12-
# Diagnostic reports (https://nodejs.org/api/report.html)
13-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14-
15-
# Runtime data
16-
pids
17-
*.pid
18-
*.seed
19-
*.pid.lock
20-
21-
# Directory for instrumented libs generated by jscoverage/JSCover
22-
lib-cov
7+
# dist files
8+
dist
9+
doc_build
10+
.swc
2311

2412
# Coverage directory used by tools like istanbul
2513
coverage
14+
!rstest/coverage/
2615
*.lcov
2716

28-
# nyc test coverage
29-
.nyc_output
30-
31-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32-
.grunt
33-
34-
# Bower dependency directory (https://bower.io/)
35-
bower_components
36-
37-
# node-waf configuration
38-
.lock-wscript
39-
40-
# Compiled binary addons (https://nodejs.org/api/addons.html)
41-
build/Release
42-
4317
# Dependency directories
4418
node_modules/
45-
jspm_packages/
46-
47-
# Snowpack dependency directory (https://snowpack.dev/)
48-
web_modules/
4919

5020
# TypeScript cache
5121
*.tsbuildinfo
@@ -59,81 +29,9 @@ web_modules/
5929
# Optional stylelint cache
6030
.stylelintcache
6131

62-
# Microbundle cache
63-
.rpt2_cache/
64-
.rts2_cache_cjs/
65-
.rts2_cache_es/
66-
.rts2_cache_umd/
67-
68-
# Optional REPL history
69-
.node_repl_history
70-
71-
# Output of 'npm pack'
72-
*.tgz
73-
74-
# Yarn Integrity file
75-
.yarn-integrity
76-
7732
# dotenv environment variable files
7833
.env
7934
.env.development.local
8035
.env.test.local
8136
.env.production.local
8237
.env.local
83-
84-
# parcel-bundler cache (https://parceljs.org/)
85-
.cache
86-
.parcel-cache
87-
88-
# Next.js build output
89-
.next
90-
out
91-
.swc
92-
93-
# Nuxt.js build / generate output
94-
.nuxt
95-
dist
96-
97-
# Gatsby files
98-
.cache/
99-
# Comment in the public line in if your project uses Gatsby and not Next.js
100-
# https://nextjs.org/blog/next-9-1#public-directory-support
101-
# public
102-
103-
# vuepress build output
104-
.vuepress/dist
105-
106-
# vuepress v2.x temp and cache directory
107-
.temp
108-
.cache
109-
110-
# Docusaurus cache and generated files
111-
.docusaurus
112-
113-
# Serverless directories
114-
.serverless/
115-
116-
# FuseBox cache
117-
.fusebox/
118-
119-
# DynamoDB Local files
120-
.dynamodb/
121-
122-
# TernJS port file
123-
.tern-port
124-
125-
# Stores VSCode versions used for testing VSCode extensions
126-
.vscode-test
127-
128-
# yarn v2
129-
.yarn/cache
130-
.yarn/unplugged
131-
.yarn/build-state.yml
132-
.yarn/install-state.gz
133-
.pnp.*
134-
135-
# ignore lock to test more
136-
yarn.lock
137-
package-lock.json
138-
139-
.idea/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.21.1
1+
24.15.0

AGENTS.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# AGENTS.md
2+
3+
This file provides guidance for AI coding agents working in this repository.
4+
5+
## Repository Overview
6+
7+
- This is a monorepo of example projects for the Rstack ecosystem: Rspack, Rsbuild, Rspress, Rsdoctor, Rslib, and Rstest.
8+
- Package manager: `pnpm` (see `package.json#packageManager`).
9+
- Workspace layout: `pnpm-workspace.yaml` includes `rspack/**`, `rsbuild/**`, `rslib/**`, `rspress/**`, `rsdoctor/**`, `rstest/**`.
10+
11+
## Core Purpose of Examples
12+
13+
**The primary goal of each example is to demonstrate "how a specific API achieves a specific effect through specific configuration".**
14+
15+
When creating or modifying examples:
16+
- **Keep it minimal**: Only include code necessary to demonstrate the target feature/API
17+
- **Avoid over-engineering**: Don't add complex business logic that distracts from the core demonstration
18+
- **Focus on the tool, not the ecosystem**: For example, in a test runner example, focus on the test runner's APIs (mocking, assertions, configuration), not on complex DOM manipulation or third-party library integrations
19+
- **One concept per example**: Each example should ideally demonstrate one main feature or configuration pattern
20+
- **Clarity over completeness**: A simple, clear example is better than a comprehensive but confusing one
21+
22+
Example of good vs bad:
23+
```
24+
# Good: Demonstrates rstest's mocking API
25+
- Simple mock function usage
26+
- Clear before/after assertions
27+
- Minimal setup code
28+
29+
# Bad: Demonstrates rstest's mocking API
30+
- Complex React component with many interactions
31+
- Detailed DOM testing with @testing-library
32+
- Business logic mixed with test assertions
33+
```
34+
35+
## Quick Start (Local)
36+
37+
Prerequisites:
38+
- Node.js per `.nvmrc`
39+
- `corepack` enabled
40+
41+
Common commands:
42+
- Install deps: `corepack enable && pnpm i`
43+
- Build everything: `pnpm run build`
44+
- Build a group:
45+
- Rspack examples: `pnpm run build:rspack`
46+
- Rsbuild examples: `pnpm run build:rsbuild`
47+
- Rspress examples: `pnpm run build:rspress`
48+
- Rsdoctor examples: `pnpm run build:rsdoctor`
49+
- Rslib examples: `pnpm run build:rslib`
50+
- Test Rspack examples: `pnpm run test:rspack`
51+
52+
Working in a single example:
53+
- `cd rspack/basic` (or any other example dir)
54+
- `pnpm i` (workspace install is preferred at repo root)
55+
- `pnpm run dev` / `pnpm run build` / `pnpm run test` (depends on the example)
56+
57+
## Where Things Live
58+
59+
Top-level directories:
60+
- `rspack/`: Rspack examples (often package name prefix `example-*`).
61+
- `rsbuild/`: Rsbuild examples (often package name prefix `rsbuild-*`).
62+
- `rspress/`: Rspress examples (often package name prefix `rspress-*`).
63+
- `rsdoctor/`: Rsdoctor examples (often package name prefix `rsdoctor-*`).
64+
- `rslib/`: Rslib examples (often package name prefix `rslib-*`).
65+
66+
## Coding Conventions
67+
68+
- Formatting and linting: `Biome` is used (see `biome.json`).
69+
- Default JS/TS quote style is single quotes.
70+
- Line width is 100.
71+
- Prefer minimal, example-focused changes. This repo is a collection of runnable examples; avoid refactors that reduce clarity.
72+
- Keep UI strings and code comments in English unless the surrounding file is already predominantly another language.
73+
74+
## Running/Changing Examples
75+
76+
- Examples are expected to be runnable independently.
77+
- When changing build tooling or config:
78+
- Ensure the example still runs via its `dev` script (if present).
79+
- Ensure `build` works at least for the changed example.
80+
81+
## Dependencies & Workspace Notes
82+
83+
- Prefer adding dependencies at the example package level, not in the repo root, unless the dependency is shared.
84+
- Use `pnpm --filter` to scope commands to a single package or group.
85+
- Example: `pnpm --filter "example-basic" dev`
86+
87+
## Agent Workflow Expectations
88+
89+
When making changes:
90+
- Identify the single example/package impacted.
91+
- Keep changes scoped to that example unless explicitly requested.
92+
- Update configuration consistently with the conventions in that subtree.
93+
- Run the narrowest possible validation command (e.g. `pnpm --filter <pkg> build`) before running broad builds.
94+
95+
## Common Pitfalls
96+
97+
- Avoid editing generated output directories: `dist`, `dist-*`, `doc_build`.
98+
- Many examples are similar but not identical; do not assume scripts/config match across directories.
99+
- Some examples may pin specific versions or require particular Node constraints; check the example `package.json`.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
This repository contains comprehensive examples that demonstrate the Rstack ecosystem tools, including Rspack, Rsbuild, Rspress, and Rsdoctor. These examples showcase common implementation patterns and best practices to help developers leverage the full potential of the Rstack toolchain.
44

5+
> The `main` branch contains examples for Rspack/Rsbuild v2. For Rspack/Rsbuild 1.x examples, please check the [v1.x](https://github.com/rstackjs/rstack-examples/tree/v1.x) branch.
6+
57
## List of Examples
68

7-
| [Rspack](https://github.com/web-infra-dev/rspack) | <a href="https://github.com/web-infra-dev/rspack" target="blank"><img src="https://assets.rspack.dev/rspack/rspack-banner.png" width="400" /></a> | [Examples](./rspack) | [Document](https://rspack.dev/) |
9+
| [Rspack](https://github.com/web-infra-dev/rspack) | <a href="https://github.com/web-infra-dev/rspack" target="blank"><img src="https://assets.rspack.rs/rspack/rspack-banner.png" width="400" /></a> | [Examples](./rspack) | [Document](https://rspack.rs/) |
810
| :---------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------: | :----------------------------------: |
9-
| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | <a href="https://github.com/web-infra-dev/rsbuild" target="blank"><img src="https://assets.rspack.dev/rsbuild/rsbuild-banner.png" width="400" /></a> | [Examples](./rsbuild) | [Document](https://rsbuild.dev/) |
10-
| [Rspress](https://github.com/web-infra-dev/rspress) | <a href="https://github.com/web-infra-dev/rspress" target="blank"><img src="https://assets.rspack.dev/rspress/rspress-banner.png" width="400" /></a> | [Examples](./rspress/) | [Document](https://rspress.dev/) |
11-
| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | <a href="https://github.com/web-infra-dev/rsdoctor" target="blank"><img src="https://assets.rspack.dev/rsdoctor/rsdoctor-banner.png" width="400" /></a> | [Examples](./rsdoctor/) | [Document](https://rsdoctor.dev/) |
12-
| [Rslib](https://github.com/web-infra-dev/rslib) | <a href="https://github.com/web-infra-dev/rslib" target="blank"><img src="https://assets.rspack.dev/rslib/rslib-banner.png" width="400" /></a> | [Examples](./rslib) | [Document](https://lib.rsbuild.dev/) |
11+
| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | <a href="https://github.com/web-infra-dev/rsbuild" target="blank"><img src="https://assets.rspack.rs/rsbuild/rsbuild-banner.png" width="400" /></a> | [Examples](./rsbuild) | [Document](https://rsbuild.rs/) |
12+
| [Rspress](https://github.com/web-infra-dev/rspress) | <a href="https://github.com/web-infra-dev/rspress" target="blank"><img src="https://assets.rspack.rs/rspress/rspress-banner.png" width="400" /></a> | [Examples](./rspress/) | [Document](https://rspress.rs/) |
13+
| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | <a href="https://github.com/web-infra-dev/rsdoctor" target="blank"><img src="https://assets.rspack.rs/rsdoctor/rsdoctor-banner.png" width="400" /></a> | [Examples](./rsdoctor/) | [Document](https://rsdoctor.rs/) |
14+
| [Rslib](https://github.com/web-infra-dev/rslib) | <a href="https://github.com/web-infra-dev/rslib" target="blank"><img src="https://assets.rspack.rs/rslib/rslib-banner.png" width="400" /></a> | [Examples](./rslib) | [Document](https://rslib.rs/) |
1315

1416
## How to Use
1517

@@ -21,7 +23,7 @@ For example, to clone the `/rspack/basic` example, run the following command:
2123

2224
```bash
2325
# Clone the basic example
24-
npx gitpick https://github.com/rspack-contrib/rstack-examples/tree/main/rspack/basic
26+
npx gitpick https://github.com/rstackjs/rstack-examples/tree/main/rspack/basic
2527

2628
# Enter the basic example directory
2729
cd basic
@@ -37,7 +39,7 @@ To try all examples, you can clone the current repository to your local.
3739
1. First, clone the current repository to your local:
3840

3941
```bash
40-
git clone git@github.com:rspack-contrib/rstack-examples.git
42+
git clone git@github.com:rstackjs/rstack-examples.git
4143
```
4244

4345
2. Then, choose the example you need, such as the Rsbuild react example:

0 commit comments

Comments
 (0)