Skip to content

Commit

Permalink
Merge pull request #55 from PhilDL/feature/example-split-client-server
Browse files Browse the repository at this point in the history
Split client / server via exports Example
  • Loading branch information
PhilDL committed Jul 20, 2023
2 parents 1810377 + 2dd814a commit 07b6bf6
Show file tree
Hide file tree
Showing 17 changed files with 1,098 additions and 767 deletions.
8 changes: 4 additions & 4 deletions apps/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"lint": "next lint"
},
"dependencies": {
"next": "^13.4.7",
"next": "^13.4.10",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-gospel-stack/database": "workspace:*",
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-gospel-stack/tsconfig": "workspace:*",
"@types/node": "^20.3.3",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/node": "^20.4.2",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.6"
}
}
50 changes: 11 additions & 39 deletions apps/remix-app/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import {
useRouteError,
} from "@remix-run/react";

import {
lookUpSalesPersonForZipcode,
type SalesPersonDirectory,
} from "@remix-gospel-stack/internal-nobuild";
import { lookUpSalesPersonForZipcode } from "@remix-gospel-stack/internal-nobuild/client";
import { getSalesPersonDirectory } from "@remix-gospel-stack/internal-nobuild/queries.server";
import { Button } from "@remix-gospel-stack/ui/button";
import {
Card,
Expand All @@ -18,49 +16,23 @@ import {
CardHeader,
CardTitle,
} from "@remix-gospel-stack/ui/card";
import { Checkbox } from "@remix-gospel-stack/ui/checkbox";

// import { Checkbox } from "@remix-gospel-stack/ui/checkbox";

import Service, { helloWorld } from "~/services.server.ts";

export const loader = async ({ request: _request }: LoaderArgs) => {
const users = await Service.userRepository.getUsers();
return json({ users, serverValue: helloWorld("Remix Turborepo") });
const salesPersons = getSalesPersonDirectory();
return json({
users,
serverValue: helloWorld("Remix Turborepo"),
salesPersons,
});
};

export default function Index() {
const { serverValue, users } = useLoaderData<typeof loader>();
const salesPersons: SalesPersonDirectory = [
{
name: "mark",
email: "mark@remix-gospel-stack.com",
regexp:
/^01|^73|^74|^05|^38|^69|^42|^43|^07|^26|^04|^06|^83|^13|^84|^30|^07|^48|^12|^2B|^2A/,
},
{
name: "coltrane",
email: "coltrane@remix-gospel-stack.com",
regexp:
/^62|^59|^80|^60|^02|^08|^77|^51|^10|^89|^21|^52|^55|^71|^39|^25|^70|^90|^88|^54|^57|^67|^68/,
},
{
name: "philippe",
regexp:
/^33|^24|^16|^17|^87|^23|^36|^18|^41|^37|^86|^79|^85|^86|^18|^58|^03|^23|^63|^15|^19|^23|^87|^19|^46|^15|^46|^82|^81|^34|^66|^11|^09|^31|^32|^65|^64|^40|^47|^82/,
email: "philippe@remix-gospel-stack.com",
},
{
name: "lance",
email: "lance@remix-gospel-stack.com",
regexp:
/^76|^27|^78|^95|^94|^93|^92|^91|^45|^28|^41|^37|^72|^61|^14|^50|^35|^56|^22|^29|^44|^49|^53/,
},
{ name: "john", email: "john@remix-gospel-stack.com", regexp: /^974|^976/ },
{
name: "mike",
email: "mike@remix-gospel-stack.com",
regexp: /^971|^972|^973|^975|^984|^986|^987|^988/,
},
];
const { serverValue, users, salesPersons } = useLoaderData<typeof loader>();
return (
<main className="relative min-h-screen bg-white sm:flex sm:items-center sm:justify-center">
<div className="relative sm:pb-16 sm:pt-8">
Expand Down
42 changes: 21 additions & 21 deletions apps/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "run-s build:*",
"build:remix": "remix build",
"build:server": "tsx ./other/build-server.ts",
"dev": "remix dev -c \"node ./server/dev-server.js\" --no-restart",
"dev": "remix dev -c \"node ./server/dev-server.js\" --manual",
"start": "cross-env NODE_ENV=production node .",
"docker:build": "cd ../.. & docker build -t remix-gospel-stack-remix-app -f ./apps/remix-app/Dockerfile .",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
Expand All @@ -27,9 +27,9 @@
"@remix-gospel-stack/database": "workspace:*",
"@remix-gospel-stack/internal-nobuild": "workspace:*",
"@remix-gospel-stack/ui": "workspace:*",
"@remix-run/express": "^1.18.1",
"@remix-run/node": "^1.18.1",
"@remix-run/react": "^1.18.1",
"@remix-run/express": "^1.19.0",
"@remix-run/node": "^1.19.0",
"@remix-run/react": "^1.19.0",
"address": "^1.2.2",
"chalk": "^5.3.0",
"chokidar": "^3.5.3",
Expand All @@ -46,48 +46,48 @@
},
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"@playwright/test": "^1.35.1",
"@playwright/test": "^1.36.1",
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-run/dev": "^1.18.1",
"@remix-run/eslint-config": "^1.18.1",
"@swc/core": "^1.3.67",
"@remix-run/dev": "^1.19.0",
"@remix-run/eslint-config": "^1.19.0",
"@swc/core": "^1.3.70",
"@swc/helpers": "^0.5.1",
"@tailwindcss/typography": "^0.5.9",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/compression": "^1.7.2",
"@types/eslint": "^8.40.2",
"@types/eslint": "^8.44.0",
"@types/express": "^4.17.17",
"@types/fs-extra": "^11.0.1",
"@types/glob": "8.1.0",
"@types/morgan": "^1.9.4",
"@types/node": "^20.3.3",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@vitejs/plugin-react": "^4.0.1",
"@vitest/coverage-c8": "^0.32.2",
"@types/node": "^20.4.2",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"@vitest/coverage-c8": "^0.32.4",
"autoprefixer": "^10.4.14",
"concurrently": "^8.2.0",
"esbuild": "^0.18.11",
"esbuild": "^0.18.14",
"fs-extra": "^11.1.1",
"glob": "^10.3.1",
"glob": "^10.3.3",
"happy-dom": "^9.20.3",
"msw": "^1.2.2",
"nodemon": "^2.0.22",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.24",
"postcss": "^8.4.26",
"postcss-load-config": "^4.0.1",
"start-server-and-test": "^2.0.0",
"tailwindcss": "^3.3.2",
"tailwindcss": "^3.3.3",
"tailwindcss-animate": "^1.0.6",
"ts-node": "^10.9.1",
"tsx": "^3.12.7",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vite": "^4.4.4",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.2"
"vitest": "^0.32.4"
},
"engines": {
"node": "18"
Expand Down
12 changes: 6 additions & 6 deletions config/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
"./next.js"
],
"dependencies": {
"@remix-run/eslint-config": "^1.18.1",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint-config-next": "^13.4.7",
"@remix-run/eslint-config": "^1.19.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint-config-next": "^13.4.10",
"eslint-config-prettier": "^8.8.0",
"eslint-config-turbo": "^1.10.7",
"eslint-config-turbo": "^1.10.9",
"eslint-plugin-tailwindcss": "^3.13.0"
},
"devDependencies": {
"eslint": "^8.44.0",
"eslint": "^8.45.0",
"typescript": "^5.1.6"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
"validate": "turbo run lint typecheck test"
},
"dependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.0.2",
"@turbo/gen": "^1.10.7",
"@ianvs/prettier-plugin-sort-imports": "^4.1.0",
"@turbo/gen": "^1.10.9",
"json5": "^2.2.3",
"magicast": "^0.2.9",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.3.0",
"replace-in-file": "^7.0.1",
"turbo": "^1.10.7",
"turbo": "^1.10.9",
"typescript": "^5.1.6"
},
"packageManager": "pnpm@8.6.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/business/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"devDependencies": {
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-gospel-stack/tsconfig": "workspace:*",
"@types/node": "^20.3.3",
"@types/node": "^20.4.2",
"rimraf": "^5.0.1",
"tsup": "^7.1.0",
"tsx": "^3.12.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-gospel-stack/tsconfig": "workspace:*",
"@types/node": "^20.3.3",
"@types/node": "^20.4.2",
"prisma": "^4.16.2",
"rimraf": "^5.0.1",
"tsup": "^7.1.0",
Expand Down
30 changes: 26 additions & 4 deletions packages/internal-nobuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "@remix-gospel-stack/internal-nobuild",
"version": "0.0.1",
"private": true,
"main": "./src/index.ts",
"types": "./src/index.ts",
"type": "module",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"clean": "rimraf .turbo node_modules dist",
"lint": "eslint ./src --fix",
"test": "vitest run",
Expand All @@ -16,9 +16,31 @@
"@remix-gospel-stack/eslint-config": "workspace:*",
"@remix-gospel-stack/tsconfig": "workspace:*",
"rimraf": "^5.0.1",
"tsup": "^7.1.0",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vite": "^4.4.4",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.2"
"vitest": "^0.32.4"
},
"exports": {
"./package.json": "./package.json",
".": {
"import": "./src/index.ts",
"types": "./src/types.ts",
"default": "./dist/index.js"
},
"./queries.server": {
"import": "./src/queries.server/index.ts",
"types": "./src/queries.server/index.ts",
"default": "./dist/queries.server/index.js"
},
"./client": {
"import": "./src/client/index.ts",
"types": "./src/client/index.ts",
"default": "./dist/client/index.js"
}
},
"typesVersions": {
"*": {}
}
}
1 change: 1 addition & 0 deletions packages/internal-nobuild/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { lookUpSalesPersonForZipcode } from "./sales-person.ts";
Loading

0 comments on commit 07b6bf6

Please sign in to comment.