Skip to content

Commit

Permalink
feat: add react-rsbuild-ts template (#2694)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter authored Jun 20, 2024
1 parent f8fd79f commit 82ef7e6
Show file tree
Hide file tree
Showing 15 changed files with 2,354 additions and 0 deletions.
Binary file added react-rsbuild-ts/.codesandbox/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions react-rsbuild-ts/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "pnpm install --force"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"dev": {
"name": "dev",
"command": "pnpm dev",
"runAtStart": true,
"preview": {
"port": 3000
}
},
"build": {
"name": "build",
"command": "pnpm build",
"runAtStart": false
},
"preview": {
"name": "preview",
"command": "pnpm preview",
"runAtStart": false
},
"install": {
"name": "install dependencies",
"command": "pnpm install"
}
}
}
7 changes: 7 additions & 0 deletions react-rsbuild-ts/.codesandbox/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "React (Rsbuild + TS)",
"description": "React running with Rsbuild, the Rspack-based build tool",
"iconUrl": "https://raw.githubusercontent.com/codesandbox/sandbox-templates/main/react-rsbuild-ts/.codesandbox/icon.png",
"tags": ["frontend", "react", "rsbuild", "javascript", "typescript"],
"published": true
}
4 changes: 4 additions & 0 deletions react-rsbuild-ts/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Devcontainer",
"image": "ghcr.io/codesandbox/devcontainers/typescript-node:latest"
}
13 changes: 13 additions & 0 deletions react-rsbuild-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*

# Dist
node_modules
dist/

# IDE
.vscode/*
!.vscode/extensions.json
.idea
29 changes: 29 additions & 0 deletions react-rsbuild-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rsbuild Project

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm preview
```
31 changes: 31 additions & 0 deletions react-rsbuild-ts/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import js from '@eslint/js';
import reactHooks from 'eslint-plugin-react-hooks';
import reactJsx from 'eslint-plugin-react/configs/jsx-runtime.js';
import react from 'eslint-plugin-react/configs/recommended.js';
import globals from 'globals';
import ts from 'typescript-eslint';

export default [
{ languageOptions: { globals: globals.browser } },
js.configs.recommended,
...ts.configs.recommended,
...fixupConfigRules([
{
...react,
settings: {
react: { version: 'detect' },
},
},
reactJsx,
]),
{
plugins: {
'react-hooks': fixupPluginRules(reactHooks),
},
rules: {
...reactHooks.configs.recommended.rules,
},
},
{ ignores: ['dist/'] },
];
29 changes: 29 additions & 0 deletions react-rsbuild-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "react-rsbuild-ts",
"private": true,
"version": "1.0.0",
"scripts": {
"build": "rsbuild build",
"dev": "rsbuild dev --open",
"lint": "eslint .",
"preview": "rsbuild preview"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/compat": "^1.1.0",
"@eslint/js": "^9.5.0",
"@rsbuild/core": "^0.7.9",
"@rsbuild/plugin-react": "^0.7.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "^9.5.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.4.0",
"typescript": "^5.4.2",
"typescript-eslint": "^7.12.0"
}
}
Loading

0 comments on commit 82ef7e6

Please sign in to comment.