Skip to content

Commit a809cb5

Browse files
committed
feat: support configurable deployment basepath
1 parent 68d0d13 commit a809cb5

21 files changed

+2393
-1515
lines changed

apps/remix/.eslintrc.cjs

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,84 @@
1+
/**
2+
* This is intended to be a basic starting point for linting in your app.
3+
* It relies on recommended configs out of the box for simplicity, but you can
4+
* and should modify this configuration to best suit your team's needs.
5+
*/
6+
17
/** @type {import('eslint').Linter.Config} */
28
module.exports = {
3-
extends: ['@remix-run/eslint-config', '@remix-run/eslint-config/node'],
9+
root: true,
10+
parserOptions: {
11+
ecmaVersion: 'latest',
12+
sourceType: 'module',
13+
ecmaFeatures: {
14+
jsx: true,
15+
},
16+
},
17+
env: {
18+
browser: true,
19+
commonjs: true,
20+
es6: true,
21+
},
22+
ignorePatterns: ['!**/.server', '!**/.client'],
23+
24+
// Base config
25+
extends: ['eslint:recommended'],
26+
27+
overrides: [
28+
// React
29+
{
30+
files: ['**/*.{js,jsx,ts,tsx}'],
31+
plugins: ['react', 'jsx-a11y'],
32+
extends: [
33+
'plugin:react/recommended',
34+
'plugin:react/jsx-runtime',
35+
'plugin:react-hooks/recommended',
36+
'plugin:jsx-a11y/recommended',
37+
],
38+
settings: {
39+
react: {
40+
version: 'detect',
41+
},
42+
formComponents: ['Form'],
43+
linkComponents: [
44+
{ name: 'Link', linkAttribute: 'to' },
45+
{ name: 'NavLink', linkAttribute: 'to' },
46+
],
47+
'import/resolver': {
48+
typescript: {},
49+
},
50+
},
51+
},
52+
53+
// Typescript
54+
{
55+
files: ['**/*.{ts,tsx}'],
56+
plugins: ['@typescript-eslint', 'import'],
57+
parser: '@typescript-eslint/parser',
58+
settings: {
59+
'import/internal-regex': '^~/',
60+
'import/resolver': {
61+
node: {
62+
extensions: ['.ts', '.tsx'],
63+
},
64+
typescript: {
65+
alwaysTryTypes: true,
66+
},
67+
},
68+
},
69+
extends: [
70+
'plugin:@typescript-eslint/recommended',
71+
'plugin:import/recommended',
72+
'plugin:import/typescript',
73+
],
74+
},
75+
76+
// Node
77+
{
78+
files: ['.eslintrc.cjs'],
79+
env: {
80+
node: true,
81+
},
82+
},
83+
],
484
};

apps/remix/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules
22

3+
/.cache
34
/build
4-
/public/build
55
.env
6-
.cache

