Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,37 @@ jobs:
- name: Build package
run: yarn prepare

build-web:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/web
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Cache turborepo for Web
uses: actions/cache@v4
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-web-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-web-

- name: Check turborepo cache for Web
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:web --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:web').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Build example for Web
run: |
yarn turbo run build:web --cache-dir="${{ env.TURBO_CACHE_DIR }}"

build-android:
runs-on: ubuntu-latest
env:
Expand Down
60 changes: 60 additions & 0 deletions apps/example-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# React Native Enriched Web Example

This is a [**Vite**](https://vite.dev) + [**React**](https://react.dev) web example for the React Native Enriched text input component, bootstrapped with Vite's React template.

# Getting Started

## Step 1: Install dependencies

From the root of the monorepo, install all workspace dependencies:

```sh
yarn install
```

## Step 2: Start the development server

Run the following command from the root of the monorepo or from the `apps/example-web` directory:

```sh
# From root - using Turbo
yarn example-web dev

# OR directly in this workspace
yarn dev
```

The app should now be running at `http://localhost:5173`.

## Step 3: Modify your app

Now that you have the development server running, let's make changes!

Open `src/App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes.

## Build for production

To create an optimized production build:

```sh
yarn build:web
```

The built files will be in the `dist/` directory.

## Preview the production build

To preview the production build locally:

```sh
yarn preview
```

# Learn More

To learn more about the tools and technologies used:

- [Vite Documentation](https://vite.dev) - Learn more about Vite
- [React Documentation](https://react.dev) - Learn more about React
- [TypeScript Documentation](https://www.typescriptlang.org) - Learn more about TypeScript
- [Turbo Documentation](https://turbo.build) - Learn more about Turbo monorepo management
32 changes: 32 additions & 0 deletions apps/example-web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import reactX from 'eslint-plugin-react-x';
import reactDom from 'eslint-plugin-react-dom';
import tseslint from 'typescript-eslint';
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
reactX.configs['recommended-typescript'],
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
ecmaVersion: 2020,
globals: globals.browser,
},
},
]);
15 changes: 15 additions & 0 deletions apps/example-web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Native Enriched Web Example</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
35 changes: 35 additions & 0 deletions apps/example-web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "react-native-enriched-web-example",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build:web": "tsc -b && vite build",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx"
},
"dependencies": {
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@types/node": "^24.10.1",
"@types/react": "^19.1.0",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.22.0",
"eslint-plugin-react-dom": "^2.3.13",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"eslint-plugin-react-x": "^2.3.13",
"globals": "^16.5.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.4"
},
"engines": {
"node": ">=20"
}
}
5 changes: 5 additions & 0 deletions apps/example-web/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
12 changes: 12 additions & 0 deletions apps/example-web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import './App.css';

function App() {
return (
<div className="container">
<div>Text input</div>
<input type="text" placeholder="Type something..." />
</div>
);
}

export default App;
11 changes: 11 additions & 0 deletions apps/example-web/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:root {
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
}
13 changes: 13 additions & 0 deletions apps/example-web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App';

const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Root element "#root" not found');

createRoot(rootElement).render(
<StrictMode>
<App />
</StrictMode>
);
8 changes: 8 additions & 0 deletions apps/example-web/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"types": ["vite/client"],
},
"include": ["src"]
}
7 changes: 7 additions & 0 deletions apps/example-web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
9 changes: 9 additions & 0 deletions apps/example-web/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"lib": ["ES2023"],
"types": ["node"],
},
"include": ["vite.config.ts"]
}
7 changes: 7 additions & 0 deletions apps/example-web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
});
5 changes: 1 addition & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ export default defineConfig([
},
},
{
ignores: [
'node_modules/',
'lib/'
],
ignores: ['node_modules/', 'lib/', 'apps/example-web/dist/'],
},
]);
Loading