Skip to content

Commit 4c58542

Browse files
authored
Initial commit
0 parents  commit 4c58542

File tree

18 files changed

+2062
-0
lines changed

18 files changed

+2062
-0
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on pull request events but only for the main branch
6+
pull_request:
7+
branches: [main]
8+
9+
push:
10+
branches: [main]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install Pnpm
26+
run: corepack enable
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: "pnpm"
33+
34+
- name: Install Dependencies
35+
run: pnpm install && npx playwright install
36+
37+
- name: Run Test
38+
run: pnpm run test

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Local
2+
.DS_Store
3+
*.local
4+
*.log*
5+
6+
# Dist
7+
node_modules
8+
dist/
9+
test-results
10+
11+
# IDE
12+
.vscode/*
13+
!.vscode/settings.json
14+
!.vscode/extensions.json
15+
.idea

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome"]
3+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"search.useIgnoreFiles": true,
3+
"[json]": {
4+
"editor.defaultFormatter": "biomejs.biome"
5+
},
6+
"[typescript]": {
7+
"editor.defaultFormatter": "biomejs.biome"
8+
},
9+
"[javascript]": {
10+
"editor.defaultFormatter": "biomejs.biome"
11+
},
12+
"[javascriptreact]": {
13+
"editor.defaultFormatter": "biomejs.biome"
14+
}
15+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Rspack Contrib
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# rsbuild-plugin-example
2+
3+
rsbuild-plugin-example is a Rsbuild plugin to do something.
4+
5+
<p>
6+
<a href="https://npmjs.com/package/rsbuild-plugin-example">
7+
<img src="https://img.shields.io/npm/v/rsbuild-plugin-example?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
8+
</a>
9+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
10+
</p>
11+
12+
## Usage
13+
14+
Install:
15+
16+
```bash
17+
npm add rsbuild-plugin-example -D
18+
```
19+
20+
Add plugin to your `rsbuild.config.ts`:
21+
22+
```ts
23+
// rsbuild.config.ts
24+
import { pluginExample } from "rsbuild-plugin-example";
25+
26+
export default {
27+
plugins: [pluginExample()],
28+
};
29+
```
30+
31+
## Options
32+
33+
### foo
34+
35+
Some description.
36+
37+
- Type: `string`
38+
- Default: `undefined`
39+
- Example:
40+
41+
```js
42+
pluginExample({
43+
foo: "bar",
44+
});
45+
```
46+
47+
## License
48+
49+
[MIT](./LICENSE).

biome.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"vcs": {
7+
"enabled": true,
8+
"defaultBranch": "main",
9+
"clientKind": "git",
10+
"useIgnoreFile": true
11+
},
12+
"javascript": {
13+
"formatter": {
14+
"quoteStyle": "single"
15+
}
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true
21+
}
22+
}
23+
}

package.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "rsbuild-plugin-example",
3+
"version": "0.0.0",
4+
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-template",
5+
"license": "MIT",
6+
"type": "module",
7+
"exports": {
8+
".": {
9+
"types": "./dist/index.d.ts",
10+
"import": "./dist/index.js",
11+
"require": "./dist/index.cjs"
12+
}
13+
},
14+
"main": "./dist/index.js",
15+
"module": "./dist/index.mjs",
16+
"types": "./dist/index.d.ts",
17+
"files": ["dist"],
18+
"scripts": {
19+
"build": "tsup",
20+
"dev": "tsup --watch",
21+
"lint": "biome check .",
22+
"lint:write": "biome check . --write",
23+
"prepare": "simple-git-hooks && npm run build",
24+
"prepublishOnly": "npm run build",
25+
"test": "playwright test"
26+
},
27+
"simple-git-hooks": {
28+
"pre-commit": "npx nano-staged"
29+
},
30+
"nano-staged": {
31+
"*.{js,jsx,ts,tsx,mjs,cjs}": [
32+
"biome check --write --no-errors-on-unmatched"
33+
]
34+
},
35+
"devDependencies": {
36+
"@biomejs/biome": "^1.8.3",
37+
"@playwright/test": "^1.44.1",
38+
"@rsbuild/core": "^0.7.10",
39+
"@types/node": "^20.14.1",
40+
"nano-staged": "^0.8.0",
41+
"playwright": "^1.44.1",
42+
"simple-git-hooks": "^2.11.1",
43+
"tsup": "^8.0.2",
44+
"typescript": "^5.5.2"
45+
},
46+
"peerDependencies": {
47+
"@rsbuild/core": "0.x || 1.x"
48+
},
49+
"peerDependenciesMeta": {
50+
"@rsbuild/core": {
51+
"optional": true
52+
}
53+
},
54+
"packageManager": "[email protected]",
55+
"publishConfig": {
56+
"access": "public",
57+
"registry": "https://registry.npmjs.org/"
58+
}
59+
}

playground/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "playground",
3+
"private": true,
4+
"version": "0.0.0",
5+
"scripts": {
6+
"dev": "npx rsbuild dev",
7+
"build": "npx rsbuild build"
8+
}
9+
}

playground/rsbuild.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@rsbuild/core';
2+
import { pluginExample } from '../src';
3+
4+
export default defineConfig({
5+
plugins: [pluginExample()],
6+
});

0 commit comments

Comments
 (0)