diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml new file mode 100644 index 0000000..055a0a1 --- /dev/null +++ b/.github/actions/setup-deps/action.yml @@ -0,0 +1,17 @@ +name: Setup dependencies + +on: + workflow_call + +runs: + using: 'composite' + steps: + - uses: pnpm/action-setup@v4 + with: + package_json_file: './package.json' + - uses: actions/setup-node@v4 + with: + node-version-file: '.node-version' + cache: 'pnpm' + - run: pnpm install + shell: bash diff --git a/.github/workflows/common-ci.yml b/.github/workflows/common-ci.yml new file mode 100644 index 0000000..77a9f38 --- /dev/null +++ b/.github/workflows/common-ci.yml @@ -0,0 +1,33 @@ +name: common + +on: + pull_request: + paths: + - 'modules/common/**' + - '.github/workflows/common-ci.yml' + +defaults: + run: + working-directory: modules/common + +jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: './.github/actions/setup-deps' + - run: pnpm run typecheck + + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: './.github/actions/setup-deps' + - run: pnpm run test:unit + + db-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: './.github/actions/setup-deps' + - run: pnpm run test:db diff --git a/.github/workflows/mobile-ci.yml b/.github/workflows/mobile-ci.yml new file mode 100644 index 0000000..25dca6c --- /dev/null +++ b/.github/workflows/mobile-ci.yml @@ -0,0 +1,20 @@ +name: mobile + +on: + pull_request: + paths: + - 'services/mobile/**' + - 'modules/common/**' + - '.github/workflows/mobile-ci.yml' + +defaults: + run: + working-directory: services/mobile + +jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: './.github/actions/setup-deps' + - run: pnpm run typecheck diff --git a/.github/workflows/pos-ci.yml b/.github/workflows/pos-ci.yml new file mode 100644 index 0000000..9dc03eb --- /dev/null +++ b/.github/workflows/pos-ci.yml @@ -0,0 +1,20 @@ +name: pos + +on: + pull_request: + paths: + - 'services/pos/**' + - 'modules/common/**' + - '.github/workflows/common-ci.yml' + +defaults: + run: + working-directory: services/pos + +jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: './.github/actions/setup-deps' + - run: pnpm run typecheck diff --git a/.husky/pre-commit b/.husky/pre-commit index deb6975..a135630 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,3 +2,9 @@ . "$(dirname -- "$0")/_/husky.sh" pnpm fmt +retval=$? + +if [ $retval -ne 0 ] +then + exit 1 +fi diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9249e49..41d17ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,6 +57,9 @@ importers: services/mobile: dependencies: + '@cafeore/common': + specifier: workspace:* + version: link:../../modules/common '@remix-run/cloudflare': specifier: ^2.13.1 version: 2.15.3(@cloudflare/workers-types@4.20250129.0)(typescript@5.7.3) @@ -66,6 +69,9 @@ importers: '@remix-run/react': specifier: ^2.13.1 version: 2.15.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.7.3) + clsx: + specifier: ^2.1.1 + version: 2.1.1 isbot: specifier: ^5.1.17 version: 5.1.22 @@ -81,6 +87,9 @@ importers: swr: specifier: ^2.2.5 version: 2.3.0(react@18.3.1) + tailwind-merge: + specifier: ^2.5.4 + version: 2.6.0 devDependencies: '@cloudflare/workers-types': specifier: ^4.20241022.0 diff --git a/services/mobile/app/routes/welcome._index.tsx b/services/mobile/app/routes/welcome._index.tsx index 869db55..536e5c5 100644 --- a/services/mobile/app/routes/welcome._index.tsx +++ b/services/mobile/app/routes/welcome._index.tsx @@ -1,10 +1,9 @@ +import { documentSub, orderConverter } from "@cafeore/common"; import { isRouteErrorResponse, useRouteError, useSearchParams, } from "@remix-run/react"; -import { orderConverter } from "common/firebase-utils/converter"; -import { documentSub } from "common/firebase-utils/subscription"; import { useEffect, useRef, useState } from "react"; import useSWRSubscription from "swr/subscription"; import bellSound from "~/assets/bell.mp3"; diff --git a/services/mobile/package.json b/services/mobile/package.json index 58918bd..1f0119f 100644 --- a/services/mobile/package.json +++ b/services/mobile/package.json @@ -12,14 +12,17 @@ "typegen": "wrangler types" }, "dependencies": { + "@cafeore/common": "workspace:*", "@remix-run/cloudflare": "^2.13.1", "@remix-run/cloudflare-pages": "^2.13.1", "@remix-run/react": "^2.13.1", + "clsx": "^2.1.1", "isbot": "^5.1.17", "react": "^18.3.1", "react-dom": "^18.3.1", "react-icons": "^5.3.0", - "swr": "^2.2.5" + "swr": "^2.2.5", + "tailwind-merge": "^2.5.4" }, "devDependencies": { "@cloudflare/workers-types": "^4.20241022.0",