Skip to content

Commit

Permalink
Clean dependencies (#1)
Browse files Browse the repository at this point in the history
* add example for unstable remix

* handle .client and .server folders

* Clean the dependencies and make core dependencies upgradeable as needed
  • Loading branch information
rphlmr authored Aug 6, 2024
1 parent 3fdd810 commit bbd0c03
Show file tree
Hide file tree
Showing 41 changed files with 15,080 additions and 14,414 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[css]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Install the following npm package. NOTE: This is not a dev dependency, as it
creates the Hono server used in production.

```bash
npm install hono remix-hono react-router-hono-server
npm install react-router-hono-server
```

## Configuration
Expand Down
5 changes: 3 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
},
"linter": {
"enabled": true,
"ignore": ["example"],
"ignore": ["examples"],
"rules": {
"recommended": true,
"suspicious": {
"recommended": true
},
"style": {
"recommended": true
"recommended": true,
"noParameterAssign": "info"
},
"complexity": {
"recommended": true
Expand Down
35 changes: 0 additions & 35 deletions example/app/routes/_index.tsx

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions example/app/root.tsx → examples/remix-stable/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { LinksFunction } from "@remix-run/node";
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import styles from "~/styles/tailwind.css?url";

export const links: LinksFunction = () => [{ rel: "stylesheet", href: styles }];

export function Layout({ children }: { children: React.ReactNode }) {
return (
Expand All @@ -8,6 +12,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
<link rel="stylesheet" href={styles} />
</head>
<body>
{children}
Expand Down
35 changes: 35 additions & 0 deletions examples/remix-stable/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { getEnv } from "~/utils/env.server";

export function loader() {
return json({
env: getEnv(),
});
}

export default function Index() {
const data = useLoaderData<typeof loader>();
return (
<div className="min-h-screen bg-gray-100 flex flex-col items-center justify-center">
<div className="mt-8 w-full max-w-4xl overflow-x-auto">
<table className="w-full border-collapse bg-gray-100 shadow-md rounded-lg">
<thead>
<tr className="bg-gray-200">
<th className="px-6 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider">Key</th>
<th className="px-6 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider">Value</th>
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{Object.entries(data.env).map(([key, value]) => (
<tr key={key} className="hover:bg-gray-50">
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{key}</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{value ?? "-"}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
}
3 changes: 3 additions & 0 deletions examples/remix-stable/app/styles/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
3 changes: 3 additions & 0 deletions examples/remix-stable/app/utils/env.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getEnv() {
return { ...process.env };
}
12 changes: 7 additions & 5 deletions example/package.json → examples/remix-stable/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "remix-vite",
"name": "remix-stable",
"private": true,
"sideEffects": false,
"type": "module",
Expand All @@ -11,26 +11,28 @@
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/node": "^2.9.1",
"@remix-run/react": "^2.9.1",
"@remix-run/serve": "^2.9.1",
"@remix-run/node": "^2.11.1",
"@remix-run/react": "^2.11.1",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-hono-server": "*"
},
"devDependencies": {
"@remix-run/dev": "^2.9.1",
"@remix-run/dev": "^2.11.1",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"autoprefixer": "^10.4.20",
"eslint": "^8.38.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.7",
"typescript": "^5.1.6",
"vite": "^5.1.0",
"vite-tsconfig-paths": "^4.2.1"
Expand Down
6 changes: 6 additions & 0 deletions examples/remix-stable/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
File renamed without changes.
11 changes: 11 additions & 0 deletions examples/remix-stable/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from "tailwindcss";

const config: Config = {
content: ["./app/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
};

export default config;
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions examples/remix-unstable/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* 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"],

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 examples/remix-unstable/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules

/.cache
/build
.env
36 changes: 36 additions & 0 deletions examples/remix-unstable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Welcome to Remix + Vite!

📖 See the [Remix docs](https://remix.run/docs) and the [Remix Vite docs](https://remix.run/docs/en/main/guides/vite) for details on supported features.

## Development

Run the Vite 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`
18 changes: 18 additions & 0 deletions examples/remix-unstable/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>
);
});
Loading

0 comments on commit bbd0c03

Please sign in to comment.