Skip to content

Commit

Permalink
migrate to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsam committed Mar 5, 2024
1 parent 84cb96c commit 1dab91c
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 108 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ Dockerfile
node_modules
/.cache
/build
/public/build
.env
/public/generated
/local
*.local.*
*.db
coverage
coverage
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
node_modules

build
public/build
public/generated

# Intentional ignore
*.ignored/
*.ignored.*
*.ignored.*
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ node_modules

/.cache
/build
/public/build
.env

/public/generated

/local
*.local.*

*.db

coverage
coverage
5 changes: 1 addition & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
node_modules

/build
/public/build
/public/generated
/server-build
.env

pnpm-lock.yaml

coverage

drizzle/meta
drizzle/meta
8 changes: 2 additions & 6 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cssBundleHref } from "@remix-run/css-bundle";
import appStylesheet from "#app/styles/app.css";
import appStylesheet from "#app/styles/app.css?url";
import { json } from "@remix-run/node";
import type {
MetaFunction,
Expand All @@ -8,7 +7,6 @@ import type {
} from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -33,7 +31,6 @@ import { csrf } from "./utils/csrf.server.ts";
import { AuthenticityTokenProvider } from "remix-utils/csrf/react";

export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
{ rel: "stylesheet", href: appStylesheet },
{ rel: "manifest", href: "/site.webmanifest" },
...faviconLinks,
Expand Down Expand Up @@ -126,13 +123,12 @@ function Document({
/>
<Scripts nonce={nonce} />
<ScrollRestoration nonce={nonce} />
<LiveReload nonce={nonce} />
</body>
</html>
);
}

export function App() {
function App() {
const data = useLoaderData<typeof loader>();
const nonce = useNonce();
const env = data.env;
Expand Down
6 changes: 3 additions & 3 deletions app/utils/blog.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
import matter from "gray-matter";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __filename = fileURLToPath(import.meta.url); // build/server/index.js
const __dirname = dirname(__filename); // build/server/

const rootPath = resolve(__dirname, "../");
const rootPath = resolve(__dirname, "../../");
const contentDirPath = resolve(rootPath, "./content");
const blogDirPath = resolve(contentDirPath, "./blog");

Expand Down
12 changes: 6 additions & 6 deletions app/utils/compile-mdx.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { cachified } from "cachified";
import { lruCache } from "./cache.server.ts";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __filename = fileURLToPath(import.meta.url); // build/server/index.js
const __dirname = dirname(__filename); // build/server/

const root = resolve(__dirname, "../");
const publicDir = resolve(root, "./public");
const rootPath = resolve(__dirname, "../../");
const assetsDirPath = resolve(rootPath, "./build/client/assets/");

export interface BundleMdx {
source: string;
Expand Down Expand Up @@ -50,8 +50,8 @@ export const compileMdx = async ({ source, files }: BundleMdx) => {
".jpeg": "file",
".gif": "file",
};
options.outdir = resolve(publicDir, "./generated/assets");
options.publicPath = "/generated/assets";
options.outdir = resolve(assetsDirPath, "./blog/");
options.publicPath = "/assets/blog/";
options.write = true;

return options;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev --manual -c \"node server.js\"",
"dev": "node ./server.js",
"build": "remix vite:build",
"start": "cross-env NODE_ENV=production node ./server.js",
"typecheck": "tsc",
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
Expand Down Expand Up @@ -103,6 +103,7 @@
"tailwindcss-animate": "1.0.7",
"tsx": "4.7.1",
"typescript": "5.3.3",
"vite": "5.1.5",
"vite-tsconfig-paths": "4.3.1",
"vitest": "1.3.1"
},
Expand Down
40 changes: 22 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions remix.config.js

This file was deleted.

Loading

0 comments on commit 1dab91c

Please sign in to comment.