apps/remix/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
11
# Remix Vercel Web Analytics Test
2+
3+
## Setup
4+
5+
This application was created with the following commands:
6+
7+
- `cd apps`
8+
- `pnpx create-remix@latest remix` (answers: no git, no dependencies installation)
9+
- `cd remix`
10+
- TODO
11+
- edit package.json to add `"@vercel/analytics": "workspace:*"`
12+
- `pnpm i`
13+
14+
## Usage
15+
16+
Start it with `pnpm -F remix dev` and browse to [http://localhost:5173](http://localhost:5173)

apps/remix/app/root.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
import { cssBundleHref } from '@remix-run/css-bundle';
2-
import type { LinksFunction } from '@remix-run/node';
31
import {
42
Links,
5-
LiveReload,
63
Meta,
74
Outlet,
85
Scripts,
96
ScrollRestoration,
107
} from '@remix-run/react';
118
import { Analytics } from '@vercel/analytics/remix';
129

13-
export const links: LinksFunction = () => [
14-
...(cssBundleHref ? [{ rel: 'stylesheet', href: cssBundleHref }] : []),
15-
];
16-
17-
export default function App() {
10+
export function Layout({ children }: { children: React.ReactNode }) {
1811
return (
1912
<html lang="en">
2013
<head>
@@ -25,11 +18,14 @@ export default function App() {
2518
</head>
2619
<body>
2720
<Analytics />
28-
<Outlet />
21+
{children}
2922
<ScrollRestoration />
3023
<Scripts />
31-
<LiveReload />
3224
</body>
3325
</html>
3426
);
3527
}
28+
29+
export default function App() {
30+
return <Outlet />;
31+
}

apps/remix/app/routes/blog.$slug.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { json, type LoaderFunctionArgs } from '@remix-run/node';
22
import { Link, useLoaderData } from '@remix-run/react';
3-
import { track } from '@vercel/analytics';
43

54
export const loader = async ({ params }: LoaderFunctionArgs) => {
65
return json({ slug: params.slug });

apps/remix/package.json

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
{
22
"name": "remix",
33
"private": true,
4+
"sideEffects": false,
45
"type": "module",
56
"scripts": {
6-
"build": "remix build",
7-
"dev": "remix dev --manual",
8-
"start": "remix-serve ./build/index.js",
7+
"build": "remix vite:build",
8+
"dev": "remix vite:dev",
9+
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
10+
"start": "remix-serve ./build/server/index.js",
911
"typecheck": "tsc"
1012
},
1113
"dependencies": {
12-
"@remix-run/css-bundle": "^2.5.0",
13-
"@remix-run/node": "^2.5.0",
14-
"@remix-run/react": "^2.5.0",
15-
"@remix-run/serve": "^2.5.0",
16-
"@remix-run/server-runtime": "^2.5.0",
14+
"@remix-run/node": "latest",
15+
"@remix-run/react": "latest",
16+
"@remix-run/serve": "latest",
1717
"@vercel/analytics": "workspace:*",
18-
"@vercel/remix": "2.5.0",
19-
"isbot": "^3.6.3",
18+
"isbot": "^4.1.0",
2019
"react": "^18.2.0",
2120
"react-dom": "^18.2.0"
2221
},
2322
"devDependencies": {
24-
"@remix-run/dev": "^2.5.0",
25-
"@remix-run/eslint-config": "^2.5.0",
26-
"@types/react": "^18.0.25",
27-
"@types/react-dom": "^18.0.8",
28-
"eslint": "^8.56.0",
29-
"typescript": "^5.3.3"
23+
"@remix-run/dev": "latest",
24+
"@types/react": "^18.2.20",
25+
"@types/react-dom": "^18.2.7",
26+
"@typescript-eslint/eslint-plugin": "^6.7.4",
27+
"@typescript-eslint/parser": "^6.7.4",
28+
"autoprefixer": "^10.4.19",
29+
"eslint": "^8.38.0",
30+
"eslint-import-resolver-typescript": "^3.6.1",
31+
"eslint-plugin-import": "^2.28.1",
32+
"eslint-plugin-jsx-a11y": "^6.7.1",
33+
"eslint-plugin-react": "^7.33.2",
34+
"eslint-plugin-react-hooks": "^4.6.0",
35+
"postcss": "^8.4.38",
36+
"tailwindcss": "^3.4.4",
37+
"typescript": "^5.1.6",
38+
"vite": "^5.1.0",
39+
"vite-tsconfig-paths": "^4.2.1"
3040
},
3141
"engines": {
32-
"node": ">=18"
42+
"node": ">=20.0.0"
3343
}
3444
}

apps/remix/remix.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/remix/remix.env.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

apps/remix/tsconfig.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
{
2-
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
2+
"include": [
3+
"**/*.ts",
4+
"**/*.tsx",
5+
"**/.server/**/*.ts",
6+
"**/.server/**/*.tsx",
7+
"**/.client/**/*.ts",
8+
"**/.client/**/*.tsx"
9+
],
310
"compilerOptions": {
4-
"lib": ["DOM", "DOM.Iterable", "ES2019"],
11+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
12+
"types": ["@remix-run/node", "vite/client"],
513
"isolatedModules": true,
614
"esModuleInterop": true,
715
"jsx": "react-jsx",
16+
"module": "ESNext",
817
"moduleResolution": "Bundler",
918
"resolveJsonModule": true,
1019
"target": "ES2022",
1120
"strict": true,
1221
"allowJs": true,
22+
"skipLibCheck": true,
1323
"forceConsistentCasingInFileNames": true,
1424
"baseUrl": ".",
1525
"paths": {
1626
"~/*": ["./app/*"]
1727
},
1828

19-
// Remix takes care of building everything in `remix build`.
29+
// Vite takes care of building everything, not tsc.
2030
"noEmit": true
2131
}
2232
}

apps/remix/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { vitePlugin as remix } from '@remix-run/dev';
2+
import { defineConfig } from 'vite';
3+
4+
export default defineConfig({
5+
plugins: [remix()],
6+
});

0 commit comments

Comments
 (0)