Skip to content

Commit

Permalink
Merge pull request #8 from arkedge/init-client-ui
Browse files Browse the repository at this point in the history
Initialize client-ui
  • Loading branch information
sankichi92 authored Nov 6, 2024
2 parents 86cc076 + 26cf07d commit 83c5136
Show file tree
Hide file tree
Showing 23 changed files with 8,189 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/client-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Client UI

on:
push:
branches:
- main
paths:
- client-ui/**
- .github/workflows/client-ui.yml
pull_request:
branches:
- main
paths:
- client-ui/**
- .github/workflows/client-ui.yml

defaults:
run:
working-directory: ./client-ui

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4.2.2

- uses: pnpm/action-setup@v4.0.0
with:
package_json_file: client-ui/package.json

- uses: actions/setup-node@v4.1.0
with:
cache: pnpm
cache-dependency-path: client-ui/pnpm-lock.yaml
node-version-file: client-ui/.nvmrc

- run: pnpm install

- run: pnpm run lint

typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4.2.2

- uses: pnpm/action-setup@v4.0.0
with:
package_json_file: client-ui/package.json

- uses: actions/setup-node@v4.1.0
with:
cache: pnpm
cache-dependency-path: client-ui/pnpm-lock.yaml
node-version-file: client-ui/.nvmrc

- run: pnpm install

- run: pnpm run typecheck

build:
name: build ${{ github.ref_name == 'main' && 'and push' || '' }}
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: arkedge/clover-ui

steps:
- uses: actions/checkout@v4.2.2

- uses: docker/setup-buildx-action@v3.7.1
with:
# renovate: datasource=github-releases depName=docker/buildx
version: "v0.18.0"

- uses: docker/login-action@v3.3.0
if: github.ref_name == 'main'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5.5.1
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
tags: |
type=sha,prefix=
type=raw,value=latest
- uses: docker/build-push-action@v6.9.0
id: build-push
with:
context: ./client-ui
push: ${{ github.ref_name == 'main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- uses: actions/attest-build-provenance@v1.4.4
if: github.ref_name == 'main'
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.build-push.outputs.digest }}
push-to-registry: true
12 changes: 12 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@ name: GitHub Pages
on:
push:
branches: ["main"]
paths:
- book.toml
- custom.css
- docs/**
- proto/**
- .github/workflows/pages.yml
pull_request:
branches: ["main"]
paths:
- book.toml
- custom.css
- docs/**
- proto/**
- .github/workflows/pages.yml

concurrency:
group: pages
Expand Down
84 changes: 84 additions & 0 deletions client-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},
ignorePatterns: ["!**/.server", "!**/.client"],

// Base config
extends: ["eslint:recommended", "prettier"],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
},
},
},

// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
},

// Node
{
files: [".eslintrc.cjs"],
env: {
node: true,
},
},
],
};
5 changes: 5 additions & 0 deletions client-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

/.cache
/build
.env
1 change: 1 addition & 0 deletions client-ui/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.11.0
1 change: 1 addition & 0 deletions client-ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
3 changes: 3 additions & 0 deletions client-ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-tailwindcss"]
}
33 changes: 33 additions & 0 deletions client-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:22-bullseye-slim AS base

ENV NODE_ENV=production

RUN corepack enable

# build stage

FROM base AS build

WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod=false

COPY . .
RUN pnpm run build
RUN pnpm prune --prod

# runtime stage

FROM base

WORKDIR /app

COPY package.json .
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/build/client /app/build/client
COPY --from=build /app/build/server /app/build/server

RUN corepack install

CMD ["pnpm", "start"]
40 changes: 40 additions & 0 deletions client-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Welcome to Remix!

- 📖 [Remix docs](https://remix.run/docs)

## Development

Run the dev server:

```shellscript
npm run dev
```

## Deployment

First, build your app for production:

```sh
npm run build
```

Then run the app in production mode:

```sh
npm start
```

Now you'll need to pick a host to deploy it to.

### DIY

If you're familiar with deploying Node applications, the built-in Remix app server is production-ready.

Make sure to deploy the output of `npm run build`

- `build/server`
- `build/client`

## 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 client-ui/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 { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";

startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>,
);
});
Loading

0 comments on commit 83c5136

Please sign in to comment.