Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Oct 7, 2024
1 parent d7b8369 commit 8d07dd4
Show file tree
Hide file tree
Showing 26 changed files with 557 additions and 5 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/mobile-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: mobile / check

on:
push:
paths:
- "mobile/**"
- ".github/workflows/mobile-check.yml"

defaults:
run:
working-directory: ./mobile

jobs:
biome:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: "1.9.2"
- name: Run Biome
run: biome ci .

tsc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('./bun.lockb') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run typecheck

unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('./bun.lockb') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run test:unit

db-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('./bun.lockb') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run test:db
2 changes: 1 addition & 1 deletion .github/workflows/pos-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
paths:
- "pos/**"
- ".github/workflows/check.yml"
- ".github/workflows/pos-check.yml"

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pos-firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main
paths:
- "pos/**"
- ".github/workflows/firebase-hosting-merge.yml"
- ".github/workflows/pos-firebase-hosting-merge.yml"

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pos-firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- "pos/**"
- ".github/workflows/firebase-hosting-pull-request.yml"
- ".github/workflows/pos-firebase-hosting-pull-request.yml"

defaults:
run:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 8 additions & 0 deletions mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules

/.cache
/build
.env
.dev.vars

.wrangler
47 changes: 47 additions & 0 deletions mobile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Welcome to Remix + Cloudflare!

- 📖 [Remix docs](https://remix.run/docs)
- 📖 [Remix Cloudflare docs](https://remix.run/guides/vite#cloudflare)

## Development

Run the dev server:

```sh
npm run dev
```

To run Wrangler:

```sh
npm run build
npm run start
```

## Typegen

Generate types for your Cloudflare bindings in `wrangler.toml`:

```sh
npm run typegen
```

You will need to rerun typegen whenever you make changes to `wrangler.toml`.

## Deployment

First, build your app for production:

```sh
npm run build
```

Then, deploy your app to Cloudflare Pages:

```sh
npm run deploy
```

## Styling

This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever css framework you prefer. See the [Vite docs on css](https://vitejs.dev/guide/features.html#css) for more information.
18 changes: 18 additions & 0 deletions mobile/app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* By default, Remix will handle hydrating your app on the client for you.
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
* For more information, see https://remix.run/file-conventions/entry.client
*/

import { RemixBrowser } from "@remix-run/react";
import { StrictMode, startTransition } from "react";
import { hydrateRoot } from "react-dom/client";

startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>,
);
});
43 changes: 43 additions & 0 deletions mobile/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* By default, Remix will handle generating the HTTP Response for you.
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
* For more information, see https://remix.run/file-conventions/entry.server
*/

import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare";
import { RemixServer } from "@remix-run/react";
import { isbot } from "isbot";
import { renderToReadableStream } from "react-dom/server";

export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext,
// This is ignored so we can keep it in the template for visibility. Feel
// free to delete this parameter in your app if you're not using it!
// eslint-disable-next-line @typescript-eslint/no-unused-vars
loadContext: AppLoadContext,
) {
const body = await renderToReadableStream(
<RemixServer context={remixContext} url={request.url} />,
{
signal: request.signal,
onError(error: unknown) {
// Log streaming rendering errors from inside the shell
console.error(error);
responseStatusCode = 500;
},
},
);

if (isbot(request.headers.get("user-agent") || "")) {
await body.allReady;
}

responseHeaders.set("Content-Type", "text/html");
return new Response(body, {
headers: responseHeaders,
status: responseStatusCode,
});
}
45 changes: 45 additions & 0 deletions mobile/app/root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type { LinksFunction } from "@remix-run/cloudflare";
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";

import "./tailwind.css";

export const links: LinksFunction = () => [
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{
rel: "preconnect",
href: "https://fonts.gstatic.com",
crossOrigin: "anonymous",
},
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",
},
];

export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}

export default function App() {
return <Outlet />;
}
Loading

0 comments on commit 8d07dd4

Please sign in to comment.